From bfff84d82f1020419e9732dd8fff4053345af45f Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 18 Jan 2024 21:40:06 +0100 Subject: code cleanup --- .../java/at/hannibal2/skyhanni/test/hotswap/HotswapSupportImpl.kt | 7 +++---- 1 file 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 -- cgit