From f7f4620b5307e118ec04d46b70892f2415b58c25 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Tue, 23 Jun 2020 14:48:01 -0400 Subject: [PATCH] Temporarily revert DisconnectEvent changes due to some issues --- .../proxy/connection/client/ConnectedPlayer.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 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 9e15f8fce..27ba08d0c 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 @@ -103,9 +103,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { private ClientConnectionPhase connectionPhase; private final Collection knownChannels; private final CompletableFuture teardownFuture = new CompletableFuture<>(); - private @MonotonicNonNull List serversToTry = null; - private boolean explicitlyDisconnected = false; ConnectedPlayer(VelocityServer server, GameProfile profile, MinecraftConnection connection, @Nullable InetSocketAddress virtualHost, boolean onlineMode) { @@ -298,10 +296,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { public void disconnect0(Component reason, boolean duringLogin) { logger.info("{} has disconnected: {}", this, LegacyComponentSerializer.legacy().serialize(reason)); - this.explicitlyDisconnected = true; connection.closeWith(Disconnect.create(reason)); - - server.getEventManager().fireAndForget(new DisconnectEvent(this, duringLogin)); } @Override @@ -593,12 +588,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { } boolean isConnected = server.getPlayer(this.getUniqueId()).isPresent(); server.unregisterConnection(this); - if (!this.explicitlyDisconnected) { - server.getEventManager().fire(new DisconnectEvent(this, !isConnected)) - .thenRun(() -> this.teardownFuture.complete(null)); - } else { - this.teardownFuture.complete(null); - } + server.getEventManager().fire(new DisconnectEvent(this, !isConnected)) + .thenRun(() -> this.teardownFuture.complete(null)); } public CompletableFuture getTeardownFuture() {