Fixed issue with negative XP on level up.

This commit is contained in:
GJ 2012-04-18 08:19:49 -04:00
parent ea7d1ce0e2
commit e3e2def809

View File

@ -188,14 +188,16 @@ public class Skills {
while (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) { while (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) {
if ((skillType.getMaxLevel() >= PP.getSkillLevel(skillType) + 1) && (m.getPowerLevelCap() >= PP.getPowerLevel() + 1)) { if ((skillType.getMaxLevel() >= PP.getSkillLevel(skillType) + 1) && (m.getPowerLevelCap() >= PP.getPowerLevel() + 1)) {
PP.removeXP(skillType, PP.getXpToLevel(skillType));
skillups++; skillups++;
PP.skillUp(skillType, 1); PP.skillUp(skillType, 1);
McMMOPlayerLevelUpEvent eventToFire = new McMMOPlayerLevelUpEvent(player, skillType); McMMOPlayerLevelUpEvent eventToFire = new McMMOPlayerLevelUpEvent(player, skillType);
Bukkit.getPluginManager().callEvent(eventToFire); Bukkit.getPluginManager().callEvent(eventToFire);
} }
else {
PP.removeXP(skillType, PP.getXpToLevel(skillType)); PP.addLevels(skillType, 0);
}
} }
if (!LoadProperties.useMySQL) { if (!LoadProperties.useMySQL) {