diff --git a/src/main/java/net/raphimc/viaproxy/proxy/client2proxy/Client2ProxyHandler.java b/src/main/java/net/raphimc/viaproxy/proxy/client2proxy/Client2ProxyHandler.java index 13725c2..1660c70 100644 --- a/src/main/java/net/raphimc/viaproxy/proxy/client2proxy/Client2ProxyHandler.java +++ b/src/main/java/net/raphimc/viaproxy/proxy/client2proxy/Client2ProxyHandler.java @@ -205,7 +205,9 @@ public class Client2ProxyHandler extends SimpleChannelInboundHandler { this.proxyConnection.setUserOptions(userOptions); this.proxyConnection.getPacketHandlers().add(new StatusPacketHandler(this.proxyConnection)); this.proxyConnection.getPacketHandlers().add(new OpenAuthModPacketHandler(this.proxyConnection)); - this.proxyConnection.getPacketHandlers().add(new BrandCustomPayloadPacketHandler(this.proxyConnection)); + if (clientVersion.newerThanOrEqualTo(ProtocolVersion.v1_8)) { + this.proxyConnection.getPacketHandlers().add(new BrandCustomPayloadPacketHandler(this.proxyConnection)); + } this.proxyConnection.getPacketHandlers().add(new CompressionPacketHandler(this.proxyConnection)); this.proxyConnection.getPacketHandlers().add(new LoginPacketHandler(this.proxyConnection)); if (clientVersion.newerThanOrEqualTo(ProtocolVersion.v1_20_5)) { diff --git a/src/main/java/net/raphimc/viaproxy/proxy/packethandler/BrandCustomPayloadPacketHandler.java b/src/main/java/net/raphimc/viaproxy/proxy/packethandler/BrandCustomPayloadPacketHandler.java index 89353d5..5d76b0d 100644 --- a/src/main/java/net/raphimc/viaproxy/proxy/packethandler/BrandCustomPayloadPacketHandler.java +++ b/src/main/java/net/raphimc/viaproxy/proxy/packethandler/BrandCustomPayloadPacketHandler.java @@ -17,7 +17,6 @@ */ package net.raphimc.viaproxy.proxy.packethandler; -import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.util.Key; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufUtil; @@ -51,8 +50,7 @@ public class BrandCustomPayloadPacketHandler extends PacketHandler { public boolean handleP2S(IPacket packet, List listeners) { if (packet instanceof UnknownPacket unknownPacket && (unknownPacket.packetId == this.customPayloadId && this.proxyConnection.getP2sConnectionState() == ConnectionState.PLAY - || unknownPacket.packetId == this.configCustomPayloadId && this.proxyConnection.getP2sConnectionState() == ConnectionState.CONFIGURATION) - && this.proxyConnection.getClientVersion().newerThanOrEqualTo(ProtocolVersion.v1_8)) { + || unknownPacket.packetId == this.configCustomPayloadId && this.proxyConnection.getP2sConnectionState() == ConnectionState.CONFIGURATION)) { final ByteBuf data = Unpooled.wrappedBuffer(unknownPacket.data); final String channel = PacketTypes.readString(data, Short.MAX_VALUE); // channel if (Key.namespaced(channel).equals(BRAND_CHANNEL) || channel.equals(LEGACY_BRAND_CHANNEL)) {