mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Fixed bug where /addxp was setting instead of adding experience
Fixes #898
This commit is contained in:
parent
f62e053a84
commit
fc8ad40b00
@ -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
|
||||
|
@ -24,7 +24,7 @@ public class AddxpCommand extends ExperienceCommand {
|
||||
mcMMOPlayer.applyXpGain(skill, value);
|
||||
}
|
||||
else {
|
||||
profile.setSkillXpLevel(skill, value);
|
||||
profile.addExperience(skill, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user