Moved GetSubCommands()

This commit is contained in:
Norbi Peti 2016-10-29 22:11:33 +02:00
parent fe51c015db
commit 5b63ed08ed
4 changed files with 6 additions and 20 deletions

View file

@ -72,18 +72,4 @@ public class CommandCaller implements CommandExecutor {
}
return true;
}
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()]);
}
}

View file

@ -2,14 +2,14 @@ package buttondevteam.chat.commands.ucmds;
import org.bukkit.command.CommandSender;
import buttondevteam.chat.commands.CommandCaller;
import buttondevteam.lib.chat.TBMCChatAPI;
import buttondevteam.lib.chat.TBMCCommandBase;
public final class UCommand extends TBMCCommandBase {
@Override
public String[] GetHelpText(String alias) {
return CommandCaller.GetSubCommands(this);
return TBMCChatAPI.GetSubCommands(this);
}
@Override

View file

@ -2,14 +2,14 @@ package buttondevteam.chat.commands.ucmds.admin;
import org.bukkit.command.CommandSender;
import buttondevteam.chat.commands.CommandCaller;
import buttondevteam.chat.commands.ucmds.UCommandBase;
import buttondevteam.lib.chat.TBMCChatAPI;
public final class AdminCommand extends UCommandBase {
@Override
public String[] GetHelpText(String alias) {
return CommandCaller.GetSubCommands(this);
return TBMCChatAPI.GetSubCommands(this);
}
@Override

View file

@ -3,13 +3,13 @@ package buttondevteam.chat.commands.ucmds.announce;
import org.bukkit.command.CommandSender;
import buttondevteam.chat.commands.ucmds.UCommandBase;
import buttondevteam.chat.commands.CommandCaller;
import buttondevteam.lib.chat.TBMCChatAPI;
public class AnnounceCommand extends UCommandBase {
@Override
public String[] GetHelpText(String alias) {
return CommandCaller.GetSubCommands(this);
return TBMCChatAPI.GetSubCommands(this);
}
@Override