#3527: Switching between servers causes a decoding error

This commit is contained in:
md_5
2023-09-26 06:35:48 +10:00
parent f3397b3003
commit 3cb7a12738
4 changed files with 12 additions and 4 deletions

View File

@@ -31,12 +31,12 @@ public class LegacyDecoder extends ByteToMessageDecoder
if ( packetID == 0xFE )
{
out.add( new PacketWrapper( new LegacyPing( in.isReadable() && in.readUnsignedByte() == 0x01 ), Unpooled.EMPTY_BUFFER ) );
out.add( new PacketWrapper( new LegacyPing( in.isReadable() && in.readUnsignedByte() == 0x01 ), Unpooled.EMPTY_BUFFER, Protocol.STATUS ) );
return;
} else if ( packetID == 0x02 && in.isReadable() )
{
in.skipBytes( in.readableBytes() );
out.add( new PacketWrapper( new LegacyHandshake(), Unpooled.EMPTY_BUFFER ) );
out.add( new PacketWrapper( new LegacyHandshake(), Unpooled.EMPTY_BUFFER, Protocol.STATUS ) );
return;
}

View File

@@ -50,7 +50,7 @@ public class MinecraftDecoder extends MessageToMessageDecoder<ByteBuf>
in.skipBytes( in.readableBytes() );
}
out.add( new PacketWrapper( packet, slice ) );
out.add( new PacketWrapper( packet, slice, protocol ) );
slice = null;
} finally
{

View File

@@ -10,6 +10,7 @@ public class PacketWrapper
public final DefinedPacket packet;
public final ByteBuf buf;
public final Protocol protocol;
@Setter
private boolean released;