From 27760f5a978c238ea4bbdd467f0fa0be1c4ac09b Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Wed, 22 Aug 2018 21:10:14 -0400 Subject: [PATCH] Limit scope of "attempted server connections" to just initial log ons. --- .../proxy/connection/client/ConnectedPlayer.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java index 66d037078..0d4beb4d4 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java @@ -182,15 +182,18 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { public void handleConnectionException(ServerInfo info, Component disconnectReason) { connectionInFlight = null; - if (connectedServer == null || connectedServer.getServerInfo().equals(info)) { - // The player isn't yet connected to a server or they are already connected to the server - // they're disconnected from. + if (connectedServer == null) { + // The player isn't yet connected to a server. Optional nextServer = getNextServerToTry(); if (nextServer.isPresent()) { createConnectionRequest(nextServer.get()).fireAndForget(); } else { connection.closeWith(Disconnect.create(disconnectReason)); } + } else if (connectedServer.getServerInfo().equals(info)) { + // Already connected to the server being disconnected from. + // TODO: ServerKickEvent + connection.closeWith(Disconnect.create(disconnectReason)); } else { connection.write(Chat.create(disconnectReason)); }