From effca0da821e45fb76440411b97cc2391372d16c Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sat, 25 Sep 2021 17:51:58 -0400 Subject: [PATCH] Preserve virtual host the player connected to for modern/none forwarding This makes these modes in-line with legacy forwarding --- .../proxy/connection/backend/VelocityServerConnection.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java index ed5fd7c3f..75578e95e 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java @@ -173,7 +173,9 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation, } else if (proxyPlayer.getConnection().getType() == ConnectionTypes.LEGACY_FORGE) { handshake.setServerAddress(destAddress.getHostString() + HANDSHAKE_HOSTNAME_TOKEN); } else { - handshake.setServerAddress(destAddress.getHostString()); + handshake.setServerAddress(proxyPlayer.getVirtualHost() + .orElseGet(() -> registeredServer.getServerInfo().getAddress()) + .getHostString()); } handshake.setPort(destAddress.getPort()); mc.delayedWrite(handshake);