Tell the user how many options they ignored.

This commit is contained in:
libraryaddict 2014-06-15 14:52:45 +12:00
parent ce725368f0
commit 264b2ef8a2

View File

@ -158,6 +158,7 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
ArrayList<String> methods = new ArrayList<String>(); ArrayList<String> methods = new ArrayList<String>();
HashMap<String, ChatColor> map = new HashMap<String, ChatColor>(); HashMap<String, ChatColor> map = new HashMap<String, ChatColor>();
Class watcher = type.getWatcherClass(); Class watcher = type.getWatcherClass();
int ignored = 0;
try { try {
for (Method method : watcher.getMethods()) { for (Method method : watcher.getMethods()) {
if (!method.getName().startsWith("get") && method.getParameterTypes().length == 1 if (!method.getName().startsWith("get") && method.getParameterTypes().length == 1
@ -176,6 +177,7 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
} }
} }
if (!allowed) { if (!allowed) {
ignored++;
continue; continue;
} }
} }
@ -233,6 +235,10 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
} }
sender.sendMessage(ChatColor.DARK_RED + type.toReadable() + " options: " sender.sendMessage(ChatColor.DARK_RED + type.toReadable() + " options: "
+ StringUtils.join(methods, ChatColor.DARK_RED + ", ")); + StringUtils.join(methods, ChatColor.DARK_RED + ", "));
if (ignored > 0) {
sender.sendMessage(ChatColor.RED + "Ignored " + ignored
+ " options you do not have permission to view. Add 'show' to view unusable options.");
}
return true; return true;
} }
} }