mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2024-11-21 11:55:15 +01:00
fix -1 (disable viaversion) cases
This commit is contained in:
parent
ed24df38a8
commit
89f8295e0a
@ -117,10 +117,7 @@ public class AddressParser {
|
||||
if (protocolId == null) {
|
||||
protocol = ProtocolVersion.getClosest(arg.replace("_", "."));
|
||||
} else {
|
||||
final ProtocolVersion ver = ProtocolVersion.getProtocol(protocolId);
|
||||
if (ver.isKnown()) {
|
||||
protocol = ver;
|
||||
}
|
||||
protocol = ProtocolVersion.getProtocol(protocolId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,9 +48,8 @@ class HandshakeState : ConnectionState {
|
||||
}
|
||||
|
||||
private fun handleNextState(handler: MinecraftHandler, packet: Handshake) {
|
||||
ProtocolVersion.getProtocol(packet.protocolId).apply {
|
||||
if (this.isKnown) handler.data.frontVer = this
|
||||
}
|
||||
handler.data.frontVer = ProtocolVersion.getProtocol(packet.protocolId)
|
||||
|
||||
when (packet.nextState.ordinal) {
|
||||
1 -> handler.data.state = StatusState()
|
||||
2 -> handler.data.state = LoginState()
|
||||
@ -87,7 +86,7 @@ class HandshakeState : ConnectionState {
|
||||
val addressFromWeb = VIAaaSConfig.hostName.any { parsed.serverAddress.equals(it, ignoreCase = true) }
|
||||
|
||||
handler.data.backServerVer = backProto
|
||||
if (backProto == AUTO) handler.data.autoDetectProtocol = true
|
||||
handler.data.autoDetectProtocol = backProto == AUTO
|
||||
(handler.data.state as? LoginState)?.also {
|
||||
it.frontOnline = frontOnline
|
||||
it.backName = parsed.username
|
||||
|
@ -269,7 +269,7 @@ class LoginState : ConnectionState {
|
||||
val info = AspirinServer.viaWebServer.requestAddressInfo(frontName).await()
|
||||
backAddress = info.backHostAndPort
|
||||
handler.data.backServerVer = info.backVersion
|
||||
if (info.backVersion == AUTO) handler.data.autoDetectProtocol = true
|
||||
handler.data.autoDetectProtocol = info.backVersion == AUTO
|
||||
frontOnline = info.frontOnline
|
||||
info.backName?.also { backName = info.backName }
|
||||
}
|
||||
|
@ -148,13 +148,8 @@ class WebLogin : WebState {
|
||||
webClient.server.addressCallbacks[callback].complete(
|
||||
AddressInfo(
|
||||
backVersion = obj["version"].asString.let {
|
||||
val number = Ints.tryParse(it)
|
||||
val protocol = if (number == null) {
|
||||
ProtocolVersion.getClosest(it)
|
||||
} else {
|
||||
ProtocolVersion.getProtocol(number)
|
||||
} ?: AUTO
|
||||
if (!protocol.isKnown) AUTO else protocol
|
||||
Ints.tryParse(it)?.let { ProtocolVersion.getProtocol(it) }
|
||||
?: ProtocolVersion.getClosest(it) ?: AUTO
|
||||
},
|
||||
backHostAndPort = HostAndPort.fromParts(obj["host"].asString, obj["port"].asInt),
|
||||
frontOnline = obj["frontOnline"].asString.toBooleanStrictOrNull(),
|
||||
|
Loading…
Reference in New Issue
Block a user