summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2011-08-11 06:56:33 +0100
committerKHobbits <rob@khobbits.co.uk>2011-08-11 06:56:33 +0100
commitb851cd10f25c357651fc3fbe42aee939b7bb82ab (patch)
tree36e7ee1f3277753148f3eaba86dab708eab05bd7
parent576b48c08c4f475bb9a439f3f5d591046751ed56 (diff)
downloadEssentials-b851cd10f25c357651fc3fbe42aee939b7bb82ab.tar
Essentials-b851cd10f25c357651fc3fbe42aee939b7bb82ab.tar.gz
Essentials-b851cd10f25c357651fc3fbe42aee939b7bb82ab.tar.lz
Essentials-b851cd10f25c357651fc3fbe42aee939b7bb82ab.tar.xz
Essentials-b851cd10f25c357651fc3fbe42aee939b7bb82ab.zip
Fix help for plugins which miss command descriptions.
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandhelp.java73
1 files changed, 40 insertions, 33 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java
index d73a2706b..53ed22a23 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java
@@ -117,56 +117,63 @@ public class Commandhelp extends EssentialsCommand
{
final PluginDescriptionFile desc = p.getDescription();
final HashMap<String, HashMap<String, String>> cmds = (HashMap<String, HashMap<String, String>>)desc.getCommands();
+ pluginName = p.getDescription().getName().toLowerCase();
for (Entry<String, HashMap<String, String>> k : cmds.entrySet())
{
- if ((!match.equalsIgnoreCase("")) && (!k.getKey().toLowerCase().contains(match))
- && (!k.getValue().get("description").toLowerCase().contains(match))
- && (!p.getDescription().getName().contains(match)))
+ try
{
- continue;
- }
+ if ((!match.equalsIgnoreCase(""))
+ && (!k.getKey().toLowerCase().contains(match))
+ && (!k.getValue().get("description").toLowerCase().contains(match))
+ && (!pluginName.contains(match)))
+ {
+ continue;
+ }
- if (p.getDescription().getName().toLowerCase().contains("essentials"))
- {
- final String node = "essentials." + k.getKey();
- if (!ess.getSettings().isCommandDisabled(k.getKey()) && user.isAuthorized(node))
+ if (pluginName.contains("essentials"))
{
- retval.add("§c" + k.getKey() + "§7: " + k.getValue().get("description"));
+ final String node = "essentials." + k.getKey();
+ if (!ess.getSettings().isCommandDisabled(k.getKey()) && user.isAuthorized(node))
+ {
+ retval.add("§c" + k.getKey() + "§7: " + k.getValue().get("description"));
+ }
}
- }
- else
- {
- if (ess.getSettings().showNonEssCommandsInHelp())
+ else
{
- pluginName = p.getDescription().getName();
- final HashMap<String, String> value = k.getValue();
- if (value.containsKey("permission") && value.get("permission") != null && !(value.get("permission").equals("")))
+ if (ess.getSettings().showNonEssCommandsInHelp())
{
- if (user.isAuthorized(value.get("permission")))
+ final HashMap<String, String> value = k.getValue();
+ if (value.containsKey("permission") && value.get("permission") != null && !(value.get("permission").equals("")))
{
- retval.add("§c" + k.getKey() + "§7: " + value.get("description"));
+ if (user.isAuthorized(value.get("permission")))
+ {
+ retval.add("§c" + k.getKey() + "§7: " + value.get("description"));
+ }
}
- }
- else if (value.containsKey("permissions") && value.get("permissions") != null && !(value.get("permissions").equals("")))
- {
- if (user.isAuthorized(value.get("permissions")))
+ else if (value.containsKey("permissions") && value.get("permissions") != null && !(value.get("permissions").equals("")))
{
- retval.add("§c" + k.getKey() + "§7: " + value.get("description"));
+ if (user.isAuthorized(value.get("permissions")))
+ {
+ retval.add("§c" + k.getKey() + "§7: " + value.get("description"));
+ }
}
- }
- else if (user.isAuthorized("essentials.help." + pluginName))
- {
- retval.add("§c" + k.getKey() + "§7: " + value.get("description"));
- }
- else
- {
- if (!ess.getSettings().hidePermissionlessHelp())
+ else if (user.isAuthorized("essentials.help." + pluginName))
{
retval.add("§c" + k.getKey() + "§7: " + value.get("description"));
}
+ else
+ {
+ if (!ess.getSettings().hidePermissionlessHelp())
+ {
+ retval.add("§c" + k.getKey() + "§7: " + value.get("description"));
+ }
+ }
}
}
-
+ }
+ catch (NullPointerException ex)
+ {
+ continue;
}
}
}