mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-25 18:17:46 +01:00
Fixing an issue with mmoedit triggering notifications for skills already unlocked
This commit is contained in:
parent
57b31b60b3
commit
b125600dac
@ -10,6 +10,8 @@ Key:
|
|||||||
Version 2.1.31
|
Version 2.1.31
|
||||||
Fixed a bug where certain SubSkills did not properly send unlock or rank up notifications
|
Fixed a bug where certain SubSkills did not properly send unlock or rank up notifications
|
||||||
Fixed a bug where unlock notifications would send simultaneously for a specific skill (still happens if mmoedit changes all skill levels on a player at once)
|
Fixed a bug where unlock notifications would send simultaneously for a specific skill (still happens if mmoedit changes all skill levels on a player at once)
|
||||||
|
Fixed NPE with grabbing offline player skill ranks through certain API methods (thanks Ineusia)
|
||||||
|
Updated German language locale (thanks OverCrave)
|
||||||
|
|
||||||
Version 2.1.30
|
Version 2.1.30
|
||||||
Fixed double drops behaving oddly
|
Fixed double drops behaving oddly
|
||||||
|
@ -36,7 +36,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EventUtils.handleLevelChangeEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND);
|
EventUtils.handleLevelChangeEventEdit(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -198,6 +198,22 @@ public class EventUtils {
|
|||||||
return !isCancelled;
|
return !isCancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean handleLevelChangeEventEdit(Player player, PrimarySkillType skill, int levelsChanged, float xpRemoved, boolean isLevelUp, XPGainReason xpGainReason, int oldLevel) {
|
||||||
|
McMMOPlayerLevelChangeEvent event = isLevelUp ? new McMMOPlayerLevelUpEvent(player, skill, levelsChanged - oldLevel, xpGainReason) : new McMMOPlayerLevelDownEvent(player, skill, levelsChanged, xpGainReason);
|
||||||
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
boolean isCancelled = event.isCancelled();
|
||||||
|
|
||||||
|
if (isCancelled) {
|
||||||
|
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||||
|
|
||||||
|
profile.modifySkill(skill, profile.getSkillLevel(skill) - (isLevelUp ? levelsChanged : -levelsChanged));
|
||||||
|
profile.addXp(skill, xpRemoved);
|
||||||
|
}
|
||||||
|
|
||||||
|
return !isCancelled;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulate a block break event.
|
* Simulate a block break event.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user