2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-05 12:58:02 +00:00

improve rb ocmmand

This commit is contained in:
mohammed jasem alaajel 2024-04-15 05:36:52 +04:00
parent ab441503c7
commit 78561fa467

View File

@ -41,12 +41,12 @@ public class CommandRedisBungee extends AdventureBaseCommand {
public void info(CommandIssuer issuer) { public void info(CommandIssuer issuer) {
final String message = """ final String message = """
<color:aqua>This proxy is running RedisBungee Limework's fork <color:aqua>This proxy is running RedisBungee Limework's fork
<color:yellow>======================================== <color:gold>========================================
<color:aqua>RedisBungee version: <color:green><version> <color:aqua>RedisBungee version: <color:green><version>
<color:aqua>Build date: <color:green><build-date> <color:aqua>Build date: <color:green><build-date>
<color:aqua>Commit: <color:green><commit> <color:aqua>Commit: <color:green><commit>
<color:yellow>======================================== <color:gold>========================================
<color:yellow>run /rb help for more commands"""; <color:gold>run /rb help for more commands""";
sendMessage( sendMessage(
issuer, issuer,
MiniMessage.miniMessage() MiniMessage.miniMessage()
@ -65,14 +65,14 @@ public class CommandRedisBungee extends AdventureBaseCommand {
@HelpCommand @HelpCommand
public void help(CommandIssuer issuer) { public void help(CommandIssuer issuer) {
final String message = """ final String message = """
<color:yellow>======================================== <color:gold>========================================
<color:aqua>/rb info: <color:green>shows info of this version. <color:aqua>/rb info: <color:green>shows info of this version.
<color:aqua>/rb help: <color:green>shows this page. <color:aqua>/rb help: <color:green>shows this page.
<color:aqua>/rb clean: <color:green>cleans up the uuid cache <color:aqua>/rb clean: <color:green>cleans up the uuid cache
<color:red><bold>WARNING...</bold> <color:white>command above could cause performance issues <color:red><bold>WARNING...</bold> <color:white>command above could cause performance issues
<color:aqua>/rb show: <color:green>shows list of proxies with player count <color:aqua>/rb show: <color:green>shows list of proxies with player count
<color:yellow>======================================== <color:gold>========================================
<color:yellow>run /rb help for more commands"""; <color:gold>run /rb help for more commands""";
sendMessage(issuer, MiniMessage.miniMessage().deserialize(message)); sendMessage(issuer, MiniMessage.miniMessage().deserialize(message));
} }
@Subcommand("clean") @Subcommand("clean")
@ -92,12 +92,23 @@ public class CommandRedisBungee extends AdventureBaseCommand {
@Subcommand("show") @Subcommand("show")
public void showProxies(CommandIssuer issuer) { public void showProxies(CommandIssuer issuer) {
final String message = """ final String message = """
<color:yellow>======================================== <color:gold>========================================
<data><color:yellow>========================================"""; <data><color:gold>========================================""";
final String proxyPlayersMessage = "<color:yellow><proxy><here> : <color:green><players> online";
TextComponent.Builder builder = Component.text(); TextComponent.Builder builder = Component.text();
plugin.proxyDataManager().eachProxyCount().forEach((proxy, players) 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))); sendMessage(issuer, MiniMessage.miniMessage().deserialize(message, Placeholder.component("data", builder)));