From 15897c5258d6d69bde5a4e78b0bd5db336c4890b Mon Sep 17 00:00:00 2001 From: Gero Date: Sat, 10 Feb 2024 23:28:08 +0100 Subject: [PATCH] Fix race condition when switching client from config to play state --- .../proxy/connection/client/ClientConfigSessionHandler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientConfigSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientConfigSessionHandler.java index 1d566748b..99a916242 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientConfigSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientConfigSessionHandler.java @@ -197,7 +197,10 @@ public class ClientConfigSessionHandler implements MinecraftSessionHandler { smc.write(brandPacket); } - player.getConnection().write(FinishedUpdatePacket.INSTANCE); + player.getConnection().eventLoop().execute(() -> { + player.getConnection().write(FinishedUpdatePacket.INSTANCE); + player.getConnection().getChannel().pipeline().get(MinecraftEncoder.class).setState(StateRegistry.PLAY); + }); smc.write(FinishedUpdatePacket.INSTANCE); smc.getChannel().pipeline().get(MinecraftEncoder.class).setState(StateRegistry.PLAY);