3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-06 00:00:47 +01:00

Do a better job of passing channel (un)registration to the client.

Also fixes a regression related to WDLCompanion.
Dieser Commit ist enthalten in:
Andrew Steinborn 2019-05-15 18:59:28 -04:00
Ursprung 552f02ed60
Commit a21eaa085a
2 geänderte Dateien mit 10 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -95,8 +95,12 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
// the client. // the client.
if (PluginMessageUtil.isRegister(packet)) { if (PluginMessageUtil.isRegister(packet)) {
serverConn.getPlayer().getKnownChannels().addAll(PluginMessageUtil.getChannels(packet)); serverConn.getPlayer().getKnownChannels().addAll(PluginMessageUtil.getChannels(packet));
serverConn.getPlayer().getMinecraftConnection().write(packet);
return true;
} else if (PluginMessageUtil.isUnregister(packet)) { } else if (PluginMessageUtil.isUnregister(packet)) {
serverConn.getPlayer().getKnownChannels().removeAll(PluginMessageUtil.getChannels(packet)); serverConn.getPlayer().getKnownChannels().removeAll(PluginMessageUtil.getChannels(packet));
serverConn.getPlayer().getMinecraftConnection().write(packet);
return true;
} }
if (PluginMessageUtil.isMcBrand(packet)) { if (PluginMessageUtil.isMcBrand(packet)) {

Datei anzeigen

@ -47,7 +47,7 @@ public class PluginMessage implements MinecraftPacket {
@Override @Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) { public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
this.channel = ProtocolUtils.readString(buf); this.channel = ProtocolUtils.readString(buf);
if (version.compareTo(ProtocolVersion.MINECRAFT_1_13) < 0) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_13) >= 0) {
this.channel = transformLegacyToModernChannel(this.channel); this.channel = transformLegacyToModernChannel(this.channel);
} }
this.data = new byte[buf.readableBytes()]; this.data = new byte[buf.readableBytes()];
@ -59,8 +59,11 @@ public class PluginMessage implements MinecraftPacket {
if (channel == null) { if (channel == null) {
throw new IllegalStateException("Channel is not specified."); throw new IllegalStateException("Channel is not specified.");
} }
ProtocolUtils.writeString(buf, version.compareTo(ProtocolVersion.MINECRAFT_1_13) >= 0 if (version.compareTo(ProtocolVersion.MINECRAFT_1_13) >= 0) {
? channel : transformLegacyToModernChannel(this.channel)); ProtocolUtils.writeString(buf, transformLegacyToModernChannel(this.channel));
} else {
ProtocolUtils.writeString(buf, this.channel);
}
buf.writeBytes(data); buf.writeBytes(data);
} }