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:
Ursprung
bcf7761380
Commit
782a10f36d
@ -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