fix commands

This commit is contained in:
aPunch 2012-02-17 21:25:17 -06:00
parent d077fcd907
commit 369e2c798e
2 changed files with 3 additions and 4 deletions

View File

@ -94,7 +94,7 @@ public class CommandManager {
// Attempt to execute a command. // Attempt to execute a command.
public void executeMethod(Method parent, String[] args, Player player, Object[] methodArgs) throws CommandException { public void executeMethod(Method parent, String[] args, Player player, Object[] methodArgs) throws CommandException {
String cmdName = args[0]; String cmdName = args[0];
String modifier = args.length >= 1 ? args[1] : ""; String modifier = args.length > 1 ? args[1] : "";
Method method = commands.get(cmdName.toLowerCase() + " " + modifier.toLowerCase()); Method method = commands.get(cmdName.toLowerCase() + " " + modifier.toLowerCase());
if (method == null) if (method == null)
@ -157,9 +157,8 @@ public class CommandManager {
Set<String> cmds = new HashSet<String>(); Set<String> cmds = new HashSet<String>();
for (String cmd : commands.keySet()) { for (String cmd : commands.keySet()) {
String[] split = cmd.split(" "); String[] split = cmd.split(" ");
if (split[0].equalsIgnoreCase(command)) { if (split[0].equalsIgnoreCase(command) && split.length > 1)
cmds.add(split[1]); cmds.add(split[1]);
}
} }
return cmds.toArray(new String[cmds.size()]); return cmds.toArray(new String[cmds.size()]);

View File

@ -41,7 +41,7 @@ public class NPCCommands {
public void showInfo(CommandContext args, Player player, NPC npc) { public void showInfo(CommandContext args, Player player, NPC npc) {
Messaging.send(player, StringHelper.wrapHeader(npc.getName())); Messaging.send(player, StringHelper.wrapHeader(npc.getName()));
Messaging.send(player, " <a>ID: <e>" + npc.getId()); Messaging.send(player, " <a>ID: <e>" + npc.getId());
Messaging.send(player, " <a>Character: <e>" + npc.getId()); Messaging.send(player, " <a>Character: <e>" + npc.getCharacter().getName());
} }
@Command( @Command(