public void putPacket(int packetId, Player player) { if (packetId < 0) { throw new IllegalArgumentException("Invalid packet ID: " + packetId); } if (packetId >= 128) { putByte(((packetId >> 8) + 128) + player.getEncodingCipher().nextInt()); putByte(packetId + player.getEncodingCipher().nextInt()); } else { putByte(packetId + player.getEncodingCipher().nextInt()); } }
public void putCipheredByte(int val, Player player, int shift) { putByte((val + player.getEncodingCipher().nextInt()) >> shift); }