From 65de126934b1b4ed408fcdd97ecb7a7252ea0205 Mon Sep 17 00:00:00 2001 From: Jadon Fowler Date: Tue, 21 Aug 2018 11:45:07 -0700 Subject: [PATCH] Fallback to next server on connection error Closes #11 Co-authored-by: Dylan Keir Signed-off-by: Jadon Fowler --- .../proxy/connection/client/ConnectedPlayer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 ac4220624..ad1d3583a 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 @@ -177,7 +177,12 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { 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. - connection.closeWith(Disconnect.create(disconnectReason)); + Optional nextServer = getNextServerToTry(); + if (nextServer.isPresent()) { + createConnectionRequest(nextServer.get()).fireAndForget(); + } else { + connection.closeWith(Disconnect.create(disconnectReason)); + } } else { connection.write(Chat.create(disconnectReason)); }