chomens-bot-java/src/main/java/me/chayapak1/chomens_bot/commands/ThrowCommand.java

41 lines
1 KiB
Java
Raw Normal View History

2023-03-24 09:04:55 +07:00
package me.chayapak1.chomens_bot.commands;
2023-03-18 18:04:06 +07:00
2023-03-24 09:04:55 +07:00
import me.chayapak1.chomens_bot.command.Command;
import me.chayapak1.chomens_bot.command.CommandContext;
2023-03-18 18:04:06 +07:00
import net.kyori.adventure.text.Component;
import java.util.ArrayList;
import java.util.List;
public class ThrowCommand implements Command {
2023-03-19 10:47:15 +07:00
public String name() { return "throw"; }
2023-03-18 18:04:06 +07:00
public String description() {
return "A command to throw an error, kinda useless";
}
public List<String> usage() {
final List<String> usages = new ArrayList<>();
2023-03-19 10:47:15 +07:00
usages.add("[{message}]");
2023-03-18 18:04:06 +07:00
return usages;
}
2023-03-19 10:47:15 +07:00
public List<String> alias() {
final List<String> aliases = new ArrayList<>();
aliases.add("throwerror");
return aliases;
}
public int trustLevel() {
return 0;
}
public Component execute(CommandContext context, String[] args, String[] fullArgs) throws Exception {
2023-03-18 18:04:06 +07:00
final String message = String.join(" ", args);
throw new Exception(message.equals("") ? "among us" : message);
}
}