Skip to content

Commit

Permalink
fix: shut down javalin on server stopped
Browse files Browse the repository at this point in the history
  • Loading branch information
andantet committed Dec 16, 2024
1 parent d98e323 commit a7d9d3f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/kotlin/dev/andante/audience/AudienceInitializer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
}

0 comments on commit a7d9d3f

Please sign in to comment.