From 11982fb39632e9e5d7f1a552c09a53a6dac2be72 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 1 Oct 2023 17:36:31 +0700 Subject: [PATCH] alias to command suggestions --- .../plugins/CommandSuggestionPlugin.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandSuggestionPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandSuggestionPlugin.java index 755358c..3aaed2a 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandSuggestionPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandSuggestionPlugin.java @@ -34,11 +34,18 @@ public class CommandSuggestionPlugin extends ChatPlugin.Listener { output.add(Component.text(id)); for (Command command : CommandHandlerPlugin.commands) { - output.add( - Component - .text(command.name) - .append(Component.text(command.trustLevel.name())) - ); + final boolean hasAliases = command.aliases.length != 0; + + Component outputComponent = Component + .text(command.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);