Skip to content

Commit

Permalink
Fixed bug where trying to use /mctop or /xplock with the Smelting child
Browse files Browse the repository at this point in the history
skill caused NPEs.

Fixes #748
  • Loading branch information
gmcferrin committed Mar 1, 2013
1 parent 7814fa8 commit a87336b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changelog.txt
Expand Up @@ -8,6 +8,7 @@ Key:
- Removal

Version 1.4.01-dev
= Fixed bug where trying to use /mctop or /xplock with the Smelting child skill caused NPEs

Version 1.4.00
+ Added new Child Skill - Smelting!
Expand Down
18 changes: 16 additions & 2 deletions src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java
Expand Up @@ -31,7 +31,14 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
display(Integer.parseInt(args[0]), "ALL", sender, useMySQL, command);
}
else if (SkillUtils.isSkill(args[0])) {
display(1, SkillType.getSkill(args[0]).toString(), sender, useMySQL, command);
SkillType skill = SkillType.getSkill(args[0]);

if (skill.isChildSkill()) {
sender.sendMessage("Child skills are not yet supported by this command."); // TODO: Localize this
return true;
}

display(1, skill.toString(), sender, useMySQL, command);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
Expand All @@ -45,7 +52,14 @@ else if (SkillUtils.isSkill(args[0])) {
}

if (SkillUtils.isSkill(args[0])) {
display(Integer.parseInt(args[1]), SkillType.getSkill(args[0]).toString(), sender, useMySQL, command);
SkillType skill = SkillType.getSkill(args[0]);

if (skill.isChildSkill()) {
sender.sendMessage("Child skills are not yet supported by this command."); // TODO: Localize this
return true;
}

display(Integer.parseInt(args[1]), skill.toString(), sender, useMySQL, command);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
Expand Down
Expand Up @@ -39,6 +39,11 @@ protected boolean oneArgument(Command command, CommandSender sender, String[] ar

SkillType skill = SkillType.getSkill(args[0]);

if (skill.isChildSkill()) {
sender.sendMessage("Child skills are not yet supported by this command."); // TODO: Localize this
return true;
}

if (!Permissions.xplock(sender, skill)) {
sender.sendMessage(command.getPermissionMessage());
return true;
Expand Down

0 comments on commit a87336b

Please sign in to comment.