diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-28 10:27:02 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-28 10:27:02 +0200 |
commit | 57a4971ab247be746ebb5cdad6ecb20d05936147 (patch) | |
tree | fafc10407b3956f1e711f46dd73e359d2b73c9b4 /src/main/java/at/hannibal2 | |
parent | 90946f9f42881e6c7263cfd6e03ee40ddc47bfe6 (diff) | |
download | skyhanni-57a4971ab247be746ebb5cdad6ecb20d05936147.tar.gz skyhanni-57a4971ab247be746ebb5cdad6ecb20d05936147.tar.bz2 skyhanni-57a4971ab247be746ebb5cdad6ecb20d05936147.zip |
added blocked feature list file support to reloadlisteners command
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt index e7574bb85..4bad04b3d 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt @@ -17,6 +17,7 @@ import net.minecraftforge.event.entity.living.EnderTeleportEvent import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.io.File class LorenzTest { @@ -85,10 +86,23 @@ class LorenzTest { } fun reloadListeners() { + val blockedFeatures = try { + File("config/skyhanni/blocked-features.txt").readLines().toList() + } catch (e: Exception) { + emptyList() + } + val listenerClasses = SkyHanniMod.listenerClasses for (any in listenerClasses) { + val simpleName = any.javaClass.simpleName MinecraftForge.EVENT_BUS.unregister(any) - MinecraftForge.EVENT_BUS.register(any) + println("Unregistered listener $simpleName") + if (simpleName !in blockedFeatures) { + MinecraftForge.EVENT_BUS.register(any) + println("Registered listener $simpleName") + } else { + println("Skipped registering listener $simpleName") + } } LorenzUtils.chat("§e[SkyHanni] reloaded ${listenerClasses.size} listener classes.") } |