info command
This commit is contained in:
parent
77614ad7ce
commit
eb762c3441
1 changed files with 23 additions and 2 deletions
|
@ -11,8 +11,7 @@ import com.mojang.brigadier.tree.CommandNode;
|
||||||
import com.mojang.brigadier.context.CommandContext;
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import net.kyori.adventure.text.event.HoverEvent;
|
import net.kyori.adventure.text.event.ClickEvent;
|
||||||
import net.kyori.adventure.text.JoinConfiguration;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
@ -20,11 +19,14 @@ import java.lang.management.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class InfoCommand extends Command {
|
public class InfoCommand extends Command {
|
||||||
|
private static final String REPOSITORY_URL = "https://code.chipmunk.land/ChipmunkMC/chipmunkbot";
|
||||||
|
|
||||||
public InfoCommand () {
|
public InfoCommand () {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.node(
|
this.node(
|
||||||
literal("info")
|
literal("info")
|
||||||
|
.executes(this::sendBotInfo)
|
||||||
.then(
|
.then(
|
||||||
literal("server")
|
literal("server")
|
||||||
.executes(this::sendServerInfo)
|
.executes(this::sendServerInfo)
|
||||||
|
@ -32,6 +34,25 @@ public class InfoCommand extends Command {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int sendBotInfo (CommandContext<CommandSource> context) {
|
||||||
|
final CommandSource source = context.getSource();
|
||||||
|
|
||||||
|
final Component component = Component.empty()
|
||||||
|
.append(Component.text("ChipmunkBot", NamedTextColor.GREEN))
|
||||||
|
.append(Component.text(" - A utility bot for free-operator servers with minimal or no restrictions", NamedTextColor.GRAY))
|
||||||
|
.append(Component.newline())
|
||||||
|
.append(Component.text("Made by ", NamedTextColor.GRAY))
|
||||||
|
.append(Component.text("_ChipMC_", NamedTextColor.DARK_GREEN))
|
||||||
|
.append(Component.text(" and contributors", NamedTextColor.GRAY))
|
||||||
|
.append(Component.newline())
|
||||||
|
.append(Component.text("Repository: ", NamedTextColor.GRAY))
|
||||||
|
.append(Component.text(REPOSITORY_URL, NamedTextColor.GREEN).clickEvent(ClickEvent.openUrl(REPOSITORY_URL)));
|
||||||
|
|
||||||
|
source.sendOutput(component, false);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
public int sendServerInfo (CommandContext<CommandSource> context) {
|
public int sendServerInfo (CommandContext<CommandSource> context) {
|
||||||
final CommandSource source = context.getSource();
|
final CommandSource source = context.getSource();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue