diff --git a/src/main/kotlin/dev/andante/audience/AudienceInitializer.kt b/src/main/kotlin/dev/andante/audience/AudienceInitializer.kt index 62a6940..02124d9 100644 --- a/src/main/kotlin/dev/andante/audience/AudienceInitializer.kt +++ b/src/main/kotlin/dev/andante/audience/AudienceInitializer.kt @@ -14,12 +14,16 @@ object AudienceInitializer : ModInitializer { val server: MinecraftServer get() = _minecraftServer override fun onInitialize() { + val javalin = ResourcePackInjectHandler.createJavalin() + // register event to capture server ServerLifecycleEvents.SERVER_STARTING.register { server -> _minecraftServer = server - - val javalin = ResourcePackInjectHandler.createJavalin() javalin.start(server.serverPort) } + + ServerLifecycleEvents.SERVER_STOPPING.register { + javalin.stop() + } } }