Batch handshake and server login/ping packets

This commit is contained in:
Andrew Steinborn 2019-07-29 05:25:29 -04:00
parent d65e371038
commit 1da51b8ffb
2 changed files with 7 additions and 4 deletions

View File

@ -150,11 +150,12 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
handshake.setServerAddress(registeredServer.getServerInfo().getAddress().getHostString());
}
handshake.setPort(registeredServer.getServerInfo().getAddress().getPort());
mc.write(handshake);
mc.delayedWrite(handshake);
mc.setProtocolVersion(protocolVersion);
mc.setState(StateRegistry.LOGIN);
mc.write(new ServerLogin(proxyPlayer.getUsername()));
mc.delayedWrite(new ServerLogin(proxyPlayer.getUsername()));
mc.flush();
}
public @Nullable MinecraftConnection getConnection() {

View File

@ -34,10 +34,12 @@ public class PingSessionHandler implements MinecraftSessionHandler {
handshake.setServerAddress(server.getServerInfo().getAddress().getHostString());
handshake.setPort(server.getServerInfo().getAddress().getPort());
handshake.setProtocolVersion(ProtocolVersion.MINIMUM_VERSION);
connection.write(handshake);
connection.delayedWrite(handshake);
connection.setState(StateRegistry.STATUS);
connection.write(StatusRequest.INSTANCE);
connection.delayedWrite(StatusRequest.INSTANCE);
connection.flush();
}
@Override