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

Separate protocol version for new proxy <-> server connections

Dieser Commit ist enthalten in:
creeper123123321 2018-10-23 16:07:42 -03:00
Ursprung bcf7761380
Commit 782a10f36d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0AC57D54786721D1
2 geänderte Dateien mit 12 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -37,6 +37,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
private StateRegistry state;
private MinecraftSessionHandler sessionHandler;
private int protocolVersion;
private int nextProtocolVersion;
private MinecraftConnectionAssociation association;
private boolean isLegacyForge;
private final VelocityServer server;
@ -185,6 +186,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
public void setProtocolVersion(int protocolVersion) {
this.protocolVersion = protocolVersion;
this.nextProtocolVersion = protocolVersion;
if (protocolVersion != ProtocolConstants.LEGACY) {
this.channel.pipeline().get(MinecraftEncoder.class).setProtocolVersion(protocolVersion);
this.channel.pipeline().get(MinecraftDecoder.class).setProtocolVersion(protocolVersion);
@ -264,4 +266,12 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
public void setCanSendLegacyFMLResetPacket(boolean canSendLegacyFMLResetPacket) {
this.canSendLegacyFMLResetPacket = isLegacyForge && canSendLegacyFMLResetPacket;
}
public int getNextProtocolVersion() {
return this.nextProtocolVersion;
}
public void setNextProtocolVersion(int nextProtocolVersion) {
this.nextProtocolVersion = nextProtocolVersion;
}
}

Datei anzeigen

@ -98,7 +98,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
// Initiate a handshake.
Handshake handshake = new Handshake();
handshake.setNextStatus(StateRegistry.LOGIN_ID);
handshake.setProtocolVersion(proxyPlayer.getConnection().getProtocolVersion());
handshake.setProtocolVersion(proxyPlayer.getConnection().getNextProtocolVersion());
if (forwardingMode == PlayerInfoForwarding.LEGACY) {
handshake.setServerAddress(createBungeeForwardingAddress());
} else if (proxyPlayer.getConnection().isLegacyForge()) {
@ -109,7 +109,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
handshake.setPort(registeredServer.getServerInfo().getAddress().getPort());
connection.write(handshake);
int protocolVersion = proxyPlayer.getConnection().getProtocolVersion();
int protocolVersion = proxyPlayer.getConnection().getNextProtocolVersion();
connection.setProtocolVersion(protocolVersion);
connection.setState(StateRegistry.LOGIN);