FINALLY revamped the commandhandler (but it still isn't fully complete, eventually I want there to be a hierarchy system where you can specify "parents" to comamnds for a sub-command system)

This commit is contained in:
batchprogrammer314
2021-09-02 15:46:00 -05:00
parent e7d8bf1b55
commit fadcc88946
14 changed files with 269 additions and 187 deletions

View File

@@ -86,7 +86,7 @@ public class CommandHandler {
}
String methodName = cmd.name();
CommandMethod commandMethod = new CommandMethod(methodName, Sets.newHashSet(cmd.aliases()), cmd.desc(), cmd.usage(), perm, command, method, autofiller);
CommandMethod commandMethod = new CommandMethod(methodName, Sets.newHashSet(cmd.aliases()), cmd.desc(), perm, command, method, autofiller);
command.addMethod(methodName, commandMethod);
}
@@ -112,16 +112,6 @@ public class CommandHandler {
help.put(commandInstance.getName(), getCommandInfo(commandInstance));
}
/*
* TODO
* Eventually, this will be a LOT better, basically not having to have this method
* at all (kind of like Drink), and even better, we won't even need a "usage" field
* in the @Command annotation, and can create the usage message from the method parameters.
*/
public void sendUsage(CommandSender sender, CommandInstance command, String usage) {
sender.sendMessage("Command Usage: " + ChatColor.YELLOW + "/" + command.getName() + " " + usage);
}
private List<String> getCommandInfo(CommandInstance commandInstance) {
List<String> output = new ArrayList<>();