Fixed bug where /addxp was setting instead of adding experience

Fixes #898
This commit is contained in:
TfT_02 2013-03-30 10:50:05 +01:00
parent f62e053a84
commit fc8ad40b00
3 changed files with 16 additions and 1 deletions

View File

@ -9,6 +9,7 @@ Key:
Version 1.4.05-dev
+ Added option to allow refreshing of chunks after block-breaking abilities. (Disabled by default)
= Fixed bug where /addxp was setting instead of adding experience
Version 1.4.04
+ Added functions to ExperienceAPI for use with offline players

View File

@ -24,7 +24,7 @@ public class AddxpCommand extends ExperienceCommand {
mcMMOPlayer.applyXpGain(skill, value);
}
else {
profile.setSkillXpLevel(skill, value);
profile.addExperience(skill, value);
}
}

View File

@ -666,6 +666,20 @@ public class PlayerProfile {
skillsXp.put(skillType, 0);
}
/**
* Add Experience to a skill.
*
* @param skillType Type of skill to add experience to
* @param experience Number of experience to add
*/
public void addExperience(SkillType skillType, int experience) {
if (skillType.isChildSkill()) {
return;
}
skillsXp.put(skillType, skillsXp.get(skillType) + experience);
}
/**
* Get the amount of Xp remaining before the next level.
*