Merge pull request #45 from phase/feature/fallback-server

Fallback to next server on connection error
This commit is contained in:
Andrew Steinborn
2018-08-21 17:33:20 -04:00
committed by GitHub

View File

@@ -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.
Optional<ServerInfo> nextServer = getNextServerToTry();
if (nextServer.isPresent()) {
createConnectionRequest(nextServer.get()).fireAndForget();
} else {
connection.closeWith(Disconnect.create(disconnectReason));
}
} else {
connection.write(Chat.create(disconnectReason));
}