Tiny rework of Protocol Version API (#1260)

This commit is contained in:
Maxim Breitman
2024-03-02 06:42:02 +03:00
committed by GitHub
parent af09677f60
commit 82189a6a21
3 changed files with 56 additions and 29 deletions

View File

@@ -117,7 +117,7 @@ public class HandshakeSessionHandler implements MinecraftSessionHandler {
}
private void handleLogin(HandshakePacket handshake, InitialInboundConnection ic) {
if (!ProtocolVersion.isSupported(handshake.getProtocolVersion())) {
if (!handshake.getProtocolVersion().isSupported()) {
// Bump connection into correct protocol state so that we can send the disconnect packet.
connection.setState(StateRegistry.LOGIN);
ic.disconnectQuietly(Component.translatable()

View File

@@ -143,7 +143,7 @@ public class ServerListPingHandler {
*/
public CompletableFuture<ServerPing> getInitialPing(VelocityInboundConnection connection) {
VelocityConfiguration configuration = server.getConfiguration();
ProtocolVersion shownVersion = ProtocolVersion.isSupported(connection.getProtocolVersion())
ProtocolVersion shownVersion = connection.getProtocolVersion().isSupported()
? connection.getProtocolVersion() : ProtocolVersion.MAXIMUM_VERSION;
PingPassthroughMode passthroughMode = configuration.getPingPassthrough();