Fix skillreset argument validation. Fixes #2651

This commit is contained in:
t00thpick1 2015-11-04 15:43:07 -05:00
parent dd01504111
commit 8927e16b1f

View File

@ -45,7 +45,15 @@ public class SkillresetCommand implements TabExecutor {
return true; return true;
} }
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), SkillType.getSkill(args[0])); SkillType skill;
if (args[0].equalsIgnoreCase("all")) {
skill = null;
}
else {
skill = SkillType.getSkill(args[1]);
}
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill);
return true; return true;
case 2: case 2:
@ -140,7 +148,7 @@ public class SkillresetCommand implements TabExecutor {
} }
private boolean validateArguments(CommandSender sender, String skillName) { private boolean validateArguments(CommandSender sender, String skillName) {
return !(CommandUtils.isInvalidSkill(sender, skillName) && !skillName.equalsIgnoreCase("all")); return skillName.equalsIgnoreCase("all") || !CommandUtils.isInvalidSkill(sender, skillName);
} }
protected static void handleSenderMessage(CommandSender sender, String playerName, SkillType skill) { protected static void handleSenderMessage(CommandSender sender, String playerName, SkillType skill) {