Fix /addlevels all and /skillreset all commands

Fixes #1675
This commit is contained in:
TfT_02 2013-12-12 16:50:36 +01:00
parent 7c7aa994a5
commit 65aa05a660
3 changed files with 15 additions and 6 deletions

View File

@ -25,6 +25,7 @@ Version 1.4.08-dev
= Fixed bug where disabling hardcore mode for specific skills didn't work
= Fixed bug which caused the backup cleanup to delete old backups while it should have kept those
= Fixed bug where party chat broke if the display name contained special characters
= Fixed bug where `/addlevels all` and `/skillreset all` didn't work
! Updated localization files
! Changed AxesCritical to CriticalHit in config file
! Changed several secondary ability permissions(deprecated versions still exist)

View File

@ -24,6 +24,8 @@ import com.google.common.collect.ImmutableList;
public abstract class ExperienceCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
SkillType skill;
switch (args.length) {
case 2:
if (CommandUtils.noConsoleUsage(sender)) {
@ -39,7 +41,13 @@ public abstract class ExperienceCommand implements TabExecutor {
return true;
}
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), SkillType.getSkill(args[0]), Integer.parseInt(args[1]));
skill = SkillType.getSkill(args[0]);
if (args[1].equalsIgnoreCase("all")) {
skill = null;
}
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]));
return true;
case 3:
@ -52,12 +60,12 @@ public abstract class ExperienceCommand implements TabExecutor {
return true;
}
SkillType skill;
skill = SkillType.getSkill(args[1]);
if (args[1].equalsIgnoreCase("all")) {
skill = null;
} else {
skill = SkillType.getSkill(args[1]);
}
int value = Integer.parseInt(args[2]);
String playerName = Misc.getMatchedPlayerName(args[0]);
@ -123,7 +131,7 @@ public abstract class ExperienceCommand implements TabExecutor {
protected void editValues(Player player, PlayerProfile profile, SkillType skill, int value) {
if (skill == null) {
for (SkillType skillType : SkillType.values()) {
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
handleCommand(player, profile, skillType, value);
}

View File

@ -152,7 +152,7 @@ public class SkillresetCommand implements TabExecutor {
protected void editValues(Player player, PlayerProfile profile, SkillType skill) {
if (skill == null) {
for (SkillType skillType : SkillType.values()) {
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
handleCommand(player, profile, skillType);
}