Fixed /skillreset being broken.

This commit is contained in:
GJ 2013-03-16 16:13:55 -04:00
parent 3ac5ac385d
commit 4cd4223ee0

View File

@ -14,9 +14,14 @@ import com.gmail.nossr50.util.skills.SkillUtils;
public class SkillresetCommand extends ExperienceCommand { public class SkillresetCommand extends ExperienceCommand {
private CommandSender sender; private CommandSender sender;
private Command command; private Command command;
private int argsLength;
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
this.command = command;
this.sender = sender;
argsLength = args.length;
switch (args.length) { switch (args.length) {
case 1: case 1:
if (CommandUtils.noConsoleUsage(sender)) { if (CommandUtils.noConsoleUsage(sender)) {
@ -36,9 +41,6 @@ public class SkillresetCommand extends ExperienceCommand {
player = mcMMOPlayer.getPlayer(); player = mcMMOPlayer.getPlayer();
profile = mcMMOPlayer.getProfile(); profile = mcMMOPlayer.getProfile();
this.command = command;
this.sender = sender;
editValues(); editValues();
return true; return true;
@ -62,14 +64,13 @@ public class SkillresetCommand extends ExperienceCommand {
return true; return true;
} }
this.command = command;
this.sender = sender;
editValues(); editValues();
profile.save(); // Since this is a temporary profile, we save it here. profile.save(); // Since this is a temporary profile, we save it here.
} }
else { else {
profile = mcMMOPlayer.getProfile(); profile = mcMMOPlayer.getProfile();
player = mcMMOPlayer.getPlayer();
editValues(); editValues();
} }
@ -95,7 +96,7 @@ public class SkillresetCommand extends ExperienceCommand {
@Override @Override
protected void handleCommand(SkillType skill) { protected void handleCommand(SkillType skill) {
if ((player.equals(sender) && !Permissions.skillreset(sender, skill)) || (!player.equals(sender) && !Permissions.skillresetOthers(sender, skill))) { if (argsLength == 1 && !Permissions.skillreset(sender, skill) || (argsLength == 2 && !Permissions.skillresetOthers(sender, skill))) {
sender.sendMessage(command.getPermissionMessage()); sender.sendMessage(command.getPermissionMessage());
return; return;
} }