Permalink
Browse files

Fixed aliases for /help

  • Loading branch information...
1 parent ba33a22 commit d1b3f9ff38ae294cd3c4d85b02123c16a9240bef @GuntherDW committed Mar 26, 2012
@@ -0,0 +1,3 @@
+<component name="ProjectDictionaryState">
+ <dictionary name="guntherdw" />
+</component>
@@ -32,9 +32,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import java.util.logging.Logger;
/**
@@ -45,6 +43,7 @@
private Map<String, iCommand> commandMap = new HashMap<String, iCommand>();
private Map<String, Method> newCommandMap = new HashMap<String, Method>();
private Map<String, Method> aliasCommandMap = new HashMap<String, Method>();
+ private Map<String, List<String>> commandAliases = new HashMap<String, List<String>>();
private Map<Method, Object> instanceMap = new HashMap<Method, Object>();
/** Command Classes **/
@@ -107,18 +106,30 @@ public void injectCommand(Method method, Object instance) {
logger.warning("[TweakcraftUtils] Command : " + aliases[0] + "!");
return;
}
+ List<String> al = new ArrayList<String>();
for (int x = 0; x < aliases.length; x++) {
if (x == 0)
newCommandMap.put(aliases[x], method);
- else
+ else {
+ al.add(aliases[x]);
aliasCommandMap.put(aliases[x], method);
+ }
}
+ // if(al.size()>0)
+ commandAliases.put(aliases[0], al);
instanceMap.put(method, instance);
}
}
+ public List<String> getAliases(String command) {
+ // if(newCommandMap.containsKey(command))
+ return commandAliases.get(command);
+ // else
+ // return new ArrayList<String>();
+ }
+
@SuppressWarnings("unchecked")
public void checkCommands() {
if (plugin.getConfigHandler().enableDebug) { /* Show commands with no command attached */
@@ -282,7 +282,7 @@ public boolean help(CommandSender sender, String command, String[] args)
toadd = ChatColor.GOLD + entry.getKey() + ChatColor.WHITE +
" : " + ChatColor.YELLOW + annotation.description();
if (aliases) {
- List<String> aliaseslist = plugin.getCommand(entry.getKey()).getAliases();
+ List<String> aliaseslist = commh.getAliases(entry.getKey());
if (aliaseslist.size() > 0) {
toadd += ChatColor.WHITE + " (";
for (String alias : aliaseslist) {
@@ -1115,7 +1115,7 @@ public boolean spawnMob(CommandSender sender, String command, String[] realargs)
if(lent instanceof Tameable) {
if (tame) {
((Tameable) lent).setOwner(victimplayer);
- ((Tameable) lent).setTamed(true);
+ // ((Tameable) lent).setTamed(true);
}
}
@@ -604,7 +604,7 @@ public void onPlayerQuit(PlayerQuitEvent event) {
// if (plugin.hasNick(name)) {
// event.setQuitMessage(ChatColor.YELLOW + player.getDisplayName() + ChatColor.YELLOW + " left the game.");
- event.setQuitMessage(ChatColor.DARK_GRAY + " - " + player.getDisplayName() + ChatColor.DARK_GRAY + " / left the game.");
+ event.setQuitMessage(ChatColor.RED + " - " + player.getDisplayName() + ChatColor.DARK_GRAY + " / left the game.");
// }
if (lp.isInvisible()) { // Invisible players do not send out a "left" message

0 comments on commit d1b3f9f

Please sign in to comment.