From 010a10f50f413bc86e8ac9533166515e125c5074 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Fri, 15 Nov 2019 01:35:44 -0500 Subject: [PATCH] Do not try to prevent people from running Velocity behind Velocity. This commit absolutely does not change our support policy on this: this is a completely unsupported setup. In any event, there is an existing forwarding check in Velocity that covers this case quite well. I am making this change to make the login process less "chatty" for higher-latency links and 1.13+ servers. --- .../client/LoginSessionHandler.java | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java index 05b032ce6..b2c47847f 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java @@ -66,7 +66,6 @@ public class LoginSessionHandler implements MinecraftSessionHandler { private final InitialInboundConnection inbound; private @MonotonicNonNull ServerLogin login; private byte[] verify = EMPTY_BYTE_ARRAY; - private int playerInfoId; private @MonotonicNonNull ConnectedPlayer connectedPlayer; LoginSessionHandler(VelocityServer server, MinecraftConnection mcConnection, @@ -79,29 +78,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler { @Override public boolean handle(ServerLogin packet) { this.login = packet; - if (mcConnection.getProtocolVersion().compareTo(MINECRAFT_1_13) >= 0) { - // To make sure the connecting client isn't Velocity, send a plugin message that Velocity will - // recognize and respond to. - playerInfoId = ThreadLocalRandom.current().nextInt(); - mcConnection.write(new LoginPluginMessage(playerInfoId, VELOCITY_IP_FORWARDING_CHANNEL, - Unpooled.EMPTY_BUFFER)); - } else { - beginPreLogin(); - } - return true; - } - - @Override - public boolean handle(LoginPluginResponse packet) { - if (packet.getId() == playerInfoId) { - if (packet.isSuccess()) { - // Uh oh, someone's trying to run Velocity behind Velocity. We don't want that happening. - inbound.disconnect(VelocityMessages.NO_PROXY_BEHIND_PROXY); - } else { - // Proceed with the regular login process. - beginPreLogin(); - } - } + beginPreLogin(); return true; }