Skip to content

Commit

Permalink
🧱 Netty -> Jetty, singleplayer works now
Browse files Browse the repository at this point in the history
  • Loading branch information
asoji committed Oct 15, 2024
1 parent 3d76b38 commit 720b5a9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mod_menu = { module = "com.terraformersmc:modmenu", version.ref = "mod_menu_vers
ktor-server-content-negotiation-jvm = { module = "io.ktor:ktor-server-content-negotiation-jvm", version.ref = "ktor" }
ktor-server-core-jvm = { module = "io.ktor:ktor-server-core-jvm", version.ref = "ktor" }
ktor-serialization-gson-jvm = { module = "io.ktor:ktor-serialization-gson-jvm", version.ref = "ktor" }
ktor-server-netty-jvm = { module = "io.ktor:ktor-server-netty-jvm", version.ref = "ktor" }
ktor-server-jetty-jakarta-jvm = { module = "io.ktor:ktor-server-jetty-jakarta-jvm", version.ref = "ktor" }
ktor-server-compression = { module = "io.ktor:ktor-server-compression", version.ref = "ktor" }

# If you have multiple similar dependencies, you can declare a dependency bundle and reference it on the build script with "libs.bundles.example".
Expand All @@ -34,7 +34,7 @@ ktor = [
"ktor-server-content-negotiation-jvm",
"ktor-server-core-jvm",
"ktor-serialization-gson-jvm",
"ktor-server-netty-jvm",
"ktor-server-jetty-jakarta-jvm",
"ktor-server-compression"
]

Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/one/devos/nautical/exposer/Exposer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package one.devos.nautical.exposer
import gay.asoji.fmw.FMW
import io.ktor.server.application.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
import io.ktor.server.jetty.jakarta.*
import io.ktor.server.plugins.compression.*
import io.ktor.server.routing.*
import net.fabricmc.api.ModInitializer
Expand All @@ -18,14 +18,14 @@ object Exposer : ModInitializer {
val LOGGER: Logger = LoggerFactory.getLogger(MOD_ID)
val MOD_NAME: String = FMW.getName(MOD_ID)

private var server: EmbeddedServer<NettyApplicationEngine, NettyApplicationEngine.Configuration>? = null
private var server: EmbeddedServer<JettyApplicationEngine, JettyApplicationEngineBase.Configuration>? = null

override fun onInitialize() {
LOGGER.info("[${MOD_NAME}] Starting up ExposePlayers")

ServerLifecycleEvents.SERVER_STARTED.register { server ->
this.server?.stop()
this.server = embeddedServer(Netty, port = 64589, host = "0.0.0.0", module = {
this.server = embeddedServer(Jetty, port = 64589, host = "0.0.0.0", module = {
install(IgnoreTrailingSlash)
install(Compression)

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"license": "MIT",
"icon": "assets/template/icon.png",
"environment": "server",
"environment": "*",
"entrypoints": {
"main": [
{
Expand Down

0 comments on commit 720b5a9

Please sign in to comment.