private void parsePacket(byte[] data, InetAddress address, int port) { String message = new String(data).trim(); int packetId = Integer.parseInt(message.substring(0, 2)); Packet packet = this.packets.get(packetId); packet.setData(data); packet.handleServer(this); }
protected void addPacket(Packet packet) { this.packets.put((int) packet.getId(), packet); }