mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-02 12:35:27 +02:00
Clean up on all of our commands. Abstracted experience commands and
hardcore commands. Moved lots of duplicated code to functions in CommandUtils.java. Split /ptp into individual commands, just like /party. Used ternary logic to simplify some of our /skillname stat displays. Fixed skill guide to not allow for negative pages. Simplified logic for many /skillname data calculations. Use permission checks to prevent calculating data that will never be displayed. Made the skill guide into its own command.
This commit is contained in:
@@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.spout;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.spout.SpoutConfig;
|
||||
@@ -28,7 +27,7 @@ public abstract class SpoutCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
playerProfile = UserManager.getPlayer((Player) sender).getProfile();
|
||||
playerProfile = UserManager.getPlayer(sender.getName()).getProfile();
|
||||
spoutHud = playerProfile.getSpoutHud();
|
||||
|
||||
if (spoutHud == null) {
|
||||
|
@@ -6,6 +6,7 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class XplockCommand extends SpoutCommand {
|
||||
@@ -22,25 +23,23 @@ public class XplockCommand extends SpoutCommand {
|
||||
|
||||
@Override
|
||||
protected boolean oneArgument(Command command, CommandSender sender, String[] args) {
|
||||
if (args[0].equalsIgnoreCase("on")) {
|
||||
if (CommandUtils.shouldEnableToggle(args[0])) {
|
||||
lockXpBar(sender, spoutHud.getLastGained());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("off")) {
|
||||
if (CommandUtils.shouldDisableToggle(args[0])) {
|
||||
unlockXpBar(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!SkillUtils.isSkill(args[0])) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||
if (CommandUtils.isInvalidSkill(sender, args[0])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
SkillType skill = SkillType.getSkill(args[0]);
|
||||
|
||||
if (skill.isChildSkill()) {
|
||||
sender.sendMessage("Child skills are not yet supported by this command."); // TODO: Localize this
|
||||
if (CommandUtils.isChildSkill(sender, skill)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user