mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Fire McMMOPlayerLevelUp events for our experience commands, when
applicable. Fixes #921
This commit is contained in:
parent
87df536a1f
commit
a2f80569e3
@ -2,7 +2,9 @@ package com.gmail.nossr50.commands.experience;
|
|||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
@ -21,6 +23,10 @@ public class AddlevelsCommand extends ExperienceCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void handleCommand(SkillType skill) {
|
protected void handleCommand(SkillType skill) {
|
||||||
profile.addLevels(skill, value);
|
profile.addLevels(skill, value);
|
||||||
|
|
||||||
|
if (player != null) {
|
||||||
|
mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerLevelUpEvent(player, skill, value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,7 +2,9 @@ package com.gmail.nossr50.commands.experience;
|
|||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
@ -21,6 +23,10 @@ public class MmoeditCommand extends ExperienceCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void handleCommand(SkillType skill) {
|
protected void handleCommand(SkillType skill) {
|
||||||
profile.modifySkill(skill, value);
|
profile.modifySkill(skill, value);
|
||||||
|
|
||||||
|
if (player != null) {
|
||||||
|
mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerLevelUpEvent(player, skill, value - profile.getSkillLevel(skill)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,8 +3,10 @@ package com.gmail.nossr50.commands.experience;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
|
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
@ -84,13 +86,11 @@ public class SkillresetCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean permissionsCheckSelf(CommandSender sender) {
|
protected boolean permissionsCheckSelf(CommandSender sender) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean permissionsCheckOthers(CommandSender sender) {
|
protected boolean permissionsCheckOthers(CommandSender sender) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +102,10 @@ public class SkillresetCommand extends ExperienceCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
profile.modifySkill(skill, 0);
|
profile.modifySkill(skill, 0);
|
||||||
|
|
||||||
|
if (player != null) {
|
||||||
|
mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerLevelUpEvent(player, skill, 0 - profile.getSkillLevel(skill)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,7 +17,7 @@ public class McMMOPlayerLevelUpEvent extends McMMOPlayerExperienceEvent {
|
|||||||
|
|
||||||
public McMMOPlayerLevelUpEvent(Player player, SkillType skill, int levelsGained) {
|
public McMMOPlayerLevelUpEvent(Player player, SkillType skill, int levelsGained) {
|
||||||
super(player, skill);
|
super(player, skill);
|
||||||
this.setLevelsGained(levelsGained);
|
this.levelsGained = levelsGained;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user