mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2025-04-20 01:27:07 +00:00
redo the help to be dynamic
This commit is contained in:
parent
e8bacfe0f5
commit
294a8a5031
@ -11,6 +11,7 @@
|
|||||||
package com.imaginarycode.minecraft.redisbungee.commands;
|
package com.imaginarycode.minecraft.redisbungee.commands;
|
||||||
|
|
||||||
import co.aikar.commands.CommandIssuer;
|
import co.aikar.commands.CommandIssuer;
|
||||||
|
import co.aikar.commands.RegisteredCommand;
|
||||||
import co.aikar.commands.annotation.*;
|
import co.aikar.commands.annotation.*;
|
||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import com.imaginarycode.minecraft.redisbungee.Constants;
|
import com.imaginarycode.minecraft.redisbungee.Constants;
|
||||||
@ -26,12 +27,12 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
|
|||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@CommandAlias("rb|redisbungee")
|
@CommandAlias("rb|redisbungee")
|
||||||
@CommandPermission("redisbungee.command.use")
|
@CommandPermission("redisbungee.command.use")
|
||||||
|
@Description("Main command")
|
||||||
public class CommandRedisBungee extends AdventureBaseCommand {
|
public class CommandRedisBungee extends AdventureBaseCommand {
|
||||||
|
|
||||||
private final RedisBungeePlugin<?> plugin;
|
private final RedisBungeePlugin<?> plugin;
|
||||||
@ -66,19 +67,29 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||||||
}
|
}
|
||||||
// <color:aqua>......: <color:green>......
|
// <color:aqua>......: <color:green>......
|
||||||
@HelpCommand
|
@HelpCommand
|
||||||
|
@Description("shows the help page")
|
||||||
public void help(CommandIssuer issuer) {
|
public void help(CommandIssuer issuer) {
|
||||||
final String message = """
|
final String barFormat = "<color:gold>========================================";
|
||||||
<color:gold>========================================
|
final String commandFormat = "<color:aqua>/rb <sub-command>: <color:green><description>";
|
||||||
<color:aqua>/rb info: <color:green>shows info of this version.
|
|
||||||
<color:aqua>/rb help: <color:green>shows this page.
|
TextComponent.Builder message = Component.text();
|
||||||
<color:aqua>/rb clean: <color:green>cleans up the uuid cache
|
message.append(MiniMessage.miniMessage().deserialize(barFormat));
|
||||||
<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
|
getSubCommands().forEach((subCommand, registeredCommand) -> {
|
||||||
<color:gold>========================================
|
String[] split = registeredCommand.getCommand().split(" ");
|
||||||
<color:gold>run /rb help for more commands""";
|
if (split.length > 1 && subCommand.equalsIgnoreCase(split[1])) {
|
||||||
sendMessage(issuer, MiniMessage.miniMessage().deserialize(message));
|
message.appendNewline().append(MiniMessage.miniMessage().deserialize(commandFormat, Placeholder.component("sub-command", Component.text(subCommand)),
|
||||||
|
Placeholder.component("description", MiniMessage.miniMessage().deserialize(registeredCommand.getHelpText()))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
message.appendNewline().append(MiniMessage.miniMessage().deserialize(barFormat));
|
||||||
|
|
||||||
|
sendMessage(issuer, message.build());
|
||||||
}
|
}
|
||||||
@Subcommand("clean")
|
@Subcommand("clean")
|
||||||
|
@Description("cleans up the uuid cache<color:red> <bold>WARNING...</bold> <color:white>command above could cause performance issues")
|
||||||
@Private
|
@Private
|
||||||
public void cleanUp(CommandIssuer issuer) {
|
public void cleanUp(CommandIssuer issuer) {
|
||||||
if (StopperUUIDCleanupTask.isRunning) {
|
if (StopperUUIDCleanupTask.isRunning) {
|
||||||
@ -98,6 +109,7 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||||||
|
|
||||||
}
|
}
|
||||||
@Subcommand("show")
|
@Subcommand("show")
|
||||||
|
@Description("Shows proxies in this network")
|
||||||
public void showProxies(CommandIssuer issuer, String[] args) {
|
public void showProxies(CommandIssuer issuer, String[] args) {
|
||||||
final String closer = "<color:gold>========================================";
|
final String closer = "<color:gold>========================================";
|
||||||
final String pageTop = "<color:yellow>Page: <color:green><current>/<max> <color:yellow>Network ID: <color:green><network> <color:yellow>Proxies online: <color:green><proxies>";
|
final String pageTop = "<color:yellow>Page: <color:green><current>/<max> <color:yellow>Network ID: <color:green><network> <color:yellow>Proxies online: <color:green><proxies>";
|
||||||
|
Loading…
Reference in New Issue
Block a user