From a87336b7ee1be024f6d61c382dc01c2ddde229bc Mon Sep 17 00:00:00 2001 From: GJ Date: Fri, 1 Mar 2013 10:38:14 -0500 Subject: [PATCH] Fixed bug where trying to use /mctop or /xplock with the Smelting child skill caused NPEs. Fixes #748 --- Changelog.txt | 1 + .../nossr50/commands/player/MctopCommand.java | 18 ++++++++++++++++-- .../nossr50/commands/spout/XplockCommand.java | 5 +++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 9d11da52f..426b2bae9 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -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! diff --git a/src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java b/src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java index 4d23bd9a2..d0fcea9e5 100644 --- a/src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java @@ -31,7 +31,14 @@ public class MctopCommand implements CommandExecutor { 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")); @@ -45,7 +52,14 @@ public class MctopCommand implements CommandExecutor { } 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")); diff --git a/src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java b/src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java index a69ea0cec..a6317d0ca 100644 --- a/src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/spout/XplockCommand.java @@ -39,6 +39,11 @@ public class XplockCommand extends SpoutCommand { 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;