From 24a50346db3f385015cd9dfeb096d36805601120 Mon Sep 17 00:00:00 2001 From: GJ Date: Mon, 2 Apr 2012 16:46:48 -0400 Subject: [PATCH] ACTUALLY made a power level cap. --- src/main/java/com/gmail/nossr50/m.java | 10 ++++++++++ src/main/java/com/gmail/nossr50/skills/Skills.java | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/m.java b/src/main/java/com/gmail/nossr50/m.java index ca7d2c948..1bdcccb54 100644 --- a/src/main/java/com/gmail/nossr50/m.java +++ b/src/main/java/com/gmail/nossr50/m.java @@ -11,6 +11,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.inventory.ItemStack; +import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent; import com.gmail.nossr50.events.items.McMMOItemSpawnEvent; @@ -259,4 +260,13 @@ public class m { return skillLevel; } } + + public static int getPowerLevelCap() { + if (LoadProperties.powerLevelCap > 0) { + return LoadProperties.powerLevelCap; + } + else { + return Integer.MAX_VALUE; + } + } } diff --git a/src/main/java/com/gmail/nossr50/skills/Skills.java b/src/main/java/com/gmail/nossr50/skills/Skills.java index fefb7dd3a..91a5a21c1 100644 --- a/src/main/java/com/gmail/nossr50/skills/Skills.java +++ b/src/main/java/com/gmail/nossr50/skills/Skills.java @@ -195,7 +195,7 @@ public class Skills { if (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++; PP.addLevels(skillType, 1);