added give levels methods

This commit is contained in:
Indyuce 2019-09-01 14:48:36 +02:00
parent 875a95b412
commit f6396e6406
2 changed files with 14 additions and 0 deletions

View File

@ -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));

View File

@ -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);
}