From 78561fa4678ea6e7cf21ab8baa2ee8a16f3a5040 Mon Sep 17 00:00:00 2001 From: mohammed jasem alaajel Date: Mon, 15 Apr 2024 05:36:52 +0400 Subject: [PATCH] improve rb ocmmand --- .../commands/CommandRedisBungee.java | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/RedisBungee-Commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/CommandRedisBungee.java b/RedisBungee-Commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/CommandRedisBungee.java index 65aabe9..4684970 100644 --- a/RedisBungee-Commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/CommandRedisBungee.java +++ b/RedisBungee-Commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/CommandRedisBungee.java @@ -41,12 +41,12 @@ public class CommandRedisBungee extends AdventureBaseCommand { public void info(CommandIssuer issuer) { final String message = """ This proxy is running RedisBungee Limework's fork - ======================================== + ======================================== RedisBungee version: Build date: Commit: - ======================================== - run /rb help for more commands"""; + ======================================== + run /rb help for more commands"""; sendMessage( issuer, MiniMessage.miniMessage() @@ -65,14 +65,14 @@ public class CommandRedisBungee extends AdventureBaseCommand { @HelpCommand public void help(CommandIssuer issuer) { final String message = """ - ======================================== + ======================================== /rb info: shows info of this version. /rb help: shows this page. /rb clean: cleans up the uuid cache WARNING... command above could cause performance issues /rb show: shows list of proxies with player count - ======================================== - run /rb help for more commands"""; + ======================================== + run /rb help for more commands"""; sendMessage(issuer, MiniMessage.miniMessage().deserialize(message)); } @Subcommand("clean") @@ -92,12 +92,23 @@ public class CommandRedisBungee extends AdventureBaseCommand { @Subcommand("show") public void showProxies(CommandIssuer issuer) { final String message = """ - ======================================== - ========================================"""; + ======================================== + ========================================"""; + + final String proxyPlayersMessage = " : online"; + + TextComponent.Builder builder = Component.text(); plugin.proxyDataManager().eachProxyCount().forEach((proxy, players) - -> builder.append(Component.text(proxy + ": " + players)).appendNewline()); + -> builder.append( + MiniMessage.miniMessage() + .deserialize(proxyPlayersMessage, + Placeholder.component("here", Component.text(plugin.proxyDataManager().proxyId().equals(proxy) ? " (#) " : "")), + Placeholder.component("proxy", Component.text(proxy)), + Placeholder.component("players", Component.text(players)) + ) + .appendNewline())); sendMessage(issuer, MiniMessage.miniMessage().deserialize(message, Placeholder.component("data", builder)));