public void gainExp(int gain, boolean show, boolean inChat, boolean white, short partymembers) {
        if (rebirthing) {
            return;
        }
        int maxlevel = 255;
        if (level == maxlevel) {
            setExp(0);
            updateSingleStat(MapleStat.EXP, 0);
            return;
        }
        if (getExp() < 0) {
            client.showMessage(5, "You had negative EXP and now its Fixed by Janet the Pervie ninja.");
            levelUp();
            updateSingleStat(MapleStat.LEVEL, level);
            setExp(0);
            updateSingleStat(MapleStat.EXP, 0);
        }
        if (level < maxlevel) {
            if ((long) this.exp + (long) gain > (long) Integer.MAX_VALUE) {
                int gainFirst = ExpTable.getExpNeededForLevel(level) - this.exp;
                gain -= gainFirst + 1;
                this.gainExp(gainFirst + 1, false, inChat, white, partymembers);
            }
            updateSingleStat(MapleStat.EXP, this.exp + gain);
        } else {
            return;
        }
        if (show && gain != 0) {
            client.getSession().write(MaplePacketCreator.getShowExpGain(gain, inChat, white, partymembers));
        }

        if (exp >= ExpTable.getExpNeededForLevel(level) && level < maxlevel) {
            while (level < maxlevel && exp >= ExpTable.getExpNeededForLevel(level)) {
                levelUp();
            }
        }
    }