public void registerPacket(int id, Class<? extends IPacket> packet){
        if (idToPacketMap == null){
            idToPacketMap = new HashMap<Integer, Class<? extends IPacket>>();
        }
        if (packetToIDMap == null){
            packetToIDMap = new HashMap<Class<? extends IPacket>, Integer>();
        }
        idToPacketMap.put(id, packet);
        packetToIDMap.put(packet, id);
    }