From 16d97b7657d469d7f4e5e00fabde280148537886 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Tue, 26 Sep 2023 19:32:39 +0700 Subject: [PATCH] some bit improvement to the trusted and owner commands usages --- .../commands/BotVisibilityCommand.java | 2 +- .../chomens_bot/commands/CloopCommand.java | 2 +- .../chomens_bot/commands/ConsoleCommand.java | 4 ++-- .../chomens_bot/commands/EndCommand.java | 2 +- .../chomens_bot/commands/FilterCommand.java | 14 +++++++------- .../chomens_bot/commands/HelpCommand.java | 19 +++++++++++++------ .../chomens_bot/commands/KickCommand.java | 2 +- .../chomens_bot/commands/PCrashCommand.java | 2 +- .../commands/ServerEvalCommand.java | 2 +- .../commands/WhitelistCommand.java | 2 +- 10 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/BotVisibilityCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/BotVisibilityCommand.java index 129fe3d..14e8c7b 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/BotVisibilityCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/BotVisibilityCommand.java @@ -14,7 +14,7 @@ public class BotVisibilityCommand extends Command { super( "botvisibilty", "Changes the bot's visibility", - new String[] { " ", " ", "" }, + new String[] { "", "", "" }, new String[] { "botvis", "togglevis", "togglevisibility" }, TrustLevel.TRUSTED, false diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CloopCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CloopCommand.java index 8a761b3..e0fc694 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CloopCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CloopCommand.java @@ -19,7 +19,7 @@ public class CloopCommand extends Command { super( "cloop", "Loop commands", - new String[] { " add ", " remove ", " clear", " list" }, + new String[] { "add ", "remove ", "clear", "list" }, new String[] { "commandloop" }, TrustLevel.TRUSTED, false diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ConsoleCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ConsoleCommand.java index 567fedf..594832a 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ConsoleCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ConsoleCommand.java @@ -18,8 +18,8 @@ public class ConsoleCommand extends Command { "console", "Controls stuff about console", new String[] { - " server ", - " logtoconsole " + "server ", + "logtoconsole " }, new String[] {}, TrustLevel.OWNER, diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/EndCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/EndCommand.java index de1ec42..ffa904e 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/EndCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/EndCommand.java @@ -11,7 +11,7 @@ public class EndCommand extends Command { super( "end", "End/Reconnects the bot", - new String[] { "" }, + new String[] { "" }, new String[] { "reconnect", "restart" }, TrustLevel.TRUSTED, false diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/FilterCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/FilterCommand.java index 08e55ab..6cf8c9d 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/FilterCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/FilterCommand.java @@ -23,13 +23,13 @@ public class FilterCommand extends Command { "filter", "Filter players", new String[] { - " add ", - " -ignorecase add ", - " -regex add ", - " -ignorecase -regex add ", - " remove ", - " clear", - " list" + "add ", + "-ignorecase add ", + "-regex add ", + "-ignorecase -regex add ", + "remove ", + "clear", + "list" }, new String[] { "filterplayer", "ban", "blacklist" }, TrustLevel.OWNER, diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/HelpCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/HelpCommand.java index 44fea10..9c75193 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/HelpCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/HelpCommand.java @@ -129,12 +129,19 @@ public class HelpCommand extends Command { ); for (String usage : command.usages) { - usages.add( - Component.empty() - .append(Component.text(prefix + actualCommandName).color(ColorUtilities.getColorByString(bot.config.colorPalette.secondary))) - .append(Component.text(" ")) - .append(Component.text(usage).color(ColorUtilities.getColorByString(bot.config.colorPalette.string))) - ); + Component usageComponent = Component.empty() + .append(Component.text(prefix + actualCommandName).color(ColorUtilities.getColorByString(bot.config.colorPalette.secondary))) + .append(Component.text(" ")); + + if (command.trustLevel == TrustLevel.TRUSTED) { + usageComponent = usageComponent.append(Component.text("")); + } else if (command.trustLevel == TrustLevel.OWNER) { + usageComponent = usageComponent.append(Component.text("")); + } + + usageComponent = usageComponent.append(Component.text(usage).color(ColorUtilities.getColorByString(bot.config.colorPalette.string))); + + usages.add(usageComponent); } return Component.join(JoinConfiguration.separator(Component.newline()), usages); diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/KickCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/KickCommand.java index 834f169..5e23a1e 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/KickCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/KickCommand.java @@ -17,7 +17,7 @@ public class KickCommand extends Command { super( "kick", "Kicks a player", - new String[] { " " }, + new String[] { "" }, new String[] {}, TrustLevel.TRUSTED, false diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/PCrashCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/PCrashCommand.java index 58dc93a..e751b9b 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/PCrashCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/PCrashCommand.java @@ -15,7 +15,7 @@ public class PCrashCommand extends Command { super( "pcrash", "Crashes a player using particle", - new String[] { " " }, + new String[] { "" }, new String[] { "particlecrash" }, TrustLevel.TRUSTED, false diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ServerEvalCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ServerEvalCommand.java index 96788f5..f8af772 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ServerEvalCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ServerEvalCommand.java @@ -17,7 +17,7 @@ public class ServerEvalCommand extends Command { super( "servereval", "Evaluate codes using LuaJ", - new String[] { " " }, + new String[] { "" }, new String[] {}, TrustLevel.OWNER, false diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/WhitelistCommand.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/WhitelistCommand.java index ef0dbc4..78bdc00 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/WhitelistCommand.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/WhitelistCommand.java @@ -18,7 +18,7 @@ public class WhitelistCommand extends Command { super( "whitelist", "Manages whitelist", - new String[] { " enable", " disable", " add ", " remove ", " clear", " list" }, + new String[] { "enable", "disable", "add ", "remove ", "clear", "list" }, new String[] {}, TrustLevel.OWNER, false