From fe052e516323929e6e2f09a5632fc6620bee5e2e Mon Sep 17 00:00:00 2001 From: VelVeV <147647046+VelVeV@users.noreply.github.com> Date: Tue, 16 Jan 2024 22:19:45 +0900 Subject: [PATCH] Fix tablist header and footer desync (#1103) --- .../connection/backend/TransitionSessionHandler.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/TransitionSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/TransitionSessionHandler.java index 0f32fbefb..02203478f 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/TransitionSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/TransitionSessionHandler.java @@ -91,10 +91,9 @@ public class TransitionSessionHandler implements MinecraftSessionHandler { @Override public boolean handle(JoinGame packet) { MinecraftConnection smc = serverConn.ensureConnected(); - RegisteredServer previousServer = serverConn.getPreviousServer().orElse(null); - VelocityServerConnection existingConnection = serverConn.getPlayer().getConnectedServer(); - + final RegisteredServer previousServer = serverConn.getPreviousServer().orElse(null); final ConnectedPlayer player = serverConn.getPlayer(); + final VelocityServerConnection existingConnection = player.getConnectedServer(); if (existingConnection != null) { // Shut down the existing server connection. @@ -103,11 +102,11 @@ public class TransitionSessionHandler implements MinecraftSessionHandler { // Send keep alive to try to avoid timeouts player.sendKeepAlive(); - - // Reset Tablist header and footer to prevent desync - player.clearPlayerListHeaderAndFooter(); } + // Reset Tablist header and footer to prevent desync + player.clearPlayerListHeaderAndFooter(); + // The goods are in hand! We got JoinGame. Let's transition completely to the new state. smc.setAutoReading(false); server.getEventManager()