diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-01-18 21:40:06 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-01-18 21:40:06 +0100 |
commit | bfff84d82f1020419e9732dd8fff4053345af45f (patch) | |
tree | 71f0cc8b49cdcd09b8945857eac9e58cf1f732ed /src/main/java/at | |
parent | b8adb961f50d17c02dbccbbb00376a2f728c819b (diff) | |
download | skyhanni-bfff84d82f1020419e9732dd8fff4053345af45f.tar.gz skyhanni-bfff84d82f1020419e9732dd8fff4053345af45f.tar.bz2 skyhanni-bfff84d82f1020419e9732dd8fff4053345af45f.zip |
code cleanup
Diffstat (limited to 'src/main/java/at')
-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 |