alias to command suggestions

This commit is contained in:
Chayapak 2023-10-01 17:36:31 +07:00
parent 8357525eaa
commit 11982fb396

View file

@ -34,11 +34,18 @@ public class CommandSuggestionPlugin extends ChatPlugin.Listener {
output.add(Component.text(id)); output.add(Component.text(id));
for (Command command : CommandHandlerPlugin.commands) { for (Command command : CommandHandlerPlugin.commands) {
output.add( final boolean hasAliases = command.aliases.length != 0;
Component
Component outputComponent = Component
.text(command.name) .text(command.name)
.append(Component.text(command.trustLevel.name())) .append(Component.text(command.trustLevel.name()))
); .append(Component.text(hasAliases));
if (hasAliases) {
for (String alias : command.aliases) outputComponent = outputComponent.append(Component.text(alias));
}
output.add(outputComponent);
} }
bot.chat.tellraw(Component.join(JoinConfiguration.noSeparators(), output), player); bot.chat.tellraw(Component.join(JoinConfiguration.noSeparators(), output), player);