13
0
geforkt von Mirrors/Velocity

Merge pull request #121 from creeper123123321/separateprotocolv

Separate protocol version for new proxy <-> server connections
Dieser Commit ist enthalten in:
Andrew Steinborn 2018-10-23 15:26:57 -04:00 committet von GitHub
Commit 6c27ac9576
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
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);