Check if a user has permission to see tab complete suggestions
This commit is contained in:
parent
0c8a4a97d3
commit
79501c619a
|
|
@ -64,7 +64,9 @@ public class PartyCommand implements SimpleCommand {
|
|||
String[] args = invocation.arguments();
|
||||
List<String> suggest = new ArrayList<>();
|
||||
|
||||
if (args.length == 0) {
|
||||
if (!invocation.source().hasPermission("party.use"))
|
||||
return suggest;
|
||||
else if (args.length == 0) {
|
||||
subCommands.stream()
|
||||
.filter(subCommand -> invocation.source().hasPermission(subCommand.getPermission()))
|
||||
.forEach(subCommand -> suggest.add(subCommand.getName()));
|
||||
|
|
@ -105,7 +107,8 @@ public class PartyCommand implements SimpleCommand {
|
|||
subCommands.stream()
|
||||
.filter(subCommand -> source.hasPermission(subCommand.getPermission()))
|
||||
.forEach(subCommand -> stringBuilder.append(subCommand.getHelpMessage()).append("\n"));
|
||||
stringBuilder.append(Config.PARTY_HELP_CHAT).append("\n");
|
||||
if (source.hasPermission("command.chat.p"))
|
||||
stringBuilder.append(Config.PARTY_HELP_CHAT).append("\n");
|
||||
if (stringBuilder.length() != 0)
|
||||
stringBuilder.replace(stringBuilder.length() - 1, stringBuilder.length(), "");
|
||||
|
||||
|
|
@ -113,8 +116,4 @@ public class PartyCommand implements SimpleCommand {
|
|||
Template.template("commands", Utility.parseMiniMessage(stringBuilder.toString()))
|
||||
));
|
||||
}
|
||||
|
||||
public List<SubCommand> getSubCommands() {
|
||||
return subCommands;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user