13
0
geforkt von Mirrors/Velocity

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.
if (PluginMessageUtil.isRegister(packet)) {
serverConn.getPlayer().getKnownChannels().addAll(PluginMessageUtil.getChannels(packet));
serverConn.getPlayer().getMinecraftConnection().write(packet);
return true;
} else if (PluginMessageUtil.isUnregister(packet)) {
serverConn.getPlayer().getKnownChannels().removeAll(PluginMessageUtil.getChannels(packet));
serverConn.getPlayer().getMinecraftConnection().write(packet);
return true;
}
if (PluginMessageUtil.isMcBrand(packet)) {

Datei anzeigen

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