diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupportImpl.kt | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupportImpl.kt b/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupportImpl.kt index df74eedbb..044f5c817 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupportImpl.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/hotswap/HotswapSupportImpl.kt @@ -19,10 +19,9 @@ class HotswapSupportImpl : HotswapSupportHandle { @SubscribeEvent fun onHotswapClass(event: ClassDefinitionEvent.Redefinition) { - val instance = SkyHanniMod.modules.find { it.javaClass.name == event.fullyQualifiedName } - if (instance == null) return + val instance = SkyHanniMod.modules.find { it.javaClass.name == event.fullyQualifiedName } ?: return val primaryConstructor = runCatching { instance.javaClass.getDeclaredConstructor() }.getOrNull() - Minecraft.getMinecraft().addScheduledTask(Runnable { + Minecraft.getMinecraft().addScheduledTask { LorenzUtils.chat("Refreshing event subscriptions for module $instance!") MinecraftForge.EVENT_BUS.unregister(instance) if (primaryConstructor == null) { @@ -43,7 +42,7 @@ class HotswapSupportImpl : HotswapSupportHandle { SkyHanniMod.modules.add(newInstance) MinecraftForge.EVENT_BUS.register(newInstance) } - }) + } } @SubscribeEvent |