From 32c5baf2ffd9ea759463a37203eb4a7a8d225383 Mon Sep 17 00:00:00 2001 From: valaphee <32491319+valaphee@users.noreply.github.com> Date: Thu, 14 Nov 2024 19:14:01 +0100 Subject: [PATCH] Pass through packets in config phase --- .../client/ClientConfigSessionHandler.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) 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 7bb7bedfa2..f9f50504b3 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 @@ -125,8 +125,10 @@ public boolean handle(final PluginMessagePacket packet) { // but at this time the backend server may not be ready } else if (serverConn != null) { serverConn.ensureConnected().write(packet.retain()); + return true; } - return true; + + return false; } @Override @@ -141,14 +143,17 @@ public boolean handle(PingIdentifyPacket packet) { @Override public boolean handle(KnownPacksPacket packet) { - callConfigurationEvent().thenRun(() -> { - player.getConnectionInFlightOrConnectedServer().ensureConnected().write(packet); - }).exceptionally(ex -> { - logger.error("Error forwarding known packs response to backend:", ex); - return null; - }); + if (player.getConnectionInFlight() != null) { + callConfigurationEvent().thenRun(() -> { + player.getConnectionInFlight().ensureConnected().write(packet); + }).exceptionally(ex -> { + logger.error("Error forwarding known packs response to backend:", ex); + return null; + }); + return true; + } - return true; + return false; } @Override