mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
45 lines
1.3 KiB
Java
45 lines
1.3 KiB
Java
package com.gmail.nossr50.commands.experience;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
|
import com.gmail.nossr50.util.EventUtils;
|
|
import com.gmail.nossr50.util.Permissions;
|
|
|
|
public class MmoeditCommand extends ExperienceCommand {
|
|
@Override
|
|
protected boolean permissionsCheckSelf(CommandSender sender) {
|
|
return Permissions.mmoedit(sender);
|
|
}
|
|
|
|
@Override
|
|
protected boolean permissionsCheckOthers(CommandSender sender) {
|
|
return Permissions.mmoeditOthers(sender);
|
|
}
|
|
|
|
@Override
|
|
protected void handleCommand(SkillType skill) {
|
|
int skillLevel = profile.getSkillLevel(skill);
|
|
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
|
|
|
profile.modifySkill(skill, value);
|
|
|
|
if (player == null || value == skillLevel) {
|
|
return;
|
|
}
|
|
|
|
EventUtils.handleLevelChangeEvent(player, skill, value, xpRemoved, value > skillLevel);
|
|
}
|
|
|
|
@Override
|
|
protected void handlePlayerMessageAll() {
|
|
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", value));
|
|
}
|
|
|
|
@Override
|
|
protected void handlePlayerMessageSkill() {
|
|
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getName(), value));
|
|
}
|
|
}
|