From 11b5c54c6912d5a1d01a6f63d98e693559227b45 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Wed, 26 Dec 2012 19:54:20 -0800 Subject: [PATCH] Reimplementing skill level and power level caps. --- src/main/java/com/gmail/nossr50/config/Config.java | 5 ++++- src/main/java/com/gmail/nossr50/util/Skills.java | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 4ceefa919..379847bac 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -345,7 +345,10 @@ public class Config extends ConfigLoader { public int getLevelCapTaming() { return config.getInt("Skills.Taming.Level_Cap", 0); } public int getLevelCapUnarmed() { return config.getInt("Skills.Unarmed.Level_Cap", 0); } public int getLevelCapWoodcutting() { return config.getInt("Skills.Woodcutting.Level_Cap", 0); } - public int getPowerLevelCap() { return config.getInt("General.Power_Level_Cap", 0); } + public int getPowerLevelCap() { + int cap = config.getInt("General.Power_Level_Cap", 0); + return ((cap == 0) ? Integer.MAX_VALUE : cap); + } /* PVP & PVE Settings */ public boolean getAcrobaticsPVP() { return config.getBoolean("Skills.Acrobatics.Enabled_For_PVP", true); } diff --git a/src/main/java/com/gmail/nossr50/util/Skills.java b/src/main/java/com/gmail/nossr50/util/Skills.java index 4c4655966..9c6b82574 100644 --- a/src/main/java/com/gmail/nossr50/util/Skills.java +++ b/src/main/java/com/gmail/nossr50/util/Skills.java @@ -533,6 +533,9 @@ public class Skills { if(Users.getPlayer(player) == null) return; + if((type.getMaxLevel() < profile.getSkillLevel(type) + 1) || (Misc.getPowerLevelCap() < Users.getPlayer(player).getPowerLevel() + 1)) + return; + Users.getPlayer(player).addXP(type, xp); xpCheckSkill(type, player, profile); }