Fixed tool with uppercase letters in name

This commit is contained in:
Robin Kupper committed 2011-10-17 11:59:37 +02:00
1 parent 7985b72aaf
commit 0875890deb
2 files changed
+3 -7

No files matched your search

+2 -6
View File
@@ -46,8 +46,6 @@ public class CommandsHandler implements CommandExecutor
@Override @Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
if (!cmd.getName().equalsIgnoreCase("lb"))
return false;
try { try {
if (args.length == 0) { if (args.length == 0) {
sender.sendMessage(ChatColor.LIGHT_PURPLE + "LogBlock v" + logblock.getDescription().getVersion() + " by DiddiZ"); sender.sendMessage(ChatColor.LIGHT_PURPLE + "LogBlock v" + logblock.getDescription().getVersion() + " by DiddiZ");
@@ -303,11 +301,9 @@ public class CommandsHandler implements CommandExecutor
} else } else
sender.sendMessage(ChatColor.RED + "Unknown command '" + args[0] + "'"); sender.sendMessage(ChatColor.RED + "Unknown command '" + args[0] + "'");
} }
} catch (final NullPointerException ex) {
sender.sendMessage(ChatColor.RED + "Error, check log");
getLogger().log(Level.WARNING, "[LogBlock] NPE in commandshandler: ", ex);
} catch (final Exception ex) { } catch (final Exception ex) {
sender.sendMessage(ChatColor.RED + ex.getMessage()); sender.sendMessage(ChatColor.RED + "Error, check log");
getLogger().log(Level.WARNING, "[LogBlock] Exception in commands handler: ", ex);
} }
return true; return true;
} }
+1 -1
View File
@@ -171,7 +171,7 @@ public class Config
toolsByType = new HashMap<Integer, Tool>(); toolsByType = new HashMap<Integer, Tool>();
for (final Tool tool : tools) { for (final Tool tool : tools) {
toolsByType.put(tool.item, tool); toolsByType.put(tool.item, tool);
toolsByName.put(tool.name, tool); toolsByName.put(tool.name.toLowerCase(), tool);
for (final String alias : tool.aliases) for (final String alias : tool.aliases)
toolsByName.put(alias, tool); toolsByName.put(alias, tool);
} }