Browse Source

Added API to get level caps

Use getLevelCap(String skillType) to get a level cap of a specific
skill.
Use getPowerLevelCap() to get the power level cap.
TfT_02 12 years ago
parent
commit
27ed5f7c38
2 changed files with 24 additions and 0 deletions
  1. 1 0
      Changelog.txt
  2. 23 0
      src/main/java/com/gmail/nossr50/api/ExperienceAPI.java

+ 1 - 0
Changelog.txt

@@ -8,6 +8,7 @@ Key:
   - Removal
 
 Version 1.4.02-dev
+ + Added API to get the skill and power level caps.
 
 Version 1.4.01
  = Fixed bug where trying to use /mctop or /xplock with the Smelting child skill caused NPEs

+ 23 - 0
src/main/java/com/gmail/nossr50/api/ExperienceAPI.java

@@ -237,6 +237,29 @@ public final class ExperienceAPI {
         return UserManager.getPlayer(player).getPowerLevel();
     }
 
+    /**
+     * Get the level cap of a specific skill.
+     * </br>
+     * This function is designed for API usage.
+     *
+     * @param skillType The skill to get the level cap for
+     * @return the level cap of a given skill
+     */
+    public static int getLevelCap(String skillType) {
+        return Config.getInstance().getLevelCap(SkillType.getSkill(skillType));
+    }
+
+    /**
+     * Get the power level cap.
+     * </br>
+     * This function is designed for API usage.
+     *
+     * @return the power level cap of a given skill
+     */
+    public static int getPowerLevelCap() {
+        return Config.getInstance().getPowerLevelCap();
+    }
+
     /**
      * Sets the level of a player in a specific skill type.
      * </br>