From 64c16e61d2f7dbe18ca60afa4650419938001e2e Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Mon, 25 May 2020 11:44:02 -0400 Subject: [PATCH] Reset in-flight connection only if the server disconnects the client. --- .../proxy/connection/client/ConnectedPlayer.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 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 09bfd08e2..19f519591 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 @@ -766,11 +766,12 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { public CompletableFuture connect() { return this.internalConnect() .whenCompleteAsync((status, throwable) -> { - if (status != null && !status.isSafe()) { - // If it's not safe to continue the connection we need to shut it down. - handleConnectionException(status.getAttemptedConnection(), throwable, true); - } else if ((status != null && !status.isSuccessful())) { - resetInFlightConnection(); + if (status != null && !status.isSuccessful()) { + if (!status.isSafe()) { + handleConnectionException(status.getAttemptedConnection(), throwable, false); + } else if (status.getStatus() == Status.SERVER_DISCONNECTED) { + resetInFlightConnection(); + } } }, connection.eventLoop()) .thenApply(x -> x);