ACTUALLY made a power level cap.

This commit is contained in:
GJ 2012-04-02 16:46:48 -04:00
parent b84a03082e
commit 24a50346db
2 changed files with 11 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.LoadProperties;
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent; import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
import com.gmail.nossr50.events.items.McMMOItemSpawnEvent; import com.gmail.nossr50.events.items.McMMOItemSpawnEvent;
@ -259,4 +260,13 @@ public class m {
return skillLevel; return skillLevel;
} }
} }
public static int getPowerLevelCap() {
if (LoadProperties.powerLevelCap > 0) {
return LoadProperties.powerLevelCap;
}
else {
return Integer.MAX_VALUE;
}
}
} }

View File

@ -195,7 +195,7 @@ public class Skills {
if (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) { if (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) {
while (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) { while (PP.getSkillXpLevel(skillType) >= PP.getXpToLevel(skillType)) {
if ((skillType.getMaxLevel() >= PP.getSkillLevel(skillType) + 1) && (LoadProperties.powerLevelCap >= PP.getPowerLevel() + 1)) { if ((skillType.getMaxLevel() >= PP.getSkillLevel(skillType) + 1) && (m.getPowerLevelCap() >= PP.getPowerLevel() + 1)) {
skillups++; skillups++;
PP.addLevels(skillType, 1); PP.addLevels(skillType, 1);