diff --git a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index eae23e31..b6129e38 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -305,6 +305,13 @@ public class PlayerData { getStats().updateAll(); } + public void giveLevels(int value) { + int total = 0; + while (value-- > 0) + total += MMOCore.plugin.configManager.getNeededExperience(getLevel() + value + 1); + giveExperience(total); + } + public void setExperience(int value) { experience = Math.max(0, value); refreshVanillaExp(MMOCore.plugin.configManager.getNeededExperience(getLevel() + 1)); diff --git a/src/main/java/net/Indyuce/mmocore/api/player/Professions.java b/src/main/java/net/Indyuce/mmocore/api/player/Professions.java index 1ebe4b2b..d9218608 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/Professions.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/Professions.java @@ -70,6 +70,13 @@ public class Professions { level.put(profession.getId(), value); } + public void giveLevels(Profession profession, int value) { + int total = 0, level = getLevel(profession); + while (value-- > 0) + total += MMOCore.plugin.configManager.getNeededExperience(level + value + 1); + giveExperience(profession, total); + } + public void giveExperience(Profession profession, int value) { giveExperience(profession, value, null); }