Moved GetSubCommands
This commit is contained in:
parent
981b2e70db
commit
2ebadbe5d4
1 changed files with 15 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
package buttondevteam.lib.chat;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -20,6 +21,20 @@ public class TBMCChatAPI {
|
|||
return commands;
|
||||
}
|
||||
|
||||
public static String[] GetSubCommands(TBMCCommandBase command) {
|
||||
ArrayList<String> cmds = new ArrayList<String>();
|
||||
cmds.add("§6---- Subcommands ----");
|
||||
for (TBMCCommandBase cmd : TBMCChatAPI.GetCommands().values()) {
|
||||
if (cmd.GetCommandPath().startsWith(command.GetCommandPath() + "/")) {
|
||||
int ind = cmd.GetCommandPath().indexOf('/', command.GetCommandPath().length() + 2);
|
||||
if (ind >= 0)
|
||||
continue;
|
||||
cmds.add(cmd.GetCommandPath().replace('/', ' '));
|
||||
}
|
||||
}
|
||||
return cmds.toArray(new String[cmds.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This method adds a plugin's commands to help and sets their executor.
|
||||
|
|
Loading…
Reference in a new issue