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 ce253ab..315fa3c 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 @@ -11,46 +11,58 @@ package com.imaginarycode.minecraft.redisbungee.commands; import co.aikar.commands.CommandIssuer; -import co.aikar.commands.annotation.CommandAlias; -import co.aikar.commands.annotation.CommandPermission; -import co.aikar.commands.annotation.Default; +import co.aikar.commands.annotation.*; import com.imaginarycode.minecraft.redisbungee.Constants; import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.HoverEvent; -import net.kyori.adventure.text.event.HoverEventSource; import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; +import java.util.Date; + @CommandAlias("rb|redisbungee") @CommandPermission("redisbungee.use") public class CommandRedisBungee extends AdventureBaseCommand { - private static final String message = """ + + @Default + @Subcommand("info|version|git") + public static void info(CommandIssuer issuer) { + final String message = """ This proxy is running RedisBungee Limework's fork ======================================== RedisBungee version: Build date: Commit: - ========================================"""; - - @Default - public static void info(CommandIssuer issuer) { + ======================================== + run /rb help for more commands"""; sendMessage( issuer, MiniMessage.miniMessage() .deserialize( message, Placeholder.component("version", Component.text(Constants.VERSION)), - Placeholder.component("build-date", Component.text(Constants.BUILD_DATE)), + Placeholder.component("build-date", Component.text( new Date(Constants.BUILD_DATE * 1000).toString() )), Placeholder.component( "commit", - Component.text(Constants.GIT_COMMIT) + Component.text(Constants.GIT_COMMIT.substring(0, 8)) .clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, Constants.getGithubCommitLink())) .hoverEvent(HoverEvent.showText(Component.text("Click me to open: " + Constants.getGithubCommitLink()))) ))); } + @HelpCommand + public static void help(CommandIssuer issuer) { + final String message = """ + ======================================== + /rb info: shows version, build date, git commit hash. + /rb help: shows this page. + ......: ...... + ======================================== + run /rb help for more commands"""; + sendMessage(issuer, MiniMessage.miniMessage().deserialize(message)); + } }