Made PacketDecoder more readable

This commit is contained in:
themode 2020-11-18 11:15:58 +01:00
parent e619dd6a8e
commit 408ce03cfb

View File

@ -13,7 +13,8 @@ public class PacketDecoder extends ByteToMessageDecoder {
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf buf, List<Object> list) {
if (buf.readableBytes() > 0) {
list.add(new InboundPacket(Utils.readVarInt(buf), buf));
final int packetId = Utils.readVarInt(buf);
list.add(new InboundPacket(packetId, buf));
}
}
}