mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 08:39:11 +00:00
Remove useless if
This commit is contained in:
@@ -31,14 +31,11 @@ public final class GamePacketEncoder extends MessageToByteEncoder<GamePacket> {
|
||||
protected void encode(ChannelHandlerContext ctx, GamePacket packet, ByteBuf out) throws Exception {
|
||||
PacketType type = packet.getType();
|
||||
int payloadLength = packet.getLength();
|
||||
if (type == PacketType.VARIABLE_BYTE) {
|
||||
if (payloadLength >= 256) {
|
||||
throw new Exception("Payload too long for variable byte packet.");
|
||||
}
|
||||
} else if (type == PacketType.VARIABLE_SHORT) {
|
||||
if (payloadLength >= 65_536) {
|
||||
throw new Exception("Payload too long for variable short packet.");
|
||||
}
|
||||
|
||||
if (type == PacketType.VARIABLE_BYTE && payloadLength >= 256) {
|
||||
throw new Exception("Payload too long for variable byte packet.");
|
||||
} else if (type == PacketType.VARIABLE_SHORT && payloadLength >= 65_536) {
|
||||
throw new Exception("Payload too long for variable short packet.");
|
||||
}
|
||||
|
||||
out.writeByte(packet.getOpcode() + random.nextInt() & 0xFF);
|
||||
|
||||
Reference in New Issue
Block a user