From 87bff1a1231acdc784a31c10104d9e864374160d Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Tue, 4 Aug 2020 12:14:28 -0400 Subject: [PATCH] Remove nextProtocolVersion from MinecraftConnection ViaVersion was the only intended user. However, ViaVersion for Velocity 1.1.0 no longer uses this functionality, and so it doesn't make sense to keep it in Velocity 1.1.0. --- .../proxy/connection/MinecraftConnection.java | 10 ---------- .../connection/backend/VelocityServerConnection.java | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java index f6de660ee..c3212d09e 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java @@ -60,7 +60,6 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { private StateRegistry state; private @Nullable MinecraftSessionHandler sessionHandler; private ProtocolVersion protocolVersion; - private ProtocolVersion nextProtocolVersion; private @Nullable MinecraftConnectionAssociation association; private final VelocityServer server; private ConnectionType connectionType = ConnectionTypes.UNDETERMINED; @@ -333,7 +332,6 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { ensureInEventLoop(); this.protocolVersion = protocolVersion; - this.nextProtocolVersion = protocolVersion; if (protocolVersion != ProtocolVersion.LEGACY) { this.channel.pipeline().get(MinecraftEncoder.class).setProtocolVersion(protocolVersion); this.channel.pipeline().get(MinecraftDecoder.class).setProtocolVersion(protocolVersion); @@ -419,14 +417,6 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { this.association = association; } - public ProtocolVersion getNextProtocolVersion() { - return this.nextProtocolVersion; - } - - public void setNextProtocolVersion(ProtocolVersion nextProtocolVersion) { - this.nextProtocolVersion = nextProtocolVersion; - } - /** * Gets the detected {@link ConnectionType}. * @return The {@link ConnectionType} diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java index e2aaf7f74..fe1144157 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java @@ -131,7 +131,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation, // Initiate the handshake. InetSocketAddress destAddress = registeredServer.getServerInfo().getAddress(); - ProtocolVersion protocolVersion = proxyPlayer.getConnection().getNextProtocolVersion(); + ProtocolVersion protocolVersion = proxyPlayer.getConnection().getProtocolVersion(); Handshake handshake = new Handshake(); handshake.setNextStatus(StateRegistry.LOGIN_ID); handshake.setProtocolVersion(protocolVersion);