Fixed bug where trying to use /mctop or /xplock with the Smelting child

skill caused NPEs.

Fixes #748
This commit is contained in:
GJ 2013-03-01 10:38:14 -05:00
parent 7814fa8d46
commit a87336b7ee
3 changed files with 22 additions and 2 deletions

View File

@ -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!

View File

@ -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"));

View File

@ -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;