org.legacy.network.protocol.messages.CreationResponseMessage.java Source code

Java tutorial

Introduction

Here is the source code for org.legacy.network.protocol.messages.CreationResponseMessage.java

Source

/*
 * Copyright (C) 2014 Legacy 814
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.legacy.network.protocol.messages;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

/**
 * 
 * @author Im Frizzy <skype:kfriz1998>
 * @since Jul 14, 2014
 */
public class CreationResponseMessage {

    public static final int STATUS_OK = 2;
    public static final int STATUS_ERROR_CONTACTING_CREATE_SYSTEM = 3;
    public static final int STATUS_SERVER_BUSY = 7;
    public static final int STATUS_CANNOT_CREATE_AT_THIS_TIME = 9;
    public static final int STATUS_DOB_INVALID = 10;
    public static final int STATUS_DOB_FUTURE = 11;
    public static final int STATUS_DOB_THIS_YEAR = 12;
    public static final int STATUS_DOB_LAST_YEAR = 13;
    public static final int STATUS_COUNTRY_INVALID = 14;
    public static final int STATUS_USERNAME_UNAVAILABLE = 20;
    public static final int STATUS_USERNAME_SUGGESTIONS = 21;
    /* payload: 1 byte count of usernames, n * 8 byte base37 usernames */
    public static final int STATUS_USERNAME_INVALID = 22;
    public static final int STATUS_PASSWORD_INVALID_LENGTH = 30;
    public static final int STATUS_PASSWORD_INVALID_CHARS = 31;
    public static final int STATUS_PASSWORD_TOO_EASY = 32;
    /* 33 = same as above */
    public static final int STATUS_PASSWORD_TOO_SIMILAR_TO_USERNAME = 34;
    /* 35, 36 = same as above */
    public static final int STATUS_SERVER_UPDATED = 37;
    /* 38 = cannot create an account at this time */

    private final int status;
    private final ByteBuf payload;

    public CreationResponseMessage(int status) {
        this.status = status;
        this.payload = Unpooled.EMPTY_BUFFER;
    }

    public CreationResponseMessage(int status, ByteBuf payload) {
        this.status = status;
        this.payload = payload;
    }

    public int getStatus() {
        return status;
    }

    public ByteBuf getPayload() {
        return payload;
    }

}