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 c1ed4a87ae..c8f52ee9af 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 @@ -120,24 +120,31 @@ 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()); + } else { + player.getConnection().write(packet.retain()); } return true; } @Override public boolean handle(PingIdentifyPacket packet) { - if (player.getConnectionInFlight() != null) { - player.getConnectionInFlight().ensureConnected().write(packet); + final VelocityServerConnection serverConn = player.getConnectionInFlight(); + if (serverConn != null) { + serverConn.ensureConnected().write(packet); + } else { + player.getConnection().write(packet); } return true; } @Override public boolean handle(KnownPacksPacket packet) { - if (player.getConnectionInFlight() != null) { - player.getConnectionInFlight().ensureConnected().write(packet); + final VelocityServerConnection serverConn = player.getConnectionInFlight(); + if (serverConn != null) { + serverConn.ensureConnected().write(packet); + } else { + player.getConnection().write(packet); } - return true; }