Fix NPE in help command (#1032)

## Fixes
* Fixes NPE in help command by removing unnecessary side-plugin usage strings.
This commit is contained in:
Benford Whitaker 2019-12-09 22:25:56 -05:00 committed by Christopher Martin
parent 8e8f7a5130
commit e0512d3f6c
2 changed files with 2 additions and 27 deletions

View file

@ -35,9 +35,6 @@ public class HelpCommand extends PKCommand {
private final String avatar; private final String avatar;
private final String invalidTopic; private final String invalidTopic;
private final String usage; private final String usage;
private final String rpgUsage;
private final String spiritsUsage;
private final String itemsUsage;
public HelpCommand() { public HelpCommand() {
super("help", "/bending help <Page/Topic>", ConfigManager.languageConfig.get().getString("Commands.Help.Description"), new String[] { "help", "h" }); super("help", "/bending help <Page/Topic>", ConfigManager.languageConfig.get().getString("Commands.Help.Description"), new String[] { "help", "h" });
@ -54,9 +51,6 @@ public class HelpCommand extends PKCommand {
this.avatar = ConfigManager.languageConfig.get().getString("Commands.Help.Elements.Avatar"); this.avatar = ConfigManager.languageConfig.get().getString("Commands.Help.Elements.Avatar");
this.invalidTopic = ConfigManager.languageConfig.get().getString("Commands.Help.InvalidTopic"); this.invalidTopic = ConfigManager.languageConfig.get().getString("Commands.Help.InvalidTopic");
this.usage = ConfigManager.languageConfig.get().getString("Commands.Help.Usage"); this.usage = ConfigManager.languageConfig.get().getString("Commands.Help.Usage");
this.rpgUsage = ConfigManager.languageConfig.get().getString("Command.Help.RPGUsage");
this.spiritsUsage = ConfigManager.languageConfig.get().getString("Commands.Help.SpiritsUsage");
this.itemsUsage = ConfigManager.languageConfig.get().getString("Commands.Help.ItemsUsage");
} }
@Override @Override
@ -72,15 +66,7 @@ public class HelpCommand extends PKCommand {
strings.add(command.getProperUse()); strings.add(command.getProperUse());
} }
} }
if (GeneralMethods.hasItems()) {
strings.add(this.itemsUsage);
}
if (GeneralMethods.hasRPG()) {
strings.add(this.rpgUsage);
}
if (GeneralMethods.hasSpirits()) {
strings.add(this.spiritsUsage);
}
Collections.sort(strings); Collections.sort(strings);
Collections.reverse(strings); Collections.reverse(strings);
strings.add(instances.get("help").getProperUse()); strings.add(instances.get("help").getProperUse());
@ -104,15 +90,7 @@ public class HelpCommand extends PKCommand {
for (final PKCommand command : instances.values()) { for (final PKCommand command : instances.values()) {
strings.add(command.getProperUse()); strings.add(command.getProperUse());
} }
if (GeneralMethods.hasItems()) {
strings.add(this.itemsUsage);
}
if (GeneralMethods.hasRPG()) {
strings.add(this.rpgUsage);
}
if (GeneralMethods.hasSpirits()) {
strings.add(this.spiritsUsage);
}
for (final String s : this.getPage(strings, ChatColor.GOLD + "Commands: <" + this.required + "> [" + this.optional + "]", Integer.valueOf(arg), true)) { for (final String s : this.getPage(strings, ChatColor.GOLD + "Commands: <" + this.required + "> [" + this.optional + "]", Integer.valueOf(arg), true)) {
if (firstMessage) { if (firstMessage) {
GeneralMethods.sendBrandingMessage(sender, s); GeneralMethods.sendBrandingMessage(sender, s);

View file

@ -166,9 +166,6 @@ public class ConfigManager {
config.addDefault("Commands.Help.Elements.LearnMore", "Learn more at our website! "); config.addDefault("Commands.Help.Elements.LearnMore", "Learn more at our website! ");
config.addDefault("Commands.Help.InvalidTopic", "That isn't a valid help topic. Use /bending help for more information."); config.addDefault("Commands.Help.InvalidTopic", "That isn't a valid help topic. Use /bending help for more information.");
config.addDefault("Commands.Help.Usage", "Usage: "); config.addDefault("Commands.Help.Usage", "Usage: ");
config.addDefault("Commands.Help.RPGUsage", "/bending rpg [argument]");
config.addDefault("Commands.Help.ItemsUsage", "/bending items [argument]");
config.addDefault("Commands.Help.SpiritsUsage", "/bending spirits [argument]");
config.addDefault("Commands.Display.Description", "This command will show you all of the elements you have bound if you do not specify an element. If you do specify an element (Air, Water, Earth, Fire, or Chi), it will show you all of the available abilities of that element installed on the server."); config.addDefault("Commands.Display.Description", "This command will show you all of the elements you have bound if you do not specify an element. If you do specify an element (Air, Water, Earth, Fire, or Chi), it will show you all of the available abilities of that element installed on the server.");