From 21b99857de782788ab283b7e4fbab7a18d4aed00 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sat, 11 Dec 2021 19:09:36 -0500 Subject: [PATCH] maybe fix repo hiders idk --- src/main/kotlin/skytils/skytilsmod/Skytils.kt | 2 +- src/main/kotlin/skytils/skytilsmod/core/DataFetcher.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/skytils/skytilsmod/Skytils.kt b/src/main/kotlin/skytils/skytilsmod/Skytils.kt index dc54e6504..59d19ecb7 100644 --- a/src/main/kotlin/skytils/skytilsmod/Skytils.kt +++ b/src/main/kotlin/skytils/skytilsmod/Skytils.kt @@ -146,6 +146,7 @@ class Skytils { @Mod.EventHandler fun preInit(event: FMLPreInitializationEvent) { + DataFetcher.preload() if (!modDir.exists()) modDir.mkdirs() File(modDir, "trackers").mkdirs() guiManager = GuiManager() @@ -286,7 +287,6 @@ class Skytils { cch.commandMap["rp"] = RepartyCommand } - DataFetcher.preload() MayorInfo.fetchMayorData() MinecraftForge.EVENT_BUS.register(SpamHider()) diff --git a/src/main/kotlin/skytils/skytilsmod/core/DataFetcher.kt b/src/main/kotlin/skytils/skytilsmod/core/DataFetcher.kt index 98e012c4a..2e7294d62 100644 --- a/src/main/kotlin/skytils/skytilsmod/core/DataFetcher.kt +++ b/src/main/kotlin/skytils/skytilsmod/core/DataFetcher.kt @@ -159,12 +159,13 @@ object DataFetcher { } APIUtil.getArrayResponse("${Skytils.config.dataURL}SpamFilters.json").apply { Utils.checkThreadAndQueue { + val filters = SpamHider.repoFilters.toHashSet() SpamHider.repoFilters.clear() mapTo(SpamHider.repoFilters) { it as JsonObject SpamHider.Filter( it["name"].asString, - 0, + filters.find { f -> f.name == it["name"].asString }?.state ?: 0, true, it["pattern"].asString.toRegex(), when (it["type"].asString) {