Added loops for the subcommands and more to the todo

This commit is contained in:
sekwah 2018-01-22 05:12:53 +00:00
parent 970db237de
commit 310740879e
2 changed files with 16 additions and 2 deletions

View File

@ -6,6 +6,8 @@ Tag registration system (Mostly done, just needs to be tested and implemented)
Portal loading system
Portal trigger system
Configs for language files to allow all messages to change
Destination Command

View File

@ -37,10 +37,15 @@ public class CommandWithSubCommands implements CommandTemplate {
public void onCommand(CommandSenderContainer sender, String commandExecuted, String[] args) {
if(args.length > 0) {
if(args[0].equalsIgnoreCase("help")) {
// TODO do help menu here sorted alphabetically
// TODO start making a help menu
}
else {
for(String subCommand : this.subCommandRegistry.getSubCommands()) {
if(subCommand.equalsIgnoreCase(args[0])) {
this.getSubCommand(subCommand).onCommand(sender, args);
return;
}
}
}
}
else {
@ -50,6 +55,13 @@ public class CommandWithSubCommands implements CommandTemplate {
@Override
public List<String> onTabComplete(CommandSenderContainer sender, String[] args) {
if(args.length > 0) {
for (String subCommand : this.subCommandRegistry.getSubCommands()) {
if (subCommand.equalsIgnoreCase(args[0])) {
return this.getSubCommand(subCommand).onTabComplete(sender, args);
}
}
}
return null;
}
}