diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-01-13 19:51:29 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-01-13 19:51:29 +0100 |
commit | edd1f10c784728913983e26ac40b49c485ad3a8e (patch) | |
tree | fb8b891e59efffbcaeeb4bb3562043ad3500e256 /src/main/java/at | |
parent | 6ea6c3366219498be2358a0effc1a2492ad0be93 (diff) | |
download | skyhanni-edd1f10c784728913983e26ac40b49c485ad3a8e.tar.gz skyhanni-edd1f10c784728913983e26ac40b49c485ad3a8e.tar.bz2 skyhanni-edd1f10c784728913983e26ac40b49c485ad3a8e.zip |
Add test command /shstoplisteners
Diffstat (limited to 'src/main/java/at')
3 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index ef768b6ef..f99a0ee2b 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -186,7 +186,7 @@ public class SkyHanniMod { repo.loadRepoInformation(); } - private void loadModule(Object object) { + public void loadModule(Object object) { modules.add(object); MinecraftForge.EVENT_BUS.register(object); } diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 9bda0fda1..c8e8d8889 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -37,6 +37,7 @@ object Commands { registerCommand("shmarkplayer") { MarkedPlayerManager.command(it) } registerCommand("togglepacketlog") { LorenzTest.togglePacketLog() } registerCommand("shreloadlisteners") { LorenzTest.reloadListeners() } + registerCommand("shstoplisteners") { LorenzTest.stopListeners() } registerCommand("shresetburrowwarps") { BurrowWarpHelper.resetDisabledWarps() } registerCommand("shtrackcollection") { CollectionCounter.command(it) } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt index f7ab6a90b..f72430139 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt @@ -103,6 +103,17 @@ class LorenzTest { } LorenzUtils.chat("§e[SkyHanni] reloaded ${modules.size} listener classes.") } + + fun stopListeners() { + val modules = SkyHanniMod.modules + for (original in modules.toMutableList()) { + val javaClass = original.javaClass + val simpleName = javaClass.simpleName + MinecraftForge.EVENT_BUS.unregister(original) + println("Unregistered listener $simpleName") + } + LorenzUtils.chat("§e[SkyHanni] stopped ${modules.size} listener classes.") + } } @SubscribeEvent |