make Command a class instead of an interface
this is attempt 2 and it works now
This commit is contained in:
parent
e276976594
commit
744381ca06
40 changed files with 451 additions and 991 deletions
|
@ -1,15 +1,28 @@
|
||||||
package land.chipmunk.chayapak.chomens_bot.command;
|
package land.chipmunk.chayapak.chomens_bot.command;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
|
||||||
import java.util.List;
|
public abstract class Command {
|
||||||
|
@Getter private final String name;
|
||||||
|
@Getter private final String description;
|
||||||
|
@Getter private final String[] usages;
|
||||||
|
@Getter private final String[] aliases;
|
||||||
|
@Getter private final TrustLevel trustLevel;
|
||||||
|
|
||||||
public interface Command {
|
public Command (
|
||||||
String name();
|
String name,
|
||||||
String description();
|
String description,
|
||||||
List<String> usage();
|
String[] usages,
|
||||||
List<String> alias();
|
String[] aliases,
|
||||||
TrustLevel trustLevel();
|
TrustLevel trustLevel
|
||||||
|
) {
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
this.usages = usages;
|
||||||
|
this.aliases = aliases;
|
||||||
|
this.trustLevel = trustLevel;
|
||||||
|
}
|
||||||
|
|
||||||
Component execute(CommandContext context, String[] args, String[] fullArgs) throws Exception;
|
public abstract Component execute (CommandContext context, String[] args, String[] fullArgs) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,34 +10,18 @@ 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.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class BotUserCommand extends Command {
|
||||||
import java.util.List;
|
public BotUserCommand () {
|
||||||
|
super(
|
||||||
public class BotUserCommand implements Command {
|
"botuser",
|
||||||
public String name() { return "botuser"; }
|
"Shows the bot's username and UUID",
|
||||||
|
new String[] {},
|
||||||
public String description() {
|
new String[] {},
|
||||||
return "Shows the bot's username and UUID";
|
TrustLevel.PUBLIC
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -8,38 +8,18 @@ import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities;
|
||||||
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 java.util.ArrayList;
|
public class BotVisibilityCommand extends Command {
|
||||||
import java.util.List;
|
public BotVisibilityCommand () {
|
||||||
|
super(
|
||||||
public class BotVisibilityCommand implements Command {
|
"botvisibilty",
|
||||||
public String name() { return "botvisibility"; }
|
"Changes the bot's visibility",
|
||||||
|
new String[] { "<hash> <true|false>", "<hash> <on|off>", "<hash>" },
|
||||||
public String description() {
|
new String[] { "botvis", "togglevis", "togglevisibility" },
|
||||||
return "Changes the bot's visibility";
|
TrustLevel.TRUSTED
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("<hash> <true|false>");
|
|
||||||
usages.add("<hash> <on|off>");
|
|
||||||
usages.add("<hash>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("botvis");
|
|
||||||
aliases.add("togglevis");
|
|
||||||
aliases.add("togglevisibility");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.TRUSTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -9,31 +9,18 @@ import net.kyori.adventure.text.Component;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BruhifyCommand implements Command {
|
public class BruhifyCommand extends Command {
|
||||||
public String name() { return "bruhify"; }
|
public BruhifyCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"bruhify",
|
||||||
return "RecycleBot bruhify but actionbar";
|
"RecycleBots bruhify but actionbar",
|
||||||
}
|
new String[] { "[{message}]" },
|
||||||
|
new String[] {},
|
||||||
public List<String> usage() {
|
TrustLevel.PUBLIC
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("[{message}]");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -12,31 +12,18 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class ClearChatCommand implements Command {
|
public class ClearChatCommand extends Command {
|
||||||
public String name() { return "clearchat"; }
|
public ClearChatCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"clearchat",
|
||||||
return "Clears the chat";
|
"Clears the chat",
|
||||||
}
|
new String[] { "[player]" },
|
||||||
|
new String[] { "cc" },
|
||||||
public List<String> usage() {
|
TrustLevel.PUBLIC
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("[player]");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("cc");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,17 @@ import net.kyori.adventure.text.Component;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ClearChatQueueCommand implements Command {
|
public class ClearChatQueueCommand extends Command {
|
||||||
|
public ClearChatQueueCommand () {
|
||||||
|
super(
|
||||||
|
"clearchatqueue",
|
||||||
|
"Clears the bots chat queue",
|
||||||
|
new String[] {},
|
||||||
|
new String[] { "ccq" },
|
||||||
|
TrustLevel.PUBLIC
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public String name() { return "clearchatqueue"; }
|
public String name() { return "clearchatqueue"; }
|
||||||
|
|
||||||
public String description() {
|
public String description() {
|
||||||
|
@ -34,6 +44,7 @@ public class ClearChatQueueCommand implements Command {
|
||||||
return TrustLevel.PUBLIC;
|
return TrustLevel.PUBLIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -14,34 +14,18 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CloopCommand implements Command {
|
public class CloopCommand extends Command {
|
||||||
public String name() { return "cloop"; }
|
public CloopCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"cloop",
|
||||||
return "Loop commands";
|
"Loop commands",
|
||||||
}
|
new String[] { "<hash> add <interval> <{command}>", "<hash> remove <index>", "<hash> clear", "<hash> list" },
|
||||||
|
new String[] { "commandloop" },
|
||||||
public List<String> usage() {
|
TrustLevel.TRUSTED
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("<hash> add <interval> <{command}>");
|
|
||||||
usages.add("<hash> remove <index>");
|
|
||||||
usages.add("<hash> clear");
|
|
||||||
usages.add("<hash> list");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("commandloop");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.TRUSTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -10,37 +10,21 @@ import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.JoinConfiguration;
|
import net.kyori.adventure.text.JoinConfiguration;
|
||||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
public class CommandBlockCommand implements Command {
|
public class CommandBlockCommand extends Command {
|
||||||
public String name() { return "cb"; }
|
public CommandBlockCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"cb",
|
||||||
return "Executes a command in the command core and return it's output";
|
"Executes a command in the command core and return its output",
|
||||||
}
|
new String[] { "<command>" },
|
||||||
|
new String[] { "cmd", "commandblock", "run" },
|
||||||
public List<String> usage() {
|
TrustLevel.PUBLIC
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("<{command}>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("cmd");
|
|
||||||
aliases.add("commandblock");
|
|
||||||
aliases.add("run");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -6,34 +6,18 @@ import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class CowsayCommand extends Command {
|
||||||
import java.util.List;
|
public CowsayCommand () {
|
||||||
|
super(
|
||||||
public class CowsayCommand implements Command {
|
"cowsay",
|
||||||
public String name() { return "cowsay"; }
|
"Moo",
|
||||||
|
new String[] { "<{message}>" },
|
||||||
public String description() {
|
new String[] {},
|
||||||
return "Moo";
|
TrustLevel.PUBLIC
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("<{message}>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final String message = String.join(" ", args);
|
final String message = String.join(" ", args);
|
||||||
|
|
||||||
|
|
|
@ -10,31 +10,18 @@ import net.kyori.adventure.text.Component;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CreatorCommand implements Command {
|
public class CreatorCommand extends Command {
|
||||||
public String name() { return "creator"; }
|
public CreatorCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"creator",
|
||||||
return "Shows the bots creator";
|
"Shows the bots creator",
|
||||||
}
|
new String[] {},
|
||||||
|
new String[] {},
|
||||||
public List<String> usage() {
|
TrustLevel.PUBLIC
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -9,34 +9,18 @@ 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.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class DiscordCommand extends Command {
|
||||||
import java.util.List;
|
public DiscordCommand () {
|
||||||
|
super(
|
||||||
public class DiscordCommand implements Command {
|
"discord",
|
||||||
public String name() { return "discord"; }
|
"Shows the Discord invite",
|
||||||
|
new String[] {},
|
||||||
public String description() {
|
new String[] {},
|
||||||
return "Shows the Discord invite";
|
TrustLevel.PUBLIC
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -6,32 +6,18 @@ import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class EchoCommand extends Command {
|
||||||
import java.util.List;
|
public EchoCommand () {
|
||||||
|
super(
|
||||||
public class EchoCommand implements Command {
|
"echo",
|
||||||
public String name() { return "echo"; }
|
"Makes the bot say a message",
|
||||||
|
new String[] { "<{message}>" },
|
||||||
public String description() {
|
new String[] { "say" },
|
||||||
return "Says a message";
|
TrustLevel.PUBLIC
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> usage() {
|
@Override
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("<{message}>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("say");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() { return TrustLevel.PUBLIC; }
|
|
||||||
|
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -6,34 +6,18 @@ import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class EndCommand extends Command {
|
||||||
import java.util.List;
|
public EndCommand () {
|
||||||
|
super(
|
||||||
public class EndCommand implements Command {
|
"end",
|
||||||
public String name() { return "end"; }
|
"End/Reconnects the bot",
|
||||||
|
new String[] { "<hash>" },
|
||||||
public String description() {
|
new String[] { "reconnect", "restart" },
|
||||||
return "End/Restarts the bot";
|
TrustLevel.TRUSTED
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("<hash>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("restart");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.TRUSTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -17,37 +17,23 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class FilterCommand implements Command {
|
public class FilterCommand extends Command {
|
||||||
public String name() { return "filter"; }
|
public FilterCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"filter",
|
||||||
return "Filter players";
|
"Filter players",
|
||||||
}
|
new String[] {
|
||||||
|
"<hash> add <{player}>",
|
||||||
public List<String> usage() {
|
"<hash> -ignorecase add <{player}>",
|
||||||
final List<String> usages = new ArrayList<>();
|
"<hash> -regex add <{player}>",
|
||||||
usages.add("<hash> add <{player}>");
|
"<hash> -ignorecase -regex add <{player}>",
|
||||||
usages.add("<hash> -ignorecase add <{player}>");
|
"<hash> remove <index>",
|
||||||
usages.add("<hash> -regex add <{player}>");
|
"<hash> clear",
|
||||||
usages.add("<hash> -ignorecase -regex add <{player}>");
|
"<hash> list"
|
||||||
usages.add("<hash> remove <index>");
|
},
|
||||||
usages.add("<hash> clear");
|
new String[] { "filterplayer", "ban", "blacklist" },
|
||||||
usages.add("<hash> list");
|
TrustLevel.TRUSTED
|
||||||
|
);
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("filterplayer");
|
|
||||||
aliases.add("ban");
|
|
||||||
aliases.add("blacklist");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.TRUSTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// most of these codes are from cloop and greplog
|
// most of these codes are from cloop and greplog
|
||||||
|
|
|
@ -8,35 +8,18 @@ import land.chipmunk.chayapak.chomens_bot.util.MazeGenerator;
|
||||||
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 java.util.ArrayList;
|
public class GenerateMazeCommand extends Command {
|
||||||
import java.util.List;
|
public GenerateMazeCommand () {
|
||||||
|
super(
|
||||||
public class GenerateMazeCommand implements Command {
|
"generatemaze",
|
||||||
public String name() { return "generatemaze"; }
|
"Generates a maze",
|
||||||
|
new String[] { "<x> <y> <z> <width> <long>" },
|
||||||
public String description() {
|
new String[] { "genmaze", "mazegen" },
|
||||||
return "Generates a maze";
|
TrustLevel.PUBLIC
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("<x> <y> <z> <width> <long>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("genmaze");
|
|
||||||
aliases.add("mazegen");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -7,40 +7,26 @@ import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
||||||
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 java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class GrepLogCommand implements Command {
|
public class GrepLogCommand extends Command {
|
||||||
public String name() { return "greplog"; }
|
public GrepLogCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"greplog",
|
||||||
return "Queries the bot's log files";
|
"Queries the bots log files",
|
||||||
}
|
new String[] {
|
||||||
|
"<{input}>",
|
||||||
public List<String> usage() {
|
"-ignorecase <{input}>",
|
||||||
final List<String> usages = new ArrayList<>();
|
"-regex <{input}>",
|
||||||
usages.add("<{input}>");
|
"-ignorecase -regex <{input}>",
|
||||||
usages.add("-ignorecase <{input}>");
|
"stop"
|
||||||
usages.add("-regex <{input}>");
|
},
|
||||||
usages.add("-ignorecase -regex <{input}>");
|
new String[] { "logquery", "greplogs" },
|
||||||
usages.add("stop");
|
TrustLevel.PUBLIC
|
||||||
|
);
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("logquery");
|
|
||||||
aliases.add("greplogs");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] _args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] _args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -11,43 +11,30 @@ import net.kyori.adventure.text.event.HoverEvent;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class HelpCommand implements Command {
|
public class HelpCommand extends Command {
|
||||||
public String name() { return "help"; }
|
public HelpCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"help",
|
||||||
return "Shows the help";
|
"Shows a command list or usage for a command",
|
||||||
}
|
new String[] { "[command]" },
|
||||||
|
new String[] { "heko", "cmds", "commands" },
|
||||||
public List<String> usage() {
|
TrustLevel.PUBLIC
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("[command]");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("heko");
|
|
||||||
aliases.add("cmds");
|
|
||||||
aliases.add("commands");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Bot bot;
|
private Bot bot;
|
||||||
|
|
||||||
private CommandContext context;
|
private CommandContext context;
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
this.bot = context.bot();
|
this.bot = context.bot();
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
return sendCommandList();
|
return sendCommandList();
|
||||||
} else {
|
} else {
|
||||||
|
@ -117,7 +104,7 @@ public class HelpCommand implements Command {
|
||||||
final String prefix = context.prefix();
|
final String prefix = context.prefix();
|
||||||
|
|
||||||
for (Command command : bot.commandHandler().commands()) {
|
for (Command command : bot.commandHandler().commands()) {
|
||||||
if (!command.name().equals(args[0]) && !command.alias().contains(args[0])) continue;
|
if (!command.name().equals(args[0]) && !Arrays.stream(command.aliases()).toList().contains(args[0])) continue;
|
||||||
|
|
||||||
final String commandName = command.name();
|
final String commandName = command.name();
|
||||||
final List<Component> usages = new ArrayList<>();
|
final List<Component> usages = new ArrayList<>();
|
||||||
|
@ -126,8 +113,8 @@ public class HelpCommand implements Command {
|
||||||
Component.empty()
|
Component.empty()
|
||||||
.append(Component.text(prefix + commandName).color(ColorUtilities.getColorByString(bot.config().colorPalette().secondary())))
|
.append(Component.text(prefix + commandName).color(ColorUtilities.getColorByString(bot.config().colorPalette().secondary())))
|
||||||
.append(Component.text(
|
.append(Component.text(
|
||||||
(command.alias().size() > 0 && !command.alias().get(0).equals("")) ?
|
(command.aliases().length > 0 && !command.aliases()[0].equals("")) ?
|
||||||
" (" + String.join(", ", command.alias()) + ")" :
|
" (" + String.join(", ", command.aliases()) + ")" :
|
||||||
""
|
""
|
||||||
))
|
))
|
||||||
.append(Component.text(" - " + command.description()).color(NamedTextColor.GRAY))
|
.append(Component.text(" - " + command.description()).color(NamedTextColor.GRAY))
|
||||||
|
@ -139,7 +126,7 @@ public class HelpCommand implements Command {
|
||||||
.append(Component.text(command.trustLevel().name()).color(NamedTextColor.YELLOW))
|
.append(Component.text(command.trustLevel().name()).color(NamedTextColor.YELLOW))
|
||||||
);
|
);
|
||||||
|
|
||||||
for (String usage : command.usage()) {
|
for (String usage : command.usages()) {
|
||||||
usages.add(
|
usages.add(
|
||||||
Component.empty()
|
Component.empty()
|
||||||
.append(Component.text(prefix + commandName).color(ColorUtilities.getColorByString(bot.config().colorPalette().secondary())))
|
.append(Component.text(prefix + commandName).color(ColorUtilities.getColorByString(bot.config().colorPalette().secondary())))
|
||||||
|
|
|
@ -1,43 +1,28 @@
|
||||||
package land.chipmunk.chayapak.chomens_bot.commands;
|
package land.chipmunk.chayapak.chomens_bot.commands;
|
||||||
|
|
||||||
import land.chipmunk.chayapak.chomens_bot.Bot;
|
import land.chipmunk.chayapak.chomens_bot.Bot;
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
|
||||||
import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry;
|
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.Command;
|
import land.chipmunk.chayapak.chomens_bot.command.Command;
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
||||||
|
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
||||||
|
import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry;
|
||||||
import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities;
|
import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities;
|
||||||
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 java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class KickCommand implements Command {
|
public class KickCommand extends Command {
|
||||||
public String name() { return "kick"; }
|
public KickCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"kick",
|
||||||
return "Kicks a player using the complex NBT exploit (from KittyCorpBot)";
|
"Kicks a player",
|
||||||
}
|
new String[] { "<hash> <{player}>" },
|
||||||
|
new String[] {},
|
||||||
public List<String> usage() {
|
TrustLevel.TRUSTED
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("<hash> <{player}>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.TRUSTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -15,31 +15,18 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ListCommand implements Command {
|
public class ListCommand extends Command {
|
||||||
public String name() { return "list"; }
|
public ListCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"list",
|
||||||
return "Lists all players in the server (including vanished)";
|
"Lists all players in the server (including vanished)",
|
||||||
}
|
new String[] {},
|
||||||
|
new String[] {},
|
||||||
public List<String> usage() {
|
TrustLevel.PUBLIC
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -30,33 +30,18 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
public class MailCommand implements Command {
|
public class MailCommand extends Command {
|
||||||
public String name() { return "mail"; }
|
public MailCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"mail",
|
||||||
return "Sends a mail";
|
"Sends a mail",
|
||||||
}
|
new String[] { "send <player> <{message}>", "sendselecteditem <player>", "read" },
|
||||||
|
new String[] {},
|
||||||
public List<String> usage() {
|
TrustLevel.PUBLIC
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("send <player> <{message}>");
|
|
||||||
usages.add("sendselecteditem <player>");
|
|
||||||
usages.add("read");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
if (args.length < 1) return Component.text("Not enough arguments").color(NamedTextColor.RED);
|
if (args.length < 1) return Component.text("Not enough arguments").color(NamedTextColor.RED);
|
||||||
|
|
||||||
|
|
|
@ -22,45 +22,34 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MusicCommand implements Command {
|
public class MusicCommand extends Command {
|
||||||
private Path root;
|
private Path root;
|
||||||
|
|
||||||
public String name() { return "music"; }
|
public MusicCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"music",
|
||||||
return "Play musics";
|
"Play musics",
|
||||||
}
|
new String[] {
|
||||||
|
"play <{song|URL}>",
|
||||||
public List<String> usage() {
|
"stop",
|
||||||
final List<String> usages = new ArrayList<>();
|
"loop <current|all|off>",
|
||||||
usages.add("play <{song|URL}>");
|
"list [{directory}]",
|
||||||
usages.add("stop");
|
"skip",
|
||||||
usages.add("loop <current|all|off>");
|
"nowplaying",
|
||||||
usages.add("list [{directory}]");
|
"queue",
|
||||||
usages.add("skip");
|
"goto <timestamp>",
|
||||||
usages.add("nowplaying");
|
"pitch <pitch>",
|
||||||
usages.add("queue");
|
"speed <speed>",
|
||||||
usages.add("goto <timestamp>");
|
"pause",
|
||||||
usages.add("pitch <pitch>");
|
"resume",
|
||||||
usages.add("speed <speed>");
|
"info"
|
||||||
usages.add("pause");
|
},
|
||||||
usages.add("resume");
|
new String[] { "song" },
|
||||||
usages.add("info");
|
TrustLevel.PUBLIC
|
||||||
|
);
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("song");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
if (args.length < 1) return Component.text("Not enough arguments").color(NamedTextColor.RED);
|
if (args.length < 1) return Component.text("Not enough arguments").color(NamedTextColor.RED);
|
||||||
|
|
||||||
|
|
|
@ -9,35 +9,20 @@ 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.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class NetMessageCommand implements Command {
|
public class NetMessageCommand extends Command {
|
||||||
public String name() { return "netmsg"; }
|
public NetMessageCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"netmsg",
|
||||||
return "Broadcasts a message to all of the servers that the bot is connected";
|
"Broadcasts a message to all of the servers that the bot is connected",
|
||||||
}
|
new String[] { "<{message}>" },
|
||||||
|
new String[] { "networkmessage", "irc" },
|
||||||
public List<String> usage() {
|
TrustLevel.PUBLIC
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("<{message}>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("networkmessage");
|
|
||||||
aliases.add("irc");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
final List<Bot> bots = bot.bots();
|
final List<Bot> bots = bot.bots();
|
||||||
|
|
|
@ -1,43 +1,27 @@
|
||||||
package land.chipmunk.chayapak.chomens_bot.commands;
|
package land.chipmunk.chayapak.chomens_bot.commands;
|
||||||
|
|
||||||
import land.chipmunk.chayapak.chomens_bot.Bot;
|
import land.chipmunk.chayapak.chomens_bot.Bot;
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
|
||||||
import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry;
|
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.Command;
|
import land.chipmunk.chayapak.chomens_bot.command.Command;
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
||||||
|
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
||||||
|
import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry;
|
||||||
import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities;
|
import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities;
|
||||||
import land.chipmunk.chayapak.chomens_bot.util.MathUtilities;
|
import land.chipmunk.chayapak.chomens_bot.util.MathUtilities;
|
||||||
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 java.util.ArrayList;
|
public class RandomTeleportCommand extends Command {
|
||||||
import java.util.List;
|
public RandomTeleportCommand () {
|
||||||
|
super(
|
||||||
public class RandomTeleportCommand implements Command {
|
"rtp",
|
||||||
public String name() { return "rtp"; }
|
"Randomly teleports you",
|
||||||
|
new String[] {},
|
||||||
public String description() {
|
new String[] { "randomteleport" },
|
||||||
return "Randomly teleports you";
|
TrustLevel.PUBLIC
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("randomteleport");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -6,34 +6,18 @@ import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class RefillCoreCommand extends Command {
|
||||||
import java.util.List;
|
public RefillCoreCommand () {
|
||||||
|
super(
|
||||||
public class RefillCoreCommand implements Command {
|
"refillcore",
|
||||||
public String name() { return "refillcore"; }
|
"Refills and resets the bots command core",
|
||||||
|
new String[] {},
|
||||||
public String description() {
|
new String[] { "rc" },
|
||||||
return "Refills and resets the bots command core";
|
TrustLevel.PUBLIC
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("rc");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -18,31 +18,18 @@ import org.joda.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SeenCommand implements Command {
|
public class SeenCommand extends Command {
|
||||||
public String name() { return "seen"; }
|
public SeenCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"seen",
|
||||||
return "Shows the last seen of a player";
|
"Shows the last seen of a player",
|
||||||
}
|
new String[] { "<{player}>" },
|
||||||
|
new String[] { "lastseen" },
|
||||||
public List<String> usage() {
|
TrustLevel.PUBLIC
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("<{player}>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("lastseen");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -9,34 +9,18 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import org.luaj.vm2.LuaValue;
|
import org.luaj.vm2.LuaValue;
|
||||||
import org.luaj.vm2.lib.jse.CoerceJavaToLua;
|
import org.luaj.vm2.lib.jse.CoerceJavaToLua;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class ServerEvalCommand extends Command {
|
||||||
import java.util.List;
|
public ServerEvalCommand () {
|
||||||
|
super(
|
||||||
public class ServerEvalCommand implements Command {
|
"servereval",
|
||||||
public String name() { return "servereval"; }
|
"Evaluate codes using LuaJ",
|
||||||
|
new String[] { "<ownerHash> <{code}>" },
|
||||||
public String description() {
|
new String[] { "lastseen" },
|
||||||
return "Evaluate codes using LuaJ";
|
TrustLevel.OWNER
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("<ownerHash> <{code}>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.OWNER;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
try {
|
try {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
|
@ -17,36 +17,21 @@ import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class ServerInfoCommand implements Command {
|
public class ServerInfoCommand extends Command {
|
||||||
public String name() { return "serverinfo"; }
|
public ServerInfoCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"serverinfo",
|
||||||
return "Shows the info about the server that is hosting the bot";
|
"Shows the info about the server that is hosting the bot",
|
||||||
}
|
new String[] {},
|
||||||
|
new String[] {},
|
||||||
public List<String> usage() {
|
TrustLevel.PUBLIC
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) throws UnknownHostException {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) throws UnknownHostException {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -1,41 +1,25 @@
|
||||||
package land.chipmunk.chayapak.chomens_bot.commands;
|
package land.chipmunk.chayapak.chomens_bot.commands;
|
||||||
|
|
||||||
import land.chipmunk.chayapak.chomens_bot.Bot;
|
import land.chipmunk.chayapak.chomens_bot.Bot;
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
|
||||||
import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry;
|
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.Command;
|
import land.chipmunk.chayapak.chomens_bot.command.Command;
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
||||||
|
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
||||||
|
import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
// ayunsudo renamed.
|
// ayunsudo renamed.
|
||||||
public class SudoAllCommand implements Command {
|
public class SudoAllCommand extends Command {
|
||||||
public String name() { return "sudoall"; }
|
public SudoAllCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"sudoall",
|
||||||
return "Sudoes everyone";
|
"Sudoes everyone",
|
||||||
}
|
new String[] { "<hash> <{c:message|command}>" },
|
||||||
|
new String[] { "ayunsudo" },
|
||||||
public List<String> usage() {
|
TrustLevel.TRUSTED
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("<hash> <{c:message|command}>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("ayunsudo");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.TRUSTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -8,34 +8,18 @@ import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities;
|
||||||
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 java.util.ArrayList;
|
public class TPSBarCommand extends Command {
|
||||||
import java.util.List;
|
public TPSBarCommand () {
|
||||||
|
super(
|
||||||
public class TPSBarCommand implements Command {
|
"tpsbar",
|
||||||
public String name() { return "tpsbar"; }
|
"Shows the server's TPS using Minecraft Bossbar",
|
||||||
|
new String[] { "<on|off>" },
|
||||||
public String description() {
|
new String[] { "tps" },
|
||||||
return "Shows the server's TPS using Minecraft Bossbar";
|
TrustLevel.PUBLIC
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("<on|off>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("tps");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -6,34 +6,18 @@ import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
||||||
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 java.util.ArrayList;
|
public class TestCommand extends Command {
|
||||||
import java.util.List;
|
public TestCommand () {
|
||||||
|
super(
|
||||||
public class TestCommand implements Command {
|
"test",
|
||||||
public String name() { return "test"; }
|
"Tests if the bot is working",
|
||||||
|
new String[] { "[{args}]" },
|
||||||
public String description() {
|
new String[] {},
|
||||||
return "Tests if the bot is working";
|
TrustLevel.PUBLIC
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("[{args}]");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
return Component.translatable(
|
return Component.translatable(
|
||||||
"Hello, World! Username: %s, Sender UUID: %s, Prefix: %s, Args: %s",
|
"Hello, World! Username: %s, Sender UUID: %s, Prefix: %s, Args: %s",
|
||||||
|
|
|
@ -5,32 +5,15 @@ import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class ThrowCommand extends Command {
|
||||||
import java.util.List;
|
public ThrowCommand () {
|
||||||
|
super(
|
||||||
public class ThrowCommand implements Command {
|
"throw",
|
||||||
public String name() { return "throw"; }
|
"Throws a Java Exception, kinda useless",
|
||||||
|
new String[] { "[{message}]" },
|
||||||
public String description() {
|
new String[] { "throwerror" },
|
||||||
return "A command to throw an error, kinda useless";
|
TrustLevel.PUBLIC
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("[{message}]");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("throwerror");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) throws Exception {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) throws Exception {
|
||||||
|
|
|
@ -12,35 +12,18 @@ import org.joda.time.DateTimeZone;
|
||||||
import org.joda.time.format.DateTimeFormat;
|
import org.joda.time.format.DateTimeFormat;
|
||||||
import org.joda.time.format.DateTimeFormatter;
|
import org.joda.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class TimeCommand extends Command {
|
||||||
import java.util.List;
|
public TimeCommand () {
|
||||||
|
super(
|
||||||
public class TimeCommand implements Command {
|
"time",
|
||||||
public String name() { return "time"; }
|
"Shows the date and time for the specified timezone",
|
||||||
|
new String[] { "<timezone>" },
|
||||||
public String description() {
|
new String[] { "dateandtime", "date" },
|
||||||
return "Shows the date and time for the specified timezone";
|
TrustLevel.PUBLIC
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("<timezone>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("dateandtime");
|
|
||||||
aliases.add("date");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -15,35 +15,20 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class TranslateCommand implements Command {
|
public class TranslateCommand extends Command {
|
||||||
public String name() { return "translate"; }
|
public TranslateCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"translate",
|
||||||
return "Translate a message using Google Translate";
|
"Translates a message using Google Translate",
|
||||||
}
|
new String[] { "<fromLanguage> <toLanguage> <{message}>" },
|
||||||
|
new String[] {},
|
||||||
public List<String> usage() {
|
TrustLevel.PUBLIC
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("<from> <to> <{message}>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -1,44 +1,28 @@
|
||||||
package land.chipmunk.chayapak.chomens_bot.commands;
|
package land.chipmunk.chayapak.chomens_bot.commands;
|
||||||
|
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
|
||||||
import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry;
|
|
||||||
import land.chipmunk.chayapak.chomens_bot.Bot;
|
import land.chipmunk.chayapak.chomens_bot.Bot;
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.Command;
|
import land.chipmunk.chayapak.chomens_bot.command.Command;
|
||||||
import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
||||||
|
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
||||||
|
import land.chipmunk.chayapak.chomens_bot.data.chat.MutablePlayerListEntry;
|
||||||
import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities;
|
import land.chipmunk.chayapak.chomens_bot.util.ColorUtilities;
|
||||||
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.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class UUIDCommand extends Command {
|
||||||
import java.util.List;
|
public UUIDCommand () {
|
||||||
|
super(
|
||||||
public class UUIDCommand implements Command {
|
"uuid",
|
||||||
public String name() { return "uuid"; }
|
"Shows your UUID or other player's UUID",
|
||||||
|
new String[] { "[{username}]" },
|
||||||
public String description() {
|
new String[] {},
|
||||||
return "Shows your UUID or other player's UUID";
|
TrustLevel.PUBLIC
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("[{username}]");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -9,35 +9,20 @@ import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class UptimeCommand implements Command {
|
public class UptimeCommand extends Command {
|
||||||
public String name() { return "uptime"; }
|
public UptimeCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"uptime",
|
||||||
return "Shows the bots uptime";
|
"Shows the bots uptime",
|
||||||
}
|
new String[] { "<fromLanguage> <toLanguage> <{message}>" },
|
||||||
|
new String[] {},
|
||||||
public List<String> usage() {
|
TrustLevel.PUBLIC
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final Bot bot = context.bot();
|
final Bot bot = context.bot();
|
||||||
|
|
||||||
|
|
|
@ -18,32 +18,16 @@ import net.kyori.adventure.text.format.TextDecoration;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class UrbanCommand implements Command {
|
public class UrbanCommand extends Command {
|
||||||
public String name() { return "urban"; }
|
public UrbanCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"urban",
|
||||||
return "Urban Dictionary in Minecraft";
|
"Urban Dictionary in Minecraft",
|
||||||
}
|
new String[] { "<{term}>" },
|
||||||
|
new String[] {},
|
||||||
public List<String> usage() {
|
TrustLevel.PUBLIC
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("<{term}>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Component execute (CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute (CommandContext context, String[] args, String[] fullArgs) {
|
||||||
|
|
|
@ -6,34 +6,18 @@ import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
||||||
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 java.util.ArrayList;
|
public class ValidateCommand extends Command {
|
||||||
import java.util.List;
|
public ValidateCommand () {
|
||||||
|
super(
|
||||||
public class ValidateCommand implements Command {
|
"validate",
|
||||||
public String name() { return "validate"; }
|
"Validates a hash",
|
||||||
|
new String[] { "<hash|ownerHash>" },
|
||||||
public String description() {
|
new String[] { "checkhash" },
|
||||||
return "Validates a hash";
|
TrustLevel.TRUSTED
|
||||||
}
|
);
|
||||||
|
|
||||||
public List<String> usage() {
|
|
||||||
final List<String> usages = new ArrayList<>();
|
|
||||||
usages.add("<hash|ownerHash>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("checkhash");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.TRUSTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
final String hash = fullArgs[0];
|
final String hash = fullArgs[0];
|
||||||
|
|
||||||
|
|
|
@ -18,32 +18,16 @@ import org.joda.time.format.DateTimeFormatter;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class WeatherCommand implements Command {
|
public class WeatherCommand extends Command {
|
||||||
public String name() { return "weather"; }
|
public WeatherCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"weather",
|
||||||
return "Shows the weather in a place";
|
"Shows the weather in a place",
|
||||||
}
|
new String[] { "<{location}>" },
|
||||||
|
new String[] {},
|
||||||
public List<String> usage() {
|
TrustLevel.TRUSTED
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("<{location}>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Component execute (CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute (CommandContext context, String[] args, String[] fullArgs) {
|
||||||
|
|
|
@ -14,32 +14,16 @@ import java.io.FileNotFoundException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class WikipediaCommand implements Command {
|
public class WikipediaCommand extends Command {
|
||||||
public String name() { return "wikipedia"; }
|
public WikipediaCommand () {
|
||||||
|
super(
|
||||||
public String description() {
|
"wikipedia",
|
||||||
return "Wikipedia in Minecraft";
|
"Wikipedia in Minecraft",
|
||||||
}
|
new String[] { "<{page}>" },
|
||||||
|
new String[] { "wiki" },
|
||||||
public List<String> usage() {
|
TrustLevel.PUBLIC
|
||||||
final List<String> usages = new ArrayList<>();
|
);
|
||||||
usages.add("<{page}>");
|
|
||||||
|
|
||||||
return usages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> alias() {
|
|
||||||
final List<String> aliases = new ArrayList<>();
|
|
||||||
aliases.add("wiki");
|
|
||||||
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
|
||||||
return TrustLevel.PUBLIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Component execute (CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute (CommandContext context, String[] args, String[] fullArgs) {
|
||||||
|
|
|
@ -101,10 +101,10 @@ public class CommandHandlerPlugin {
|
||||||
final String[] fullArgs = Arrays.copyOfRange(splitInput, 1, splitInput.length);
|
final String[] fullArgs = Arrays.copyOfRange(splitInput, 1, splitInput.length);
|
||||||
|
|
||||||
// TODO: improve these minimum args and maximum args stuff, the current one really sucks.,.,
|
// TODO: improve these minimum args and maximum args stuff, the current one really sucks.,.,
|
||||||
final int shortestUsageIndex = getShortestUsageIndex(command.usage());
|
final int shortestUsageIndex = getShortestUsageIndex(command.usages());
|
||||||
final int longestUsageIndex = getLongestUsageIndex(command.usage());
|
final int longestUsageIndex = getLongestUsageIndex(command.usages());
|
||||||
final String shortestUsage = command.usage().get(shortestUsageIndex);
|
final String shortestUsage = command.usages()[shortestUsageIndex];
|
||||||
final String longestUsage = command.usage().get(longestUsageIndex);
|
final String longestUsage = command.usages()[longestUsageIndex];
|
||||||
|
|
||||||
final int minimumArgs = getMinimumArgs(shortestUsage, inGame, command.trustLevel());
|
final int minimumArgs = getMinimumArgs(shortestUsage, inGame, command.trustLevel());
|
||||||
final int maximumArgs = getMaximumArgs(longestUsage, inGame, command.trustLevel());
|
final int maximumArgs = getMaximumArgs(longestUsage, inGame, command.trustLevel());
|
||||||
|
@ -181,7 +181,7 @@ public class CommandHandlerPlugin {
|
||||||
if (
|
if (
|
||||||
(
|
(
|
||||||
command.name().equals(searchTerm.toLowerCase()) ||
|
command.name().equals(searchTerm.toLowerCase()) ||
|
||||||
command.alias().contains(searchTerm.toLowerCase())
|
Arrays.stream(command.aliases()).toList().contains(searchTerm.toLowerCase())
|
||||||
) &&
|
) &&
|
||||||
!searchTerm.equals("") // ig yup
|
!searchTerm.equals("") // ig yup
|
||||||
) {
|
) {
|
||||||
|
@ -191,14 +191,14 @@ public class CommandHandlerPlugin {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getLongestUsageIndex(List<String> usages) {
|
private int getLongestUsageIndex(String[] usages) {
|
||||||
int longestIndex = 0;
|
int longestIndex = 0;
|
||||||
int maxLength = 0;
|
int maxLength = 0;
|
||||||
|
|
||||||
final int usagesSize = usages.size();
|
final int usagesSize = usages.length;
|
||||||
|
|
||||||
for (int i = 0; i < usagesSize; i++) {
|
for (int i = 0; i < usagesSize; i++) {
|
||||||
String[] args = usages.get(i).split("\\s+");
|
String[] args = usages[i].split("\\s+");
|
||||||
if (args.length > maxLength) {
|
if (args.length > maxLength) {
|
||||||
longestIndex = i;
|
longestIndex = i;
|
||||||
maxLength = args.length;
|
maxLength = args.length;
|
||||||
|
@ -207,14 +207,14 @@ public class CommandHandlerPlugin {
|
||||||
return longestIndex;
|
return longestIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getShortestUsageIndex(List<String> usages) {
|
private int getShortestUsageIndex(String[] usages) {
|
||||||
int shortestIndex = 0;
|
int shortestIndex = 0;
|
||||||
int minLength = Integer.MAX_VALUE;
|
int minLength = Integer.MAX_VALUE;
|
||||||
|
|
||||||
final int usagesSize = usages.size();
|
final int usagesSize = usages.length;
|
||||||
|
|
||||||
for (int i = 0; i < usagesSize; i++) {
|
for (int i = 0; i < usagesSize; i++) {
|
||||||
String[] args = usages.get(i).split("\\s+");
|
String[] args = usages[i].split("\\s+");
|
||||||
if (args.length < minLength) {
|
if (args.length < minLength) {
|
||||||
shortestIndex = i;
|
shortestIndex = i;
|
||||||
minLength = args.length;
|
minLength = args.length;
|
||||||
|
|
Loading…
Reference in a new issue