Skip to content

Commit

Permalink
Pass the correct virtual host port during the handshake (#1205)
Browse files Browse the repository at this point in the history
  • Loading branch information
4drian3d authored Jan 20, 2024
1 parent d4a6618 commit 46d018c
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ private void startHandshake() {

// Initiate the handshake.
ProtocolVersion protocolVersion = proxyPlayer.getConnection().getProtocolVersion();
String playerVhost =
proxyPlayer.getVirtualHost().orElseGet(() -> registeredServer.getServerInfo().getAddress())
.getHostString();
String playerVhost = proxyPlayer.getVirtualHost()
.orElseGet(() -> registeredServer.getServerInfo().getAddress())
.getHostString();

HandshakePacket handshake = new HandshakePacket();
handshake.setNextStatus(StateRegistry.LOGIN_ID);
Expand All @@ -197,7 +197,9 @@ private void startHandshake() {
handshake.setServerAddress(playerVhost);
}

handshake.setPort(registeredServer.getServerInfo().getAddress().getPort());
handshake.setPort(proxyPlayer.getVirtualHost()
.orElseGet(() -> registeredServer.getServerInfo().getAddress())
.getPort());
mc.delayedWrite(handshake);

mc.setProtocolVersion(protocolVersion);
Expand Down

0 comments on commit 46d018c

Please sign in to comment.