mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-12-24 17:47:41 +01:00
Make MinecraftDecoder a MessageToMessageDecoder
This commit is contained in:
parent
93959cab4b
commit
ddfd76ebda
@ -2,13 +2,13 @@ package net.md_5.bungee.protocol;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.ByteToMessageDecoder;
|
||||
import io.netty.handler.codec.MessageToMessageDecoder;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@AllArgsConstructor
|
||||
public class MinecraftDecoder extends ByteToMessageDecoder
|
||||
public class MinecraftDecoder extends MessageToMessageDecoder<ByteBuf>
|
||||
{
|
||||
|
||||
@Setter
|
||||
|
@ -29,6 +29,10 @@ public class Varint21FrameDecoder extends ByteToMessageDecoder
|
||||
if ( buf[i] >= 0 )
|
||||
{
|
||||
int length = DefinedPacket.readVarInt( Unpooled.wrappedBuffer( buf ) );
|
||||
if ( length == 0 )
|
||||
{
|
||||
throw new CorruptedFrameException( "Empty Packet!" );
|
||||
}
|
||||
|
||||
if ( in.readableBytes() < length )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user