From 4090a6eb120d0f2e5ce6a3cbe662a0b514961afa Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Sun, 25 Feb 2024 18:34:49 +0100 Subject: [PATCH] Fixed wrong usage of ProtocolVersion#getProtocol --- src/main/kotlin/com/viaversion/aas/web/WebLogin.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/viaversion/aas/web/WebLogin.kt b/src/main/kotlin/com/viaversion/aas/web/WebLogin.kt index ccd8d27..84509de 100644 --- a/src/main/kotlin/com/viaversion/aas/web/WebLogin.kt +++ b/src/main/kotlin/com/viaversion/aas/web/WebLogin.kt @@ -148,15 +148,13 @@ class WebLogin : WebState { webClient.server.addressCallbacks[callback].complete( AddressInfo( backVersion = obj["version"].asString.let { - var protocol: ProtocolVersion? = null val output = Ints.tryParse(it) - if (output == null) { - val ver = ProtocolVersion.getClosest(it) - if (ver != null) protocol = ver + val protocol = if (output == null) { + ProtocolVersion.getClosest(it) } else { - protocol = ProtocolVersion.getProtocol(output) + ProtocolVersion.getProtocol(output) } - protocol ?: AUTO + if (!protocol!!.isKnown) AUTO else protocol }, backHostAndPort = HostAndPort.fromParts(obj["host"].asString, obj["port"].asInt), frontOnline = obj["frontOnline"].asString.toBooleanStrictOrNull(),