Fixed subcommands

This commit is contained in:
Norbi Peti 2016-12-30 23:38:47 +01:00
parent ed4cb11b87
commit 7f45f08b32

View file

@ -61,17 +61,17 @@ public class TBMCChatAPI {
};
for (TBMCCommandBase cmd : TBMCChatAPI.GetCommands().values()) {
if (cmd.GetCommandPath().startsWith(command + " ")) {
if (cmd.GetPlayerOnly() && !(sender instanceof Player))
continue;
if (cmd.GetModOnly() && !MainPlugin.permission.has(sender, "tbmc.admin"))
continue;
int ind = cmd.GetCommandPath().indexOf(' ', command.length() + 2);
if (ind >= 0) {
String newcmd = cmd.GetCommandPath().substring(0, ind);
if (!cmds.contains("/" + newcmd))
addToCmds.accept("/" + newcmd);
}
if (cmd.GetPlayerOnly() && !(sender instanceof Player))
continue;
if (cmd.GetModOnly() && !MainPlugin.permission.has(sender, "tbmc.admin"))
continue;
addToCmds.accept("/" + cmd.GetCommandPath());
} else
addToCmds.accept("/" + cmd.GetCommandPath());
}
}
return cmds.toArray(new String[cmds.size()]);