geforkt von Mirrors/Velocity
Merge pull request #121 from creeper123123321/separateprotocolv
Separate protocol version for new proxy <-> server connections
Dieser Commit ist enthalten in:
Commit
6c27ac9576
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren