public void handlePacket(Packet packet) {
        if (!handlers.containsKey(packet.getID())) {
            throw new IllegalArgumentException("No handler for packet " + packet.getID());
        }
        if(!listeners.get(packet.getClass()).isEmpty()){
            Iterator<PacketListener> it = listeners.get(packet.getClass()).iterator();
            while(it.hasNext()) //Iterator -> no ConcurrentModificationException
                it.next().handlePacket(packet);
        }
        try {
            handlers.get(packet.getID()).invoke(this, packet);
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw new RuntimeException("Could not invoke handler for packet " + packet.getID(), e);
        }
    }