From ecf32da76098c7943df8509ae9118773603f2e43 Mon Sep 17 00:00:00 2001 From: bm01 Date: Sun, 3 Feb 2013 13:56:47 +0100 Subject: [PATCH] Fixed /Addxp on all skills not working properly It was broken because of one of the previous commits --- .../nossr50/commands/admin/AddxpCommand.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/admin/AddxpCommand.java b/src/main/java/com/gmail/nossr50/commands/admin/AddxpCommand.java index 81a0b3255..4874e9523 100644 --- a/src/main/java/com/gmail/nossr50/commands/admin/AddxpCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/admin/AddxpCommand.java @@ -45,10 +45,12 @@ public class AddxpCommand implements CommandExecutor { profile = mcMMOPlayer.getProfile(); if (skill.equals(SkillType.ALL)) { - for (SkillType skillType : SkillType.values()) { - if (!skillType.isChildSkill()) { - mcMMOPlayer.applyXpGain(skill, xp); + for (SkillType type : SkillType.values()) { + if (type.equals(SkillType.ALL) || type.isChildSkill()) { + continue; } + + mcMMOPlayer.applyXpGain(type, xp); } sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp)); @@ -105,10 +107,21 @@ public class AddxpCommand implements CommandExecutor { profile.save(); // Since this is a temporary profile, we save it here. } else { - mcMMOPlayer.applyXpGain(skill, xp); + if (skill.equals(SkillType.ALL)) { + for (SkillType type : SkillType.values()) { + if (type.equals(SkillType.ALL) || type.isChildSkill()) { + continue; + } + + mcMMOPlayer.applyXpGain(type, xp); + } + } + else { + mcMMOPlayer.applyXpGain(skill, xp); + } modifiedPlayer = mcMMOPlayer.getPlayer(); - profile = mcMMOPlayer.getProfile(); + if (modifiedPlayer.isOnline()) { if (skill.equals(SkillType.ALL)) {