@SuppressWarnings("rawtypes")
    private PacketType(Class... classes) {
        opcode = (byte) nextOpcode++;
        packets[opcode] = this;
        params = new Class[classes.length];

        int thisPacketLength = 0;

        for (int i = 0; i < classes.length; i++) {
            Class fieldType = classes[i];

            params[i] = fieldType;

            if (fieldType == Long.TYPE) {
                thisPacketLength += 8;
            } else if (fieldType == Integer.TYPE) {
                thisPacketLength += 4;
            } else if (fieldType == Short.TYPE) {
                thisPacketLength += 2;
            } else if (fieldType == Byte.TYPE) {
                thisPacketLength += 1;
            } else if (fieldType == Float.TYPE) {
                thisPacketLength += 4;
            } else if (fieldType == Double.TYPE) {
                thisPacketLength += 8;
            } else if (fieldType == byte[].class) {
                thisPacketLength += 1024;
            } else if (fieldType == String.class) {
                thisPacketLength += 64;
            }
        }

        this.length = thisPacketLength;
    }