3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-26 00:00:55 +01:00

Fix none vhost forwarding with legacy Forge.

Dieser Commit ist enthalten in:
Andrew Steinborn 2021-09-27 00:37:58 -04:00
Ursprung effca0da82
Commit 340e1b23d6

Datei anzeigen

@ -160,8 +160,11 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
PlayerInfoForwarding forwardingMode = server.getConfiguration().getPlayerInfoForwardingMode(); PlayerInfoForwarding forwardingMode = server.getConfiguration().getPlayerInfoForwardingMode();
// Initiate the handshake. // Initiate the handshake.
InetSocketAddress destAddress = registeredServer.getServerInfo().getAddress();
ProtocolVersion protocolVersion = proxyPlayer.getConnection().getProtocolVersion(); ProtocolVersion protocolVersion = proxyPlayer.getConnection().getProtocolVersion();
String playerVhost = proxyPlayer.getVirtualHost()
.orElseGet(() -> registeredServer.getServerInfo().getAddress())
.getHostString();
Handshake handshake = new Handshake(); Handshake handshake = new Handshake();
handshake.setNextStatus(StateRegistry.LOGIN_ID); handshake.setNextStatus(StateRegistry.LOGIN_ID);
handshake.setProtocolVersion(protocolVersion); handshake.setProtocolVersion(protocolVersion);
@ -171,13 +174,12 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
byte[] secret = server.getConfiguration().getForwardingSecret(); byte[] secret = server.getConfiguration().getForwardingSecret();
handshake.setServerAddress(createBungeeGuardForwardingAddress(secret)); handshake.setServerAddress(createBungeeGuardForwardingAddress(secret));
} else if (proxyPlayer.getConnection().getType() == ConnectionTypes.LEGACY_FORGE) { } else if (proxyPlayer.getConnection().getType() == ConnectionTypes.LEGACY_FORGE) {
handshake.setServerAddress(destAddress.getHostString() + HANDSHAKE_HOSTNAME_TOKEN); handshake.setServerAddress(playerVhost + HANDSHAKE_HOSTNAME_TOKEN);
} else { } else {
handshake.setServerAddress(proxyPlayer.getVirtualHost() handshake.setServerAddress(playerVhost);
.orElseGet(() -> registeredServer.getServerInfo().getAddress())
.getHostString());
} }
handshake.setPort(destAddress.getPort());
handshake.setPort(registeredServer.getServerInfo().getAddress().getPort());
mc.delayedWrite(handshake); mc.delayedWrite(handshake);
mc.setProtocolVersion(protocolVersion); mc.setProtocolVersion(protocolVersion);