mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-23 02:55:39 +01:00
Updating help command
This commit is contained in:
parent
442c129e1b
commit
02ddd1ebf6
@ -61,7 +61,7 @@ public class CommandWithSubCommands implements CommandTemplate {
|
|||||||
if(this.subCommandRegistry.isArgRegistered(subCommand)) {
|
if(this.subCommandRegistry.isArgRegistered(subCommand)) {
|
||||||
sender.sendMessage(Lang.translateInsertVariablesColor("command.help.subcommandheader",
|
sender.sendMessage(Lang.translateInsertVariablesColor("command.help.subcommandheader",
|
||||||
commandExecuted.substring(0,1).toUpperCase() + commandExecuted.substring(1).toLowerCase(), subCommand));
|
commandExecuted.substring(0,1).toUpperCase() + commandExecuted.substring(1).toLowerCase(), subCommand));
|
||||||
sender.sendMessage("\u00A7e" + this.getSubCommand(subCommand).getDetailedHelpText());
|
sender.sendMessage("\u00A77" + this.getSubCommand(subCommand).getDetailedHelpText());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translateInsertVariablesColor("command.help.invalidhelp", args[1]));
|
sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translateInsertVariablesColor("command.help.invalidhelp", args[1]));
|
||||||
@ -109,18 +109,25 @@ public class CommandWithSubCommands implements CommandTemplate {
|
|||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSenderContainer sender, String[] args) {
|
public List<String> onTabComplete(CommandSenderContainer sender, String[] args) {
|
||||||
if(args.length > 1) {
|
if(args.length > 1) {
|
||||||
|
if(args[0].equalsIgnoreCase("help")) {
|
||||||
|
List<String> allowedCommands = new ArrayList<>();
|
||||||
|
allowedCommands.addAll(this.subCommandRegistry.getSubCommands());
|
||||||
|
Collections.sort(allowedCommands);
|
||||||
|
return allowedCommands;
|
||||||
|
}
|
||||||
|
else {
|
||||||
for (String subCommandName : this.subCommandRegistry.getSubCommands()) {
|
for (String subCommandName : this.subCommandRegistry.getSubCommands()) {
|
||||||
if (subCommandName.equalsIgnoreCase(args[0])) {
|
if (subCommandName.equalsIgnoreCase(args[0])) {
|
||||||
SubCommand subCommand = this.getSubCommand(subCommandName);
|
SubCommand subCommand = this.getSubCommand(subCommandName);
|
||||||
if(subCommand.hasPermission(sender)) {
|
if (subCommand.hasPermission(sender)) {
|
||||||
this.getSubCommand(subCommandName).onTabComplete(sender, args);
|
this.getSubCommand(subCommandName).onTabComplete(sender, args);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
List<String> allowedCommands = new ArrayList<>();
|
List<String> allowedCommands = new ArrayList<>();
|
||||||
for (String subCommandName : this.subCommandRegistry.getSubCommands()) {
|
for (String subCommandName : this.subCommandRegistry.getSubCommands()) {
|
||||||
@ -131,7 +138,7 @@ public class CommandWithSubCommands implements CommandTemplate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(args.length == 0) {
|
if(args.length == 1) {
|
||||||
allowedCommands.add("help");
|
allowedCommands.add("help");
|
||||||
}
|
}
|
||||||
Collections.sort(allowedCommands);
|
Collections.sort(allowedCommands);
|
||||||
|
Loading…
Reference in New Issue
Block a user