mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-05 04:48:02 +00:00
finish up the version command etc
This commit is contained in:
parent
40c542a50a
commit
e76f0d0a00
@ -11,46 +11,58 @@
|
|||||||
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.annotation.CommandAlias;
|
import co.aikar.commands.annotation.*;
|
||||||
import co.aikar.commands.annotation.CommandPermission;
|
|
||||||
import co.aikar.commands.annotation.Default;
|
|
||||||
import com.imaginarycode.minecraft.redisbungee.Constants;
|
import com.imaginarycode.minecraft.redisbungee.Constants;
|
||||||
import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand;
|
import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.event.ClickEvent;
|
import net.kyori.adventure.text.event.ClickEvent;
|
||||||
import net.kyori.adventure.text.event.HoverEvent;
|
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.MiniMessage;
|
||||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@CommandAlias("rb|redisbungee")
|
@CommandAlias("rb|redisbungee")
|
||||||
@CommandPermission("redisbungee.use")
|
@CommandPermission("redisbungee.use")
|
||||||
public class CommandRedisBungee extends AdventureBaseCommand {
|
public class CommandRedisBungee extends AdventureBaseCommand {
|
||||||
|
|
||||||
private static final String message = """
|
|
||||||
|
@Default
|
||||||
|
@Subcommand("info|version|git")
|
||||||
|
public static void info(CommandIssuer issuer) {
|
||||||
|
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:yellow>========================================
|
||||||
<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:yellow>========================================
|
||||||
|
<color:yellow>run /rb help for more commands""";
|
||||||
@Default
|
|
||||||
public static void info(CommandIssuer issuer) {
|
|
||||||
sendMessage(
|
sendMessage(
|
||||||
issuer,
|
issuer,
|
||||||
MiniMessage.miniMessage()
|
MiniMessage.miniMessage()
|
||||||
.deserialize(
|
.deserialize(
|
||||||
message,
|
message,
|
||||||
Placeholder.component("version", Component.text(Constants.VERSION)),
|
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(
|
Placeholder.component(
|
||||||
"commit",
|
"commit",
|
||||||
Component.text(Constants.GIT_COMMIT)
|
Component.text(Constants.GIT_COMMIT.substring(0, 8))
|
||||||
.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, Constants.getGithubCommitLink()))
|
.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, Constants.getGithubCommitLink()))
|
||||||
.hoverEvent(HoverEvent.showText(Component.text("Click me to open: " + Constants.getGithubCommitLink())))
|
.hoverEvent(HoverEvent.showText(Component.text("Click me to open: " + Constants.getGithubCommitLink())))
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HelpCommand
|
||||||
|
public static void help(CommandIssuer issuer) {
|
||||||
|
final String message = """
|
||||||
|
<color:yellow>========================================
|
||||||
|
<color:aqua>/rb info: <color:green>shows version, build date, git commit hash.
|
||||||
|
<color:aqua>/rb help: shows this page.
|
||||||
|
<color:aqua>......: <color:green>......
|
||||||
|
<color:yellow>========================================
|
||||||
|
<color:yellow>run /rb help for more commands""";
|
||||||
|
sendMessage(issuer, MiniMessage.miniMessage().deserialize(message));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user