make Command a class
This commit is contained in:
parent
283598d52c
commit
1b424778dd
40 changed files with 221 additions and 317 deletions
|
@ -4,9 +4,45 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="50f184fa-7bed-4956-baf5-7586ff26ea08" name="Changes" comment="port a thing from chomens bot js to java">
|
||||
<list default="true" id="50f184fa-7bed-4956-baf5-7586ff26ea08" name="Changes" comment="use alphanumeric">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/command/Command.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/command/Command.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/BotUserCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/BotUserCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/BotVisibilityCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/BotVisibilityCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/BruhifyCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/BruhifyCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ClearChatCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ClearChatCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ClearChatQueueCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ClearChatQueueCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CloopCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CloopCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CommandBlockCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CommandBlockCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CowsayCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CowsayCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CreatorCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/CreatorCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/DiscordCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/DiscordCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/EchoCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/EchoCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/EndCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/EndCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/FilterCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/FilterCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/GenerateMazeCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/GenerateMazeCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/GrepLogCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/GrepLogCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/HelpCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/HelpCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/KickCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/KickCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ListCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ListCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/MusicCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/MusicCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/NetMessageCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/NetMessageCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/RandomTeleportCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/RandomTeleportCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/RefillCoreCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/RefillCoreCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ServerEvalCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ServerEvalCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ServerInfoCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ServerInfoCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/SudoAllCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/SudoAllCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/TPSBarCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/TPSBarCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/TestCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/TestCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ThrowCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ThrowCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/TimeCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/TimeCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/TranslateCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/TranslateCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UUIDCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UUIDCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UrbanCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/UrbanCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ValidateCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/ValidateCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/WeatherCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/WeatherCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/WikipediaCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/commands/WikipediaCommand.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandHandlerPlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandHandlerPlugin.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -98,13 +134,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680245437032</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00087" summary="add/improve/fix stuff ig mabe mabe mabe useCore!1!1!">
|
||||
<created>1682060041610</created>
|
||||
<option name="number" value="00087" />
|
||||
<option name="presentableId" value="LOCAL-00087" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682060041611</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00088" summary="ig fix music filename mabe mabe">
|
||||
<created>1682073074933</created>
|
||||
<option name="number" value="00088" />
|
||||
|
@ -441,7 +470,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1682673335876</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="136" />
|
||||
<task id="LOCAL-00136" summary="use alphanumeric">
|
||||
<created>1682676091534</created>
|
||||
<option name="number" value="00136" />
|
||||
<option name="presentableId" value="LOCAL-00136" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682676091535</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="137" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -456,7 +492,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="actually fix the fix the first "fix" is just fix like just fix,.., then the second one is the last commit, "fix chat (/say and /me) i guess"" />
|
||||
<MESSAGE value="fix test?" />
|
||||
<MESSAGE value="fix extras chat" />
|
||||
<MESSAGE value="actually improve the systemMessageReceived thing" />
|
||||
|
@ -481,7 +516,8 @@
|
|||
<MESSAGE value="use block change and multi block change packets and also change the core refill delay !!!" />
|
||||
<MESSAGE value="actually i forgor 1 thing its the command block update thing which we want to ignore it" />
|
||||
<MESSAGE value="port a thing from chomens bot js to java" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="port a thing from chomens bot js to java" />
|
||||
<MESSAGE value="use alphanumeric" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="use alphanumeric" />
|
||||
</component>
|
||||
<component name="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
package land.chipmunk.chayapak.chomens_bot.command;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public interface Command {
|
||||
String name();
|
||||
String description();
|
||||
List<String> usage();
|
||||
List<String> alias();
|
||||
int trustLevel();
|
||||
public class Command {
|
||||
public String name = "unnamed" + RandomStringUtils.randomNumeric(4);
|
||||
public String description = "No Description";
|
||||
public List<String> usage () {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
public List<String> alias () {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
Component execute(CommandContext context, String[] args, String[] fullArgs) throws Exception;
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) throws Exception {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,12 +11,10 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BotUserCommand implements Command {
|
||||
public String name() { return "botuser"; }
|
||||
public class BotUserCommand extends Command {
|
||||
public String name = "botuser";
|
||||
|
||||
public String description() {
|
||||
return "Shows the bot's username and UUID";
|
||||
}
|
||||
public String description = "Shows the bot's username and UUID";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -32,9 +30,7 @@ public class BotUserCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -9,12 +9,10 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BotVisibilityCommand implements Command {
|
||||
public String name() { return "botvisibility"; }
|
||||
public class BotVisibilityCommand extends Command {
|
||||
public String name = "botvisibility";
|
||||
|
||||
public String description() {
|
||||
return "Changes the bot's visibility";
|
||||
}
|
||||
public String description = "Changes the bot's visibility";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -34,9 +32,7 @@ public class BotVisibilityCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 1;
|
||||
}
|
||||
public int trustLevel = 1;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -8,12 +8,10 @@ import net.kyori.adventure.text.Component;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BruhifyCommand implements Command {
|
||||
public String name() { return "bruhify"; }
|
||||
public class BruhifyCommand extends Command {
|
||||
public String name = "bruhify";
|
||||
|
||||
public String description() {
|
||||
return "RecycleBot bruhify but actionbar";
|
||||
}
|
||||
public String description = "RecycleBot bruhify but actionbar";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -29,9 +27,7 @@ public class BruhifyCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -11,12 +11,10 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ClearChatCommand implements Command {
|
||||
public String name() { return "clearchat"; }
|
||||
public class ClearChatCommand extends Command {
|
||||
public String name = "clearchat";
|
||||
|
||||
public String description() {
|
||||
return "Clears the chat";
|
||||
}
|
||||
public String description = "Clears the chat";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -32,9 +30,7 @@ public class ClearChatCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -8,12 +8,10 @@ import net.kyori.adventure.text.Component;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ClearChatQueueCommand implements Command {
|
||||
public String name() { return "clearchatqueue"; }
|
||||
public class ClearChatQueueCommand extends Command {
|
||||
public String name = "clearchatqueue";
|
||||
|
||||
public String description() {
|
||||
return "Clears the bot's chat queue";
|
||||
}
|
||||
public String description = "Clears the bot's chat queue";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -29,9 +27,7 @@ public class ClearChatQueueCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -12,12 +12,10 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class CloopCommand implements Command {
|
||||
public String name() { return "cloop"; }
|
||||
public class CloopCommand extends Command {
|
||||
public String name = "cloop";
|
||||
|
||||
public String description() {
|
||||
return "Loop commands";
|
||||
}
|
||||
public String description = "Loop commands";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -36,9 +34,7 @@ public class CloopCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 1;
|
||||
}
|
||||
public int trustLevel = 1;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -14,12 +14,10 @@ import java.util.List;
|
|||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class CommandBlockCommand implements Command {
|
||||
public String name() { return "cb"; }
|
||||
public class CommandBlockCommand extends Command {
|
||||
public String name = "cb";
|
||||
|
||||
public String description() {
|
||||
return "Executes a command in the command core and return it's output";
|
||||
}
|
||||
public String description = "Executes a command in the command core and return it's output";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -37,9 +35,7 @@ public class CommandBlockCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) throws ExecutionException, InterruptedException {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -9,12 +9,10 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class CowsayCommand implements Command {
|
||||
public String name() { return "cowsay"; }
|
||||
public class CowsayCommand extends Command {
|
||||
public String name = "cowsay";
|
||||
|
||||
public String description() {
|
||||
return "Moo";
|
||||
}
|
||||
public String description = "Moo";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -30,9 +28,7 @@ public class CowsayCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final String cow = args[0];
|
||||
|
|
|
@ -9,12 +9,10 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CreatorCommand implements Command {
|
||||
public String name() { return "creator"; }
|
||||
public class CreatorCommand extends Command {
|
||||
public String name = "creator";
|
||||
|
||||
public String description() {
|
||||
return "Shows the bot's creator";
|
||||
}
|
||||
public String description = "Shows the bot's creator";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -30,9 +28,7 @@ public class CreatorCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -9,12 +9,10 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DiscordCommand implements Command {
|
||||
public String name() { return "discord"; }
|
||||
public class DiscordCommand extends Command {
|
||||
public String name = "discord";
|
||||
|
||||
public String description() {
|
||||
return "Shows the Discord invite";
|
||||
}
|
||||
public String description = "Shows the Discord invite";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -30,9 +28,7 @@ public class DiscordCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final String link = "https://discord.gg/xdgCkUyaA4";
|
||||
|
|
|
@ -8,12 +8,10 @@ import net.kyori.adventure.text.Component;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class EchoCommand implements Command {
|
||||
public String name() { return "echo"; }
|
||||
public class EchoCommand extends Command {
|
||||
public String name = "echo";
|
||||
|
||||
public String description() {
|
||||
return "Says a message";
|
||||
}
|
||||
public String description = "Says a message";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -29,9 +27,7 @@ public class EchoCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -8,12 +8,10 @@ import net.kyori.adventure.text.Component;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class EndCommand implements Command {
|
||||
public String name() { return "end"; }
|
||||
public class EndCommand extends Command {
|
||||
public String name = "end";
|
||||
|
||||
public String description() {
|
||||
return "End/Restarts the bot";
|
||||
}
|
||||
public String description = "End/Restarts the bot";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -29,9 +27,7 @@ public class EndCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 1;
|
||||
}
|
||||
public int trustLevel = 1;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -12,12 +12,10 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class FilterCommand implements Command {
|
||||
public String name() { return "filter"; }
|
||||
public class FilterCommand extends Command {
|
||||
public String name = "filter";
|
||||
|
||||
public String description() {
|
||||
return "Filter players";
|
||||
}
|
||||
public String description = "Filter players";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -39,9 +37,7 @@ public class FilterCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 1;
|
||||
}
|
||||
public int trustLevel = 1;
|
||||
|
||||
// most of these codes are from cloop and greplog
|
||||
public Component execute(CommandContext context, String[] _args, String[] fullArgs) {
|
||||
|
|
|
@ -10,12 +10,10 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GenerateMazeCommand implements Command {
|
||||
public String name() { return "generatemaze"; }
|
||||
public class GenerateMazeCommand extends Command {
|
||||
public String name = "generatemaze";
|
||||
|
||||
public String description() {
|
||||
return "Generates a maze";
|
||||
}
|
||||
public String description = "Generates a maze";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -32,9 +30,7 @@ public class GenerateMazeCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -10,12 +10,10 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class GrepLogCommand implements Command {
|
||||
public String name() { return "greplog"; }
|
||||
public class GrepLogCommand extends Command {
|
||||
public String name = "greplog";
|
||||
|
||||
public String description() {
|
||||
return "Queries the bot's log files";
|
||||
}
|
||||
public String description = "Queries the bot's log files";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -36,9 +34,7 @@ public class GrepLogCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] _args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -11,12 +11,10 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class HelpCommand implements Command {
|
||||
public String name() { return "help"; }
|
||||
public class HelpCommand extends Command {
|
||||
public String name = "help";
|
||||
|
||||
public String description() {
|
||||
return "Shows the help";
|
||||
}
|
||||
public String description = "Shows the help";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -34,9 +32,7 @@ public class HelpCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
private Bot bot;
|
||||
|
||||
|
@ -75,9 +71,9 @@ public class HelpCommand implements Command {
|
|||
List<String> commandNames = new ArrayList<>();
|
||||
|
||||
for (Command command : bot.commandHandler().commands()) {
|
||||
if (command.trustLevel() != trustLevel) continue;
|
||||
if (command.trustLevel != trustLevel) continue;
|
||||
|
||||
commandNames.add(command.name());
|
||||
commandNames.add(command.name);
|
||||
}
|
||||
|
||||
Collections.sort(commandNames);
|
||||
|
@ -104,9 +100,9 @@ public class HelpCommand implements Command {
|
|||
final String prefix = context.prefix();
|
||||
|
||||
for (Command command : bot.commandHandler().commands()) {
|
||||
if (!command.name().equals(args[0]) && !command.alias().contains(args[0])) continue;
|
||||
if (!command.name.equals(args[0]) && !command.alias().contains(args[0])) continue;
|
||||
|
||||
final String commandName = command.name();
|
||||
final String commandName = command.name;
|
||||
final List<Component> usages = new ArrayList<>();
|
||||
|
||||
usages.add(
|
||||
|
@ -117,13 +113,13 @@ public class HelpCommand implements Command {
|
|||
" (" + String.join(", ", command.alias()) + ")" :
|
||||
""
|
||||
))
|
||||
.append(Component.text(" - " + command.description()).color(NamedTextColor.GRAY))
|
||||
.append(Component.text(" - " + command.description).color(NamedTextColor.GRAY))
|
||||
);
|
||||
|
||||
usages.add(
|
||||
Component.empty()
|
||||
.append(Component.text("Trust level: ").color(NamedTextColor.GREEN))
|
||||
.append(Component.text(command.trustLevel()).color(NamedTextColor.YELLOW))
|
||||
.append(Component.text(command.trustLevel).color(NamedTextColor.YELLOW))
|
||||
);
|
||||
|
||||
for (String usage : command.usage()) {
|
||||
|
|
|
@ -11,12 +11,10 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class KickCommand implements Command {
|
||||
public String name() { return "kick"; }
|
||||
public class KickCommand extends Command {
|
||||
public String name = "kick";
|
||||
|
||||
public String description() {
|
||||
return "Kicks a player";
|
||||
}
|
||||
public String description = "Kicks a player";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -32,9 +30,7 @@ public class KickCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 1;
|
||||
}
|
||||
public int trustLevel = 1;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -13,12 +13,10 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ListCommand implements Command {
|
||||
public String name() { return "list"; }
|
||||
public class ListCommand extends Command {
|
||||
public String name = "list";
|
||||
|
||||
public String description() {
|
||||
return "Lists all players in the server (including vanished)";
|
||||
}
|
||||
public String description = "Lists all players in the server (including vanished)";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -34,9 +32,7 @@ public class ListCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -21,14 +21,12 @@ import java.util.Arrays;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class MusicCommand implements Command {
|
||||
public class MusicCommand extends Command {
|
||||
private Path root;
|
||||
|
||||
public String name() { return "music"; }
|
||||
public String name = "music";
|
||||
|
||||
public String description() {
|
||||
return "Plays music";
|
||||
}
|
||||
public String description = "Plays music";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -56,9 +54,7 @@ public class MusicCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
root = Path.of(MusicPlayerPlugin.SONG_DIR.getPath());
|
||||
|
@ -245,7 +241,7 @@ public class MusicCommand implements Command {
|
|||
.clickEvent(
|
||||
ClickEvent.suggestCommand(
|
||||
prefix +
|
||||
name() +
|
||||
name + // command name !!!
|
||||
(file.isFile() ? " play " : " list ") +
|
||||
joinedPath
|
||||
)
|
||||
|
|
|
@ -11,12 +11,10 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NetMessageCommand implements Command {
|
||||
public String name() { return "netmsg"; }
|
||||
public class NetMessageCommand extends Command {
|
||||
public String name = "netmsg";
|
||||
|
||||
public String description() {
|
||||
return "Broadcasts a message to all of the servers that the bot is connected";
|
||||
}
|
||||
public String description = "Broadcasts a message to all of the servers that the bot is connected";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -33,9 +31,7 @@ public class NetMessageCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -11,12 +11,10 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RandomTeleportCommand implements Command {
|
||||
public String name() { return "rtp"; }
|
||||
public class RandomTeleportCommand extends Command {
|
||||
public String name = "rtp";
|
||||
|
||||
public String description() {
|
||||
return "Randomly teleports you";
|
||||
}
|
||||
public String description = "Randomly teleports you";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -32,9 +30,7 @@ public class RandomTeleportCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -8,12 +8,10 @@ import net.kyori.adventure.text.Component;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RefillCoreCommand implements Command {
|
||||
public String name() { return "refillcore"; }
|
||||
public class RefillCoreCommand extends Command {
|
||||
public String name = "refillcore";
|
||||
|
||||
public String description() {
|
||||
return "Refills and resets the bot's command core";
|
||||
}
|
||||
public String description = "Refills and resets the bot's command core";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -29,9 +27,7 @@ public class RefillCoreCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -11,12 +11,10 @@ import org.luaj.vm2.lib.jse.CoerceJavaToLua;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ServerEvalCommand implements Command {
|
||||
public String name() { return "servereval"; }
|
||||
public class ServerEvalCommand extends Command {
|
||||
public String name = "servereval";
|
||||
|
||||
public String description() {
|
||||
return "Evaluate codes using LuaJ";
|
||||
}
|
||||
public String description = "Evaluate codes using LuaJ";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -32,9 +30,7 @@ public class ServerEvalCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 2;
|
||||
}
|
||||
public int trustLevel = 2;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
try {
|
||||
|
|
|
@ -19,12 +19,10 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class ServerInfoCommand implements Command {
|
||||
public String name() { return "serverinfo"; }
|
||||
public class ServerInfoCommand extends Command {
|
||||
public String name = "serverinfo";
|
||||
|
||||
public String description() {
|
||||
return "Shows the info about the server that is hosting the bot";
|
||||
}
|
||||
public String description = "Shows the info about the server that is hosting the bot";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -40,9 +38,7 @@ public class ServerInfoCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
// totallynotskidded™ from extras' serverinfo
|
||||
|
|
|
@ -10,12 +10,10 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
// ayunsudo renamed.
|
||||
public class SudoAllCommand implements Command {
|
||||
public String name() { return "sudoall"; }
|
||||
public class SudoAllCommand extends Command {
|
||||
public String name = "sudoall";
|
||||
|
||||
public String description() {
|
||||
return "Sudoes everyone";
|
||||
}
|
||||
public String description = "Sudoes everyone";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -31,9 +29,7 @@ public class SudoAllCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 1;
|
||||
}
|
||||
public int trustLevel = 1;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -9,12 +9,10 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TPSBarCommand implements Command {
|
||||
public String name() { return "tpsbar"; }
|
||||
public class TPSBarCommand extends Command {
|
||||
public String name = "tpsbar";
|
||||
|
||||
public String description() {
|
||||
return "Shows the server's TPS using Minecraft Bossbar";
|
||||
}
|
||||
public String description = "Shows the server's TPS using Minecraft Bossbar";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -30,9 +28,7 @@ public class TPSBarCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -8,12 +8,10 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestCommand implements Command {
|
||||
public String name() { return "test"; }
|
||||
public class TestCommand extends Command {
|
||||
public String name = "test";
|
||||
|
||||
public String description() {
|
||||
return "Tests if the bot is working";
|
||||
}
|
||||
public String description = "Tests if the bot is working";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -29,9 +27,7 @@ public class TestCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
return Component.translatable(
|
||||
|
|
|
@ -7,12 +7,10 @@ import net.kyori.adventure.text.Component;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ThrowCommand implements Command {
|
||||
public String name() { return "throw"; }
|
||||
public class ThrowCommand extends Command {
|
||||
public String name = "throw";
|
||||
|
||||
public String description() {
|
||||
return "A command to throw an error, kinda useless";
|
||||
}
|
||||
public String description = "A command to throw an error, kinda useless";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -28,9 +26,7 @@ public class ThrowCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) throws Exception {
|
||||
final String message = String.join(" ", args);
|
||||
|
|
|
@ -12,12 +12,10 @@ import org.joda.time.format.DateTimeFormatter;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TimeCommand implements Command {
|
||||
public String name() { return "time"; }
|
||||
public class TimeCommand extends Command {
|
||||
public String name = "time";
|
||||
|
||||
public String description() {
|
||||
return "Shows the date and time for the specified timezone";
|
||||
}
|
||||
public String description = "Shows the date and time for the specified timezone";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -34,9 +32,7 @@ public class TimeCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final String timezone = args[0];
|
||||
|
|
|
@ -16,12 +16,10 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class TranslateCommand implements Command {
|
||||
public String name() { return "translate"; }
|
||||
public class TranslateCommand extends Command {
|
||||
public String name = "translate";
|
||||
|
||||
public String description() {
|
||||
return "Translate a message using Google Translate";
|
||||
}
|
||||
public String description = "Translate a message using Google Translate";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -37,9 +35,7 @@ public class TranslateCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final String from = args[0];
|
||||
|
|
|
@ -12,12 +12,10 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UUIDCommand implements Command {
|
||||
public String name() { return "uuid"; }
|
||||
public class UUIDCommand extends Command {
|
||||
public String name = "uuid";
|
||||
|
||||
public String description() {
|
||||
return "Shows your UUID or other player's UUID";
|
||||
}
|
||||
public String description = "Shows your UUID or other player's UUID";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -33,9 +31,7 @@ public class UUIDCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -16,12 +16,10 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UrbanCommand implements Command {
|
||||
public String name() { return "urban"; }
|
||||
public class UrbanCommand extends Command {
|
||||
public String name = "urban";
|
||||
|
||||
public String description() {
|
||||
return "Urban Dictionary in Minecraft";
|
||||
}
|
||||
public String description = "Urban Dictionary in Minecraft";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -37,9 +35,7 @@ public class UrbanCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute (CommandContext context, String[] args, String[] fullArgs) {
|
||||
final String term = String.join(" ", args);
|
||||
|
|
|
@ -8,12 +8,10 @@ import net.kyori.adventure.text.format.NamedTextColor;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ValidateCommand implements Command {
|
||||
public String name() { return "validate"; }
|
||||
public class ValidateCommand extends Command {
|
||||
public String name = "validate";
|
||||
|
||||
public String description() {
|
||||
return "Validates a hash";
|
||||
}
|
||||
public String description = "Validates a hash";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -29,9 +27,7 @@ public class ValidateCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 1;
|
||||
}
|
||||
public int trustLevel = 1;
|
||||
|
||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||
final String hash = fullArgs[0];
|
||||
|
|
|
@ -19,12 +19,10 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WeatherCommand implements Command {
|
||||
public String name() { return "weather"; }
|
||||
public class WeatherCommand extends Command {
|
||||
public String name = "weather";
|
||||
|
||||
public String description() {
|
||||
return "Shows the weather in a place";
|
||||
}
|
||||
public String description = "Shows the weather in a place";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -40,9 +38,7 @@ public class WeatherCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute (CommandContext context, String[] args, String[] fullArgs) {
|
||||
final Bot bot = context.bot();
|
||||
|
|
|
@ -15,12 +15,10 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WikipediaCommand implements Command {
|
||||
public String name() { return "wikipedia"; }
|
||||
public class WikipediaCommand extends Command {
|
||||
public String name = "wikipedia";
|
||||
|
||||
public String description() {
|
||||
return "Wikipedia in Minecraft";
|
||||
}
|
||||
public String description = "Wikipedia in Minecraft";
|
||||
|
||||
public List<String> usage() {
|
||||
final List<String> usages = new ArrayList<>();
|
||||
|
@ -36,9 +34,7 @@ public class WikipediaCommand implements Command {
|
|||
return aliases;
|
||||
}
|
||||
|
||||
public int trustLevel() {
|
||||
return 0;
|
||||
}
|
||||
public int trustLevel = 0;
|
||||
|
||||
public Component execute (CommandContext context, String[] args, String[] fullArgs) {
|
||||
final String page = String.join(" ", args);
|
||||
|
|
|
@ -81,13 +81,13 @@ public class CommandHandlerPlugin {
|
|||
|
||||
if (command == null) return Component.text("Unknown command: " + commandName).color(NamedTextColor.RED);
|
||||
|
||||
final int trustLevel = command.trustLevel();
|
||||
final int trustLevel = command.trustLevel;
|
||||
|
||||
final String[] fullArgs = Arrays.copyOfRange(splitInput, 1, splitInput.length);
|
||||
final int longestUsageIndex = getLongestUsageIndex(command.usage());
|
||||
final String usage = command.usage().get(longestUsageIndex);
|
||||
final int minimumArgs = getMinimumArgs(usage, inGame, command.trustLevel());
|
||||
final int maximumArgs = getMaximumArgs(usage, inGame, command.trustLevel());
|
||||
final int minimumArgs = getMinimumArgs(usage, inGame, command.trustLevel);
|
||||
final int maximumArgs = getMaximumArgs(usage, inGame, command.trustLevel);
|
||||
if (fullArgs.length < minimumArgs) return Component.text("Excepted minimum of " + minimumArgs + " argument(s), got " + fullArgs.length).color(NamedTextColor.RED);
|
||||
if (fullArgs.length > maximumArgs && !usage.contains("{")) return Component.text("Too much arguments, expected " + maximumArgs + " max").color(NamedTextColor.RED);
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class CommandHandlerPlugin {
|
|||
|
||||
final String[] args = Arrays.copyOfRange(splitInput, (trustLevel > 0 && inGame) ? 2 : 1, splitInput.length);
|
||||
|
||||
if (command.trustLevel() > 0 && !console) {
|
||||
if (command.trustLevel > 0 && !console) {
|
||||
if (discord) {
|
||||
final List<Role> roles = event.getMember().getRoles();
|
||||
|
||||
|
@ -106,24 +106,24 @@ public class CommandHandlerPlugin {
|
|||
final String adminRoleName = bot.config().discord().adminRoleName();
|
||||
|
||||
if (
|
||||
command.trustLevel() == 1 &&
|
||||
command.trustLevel == 1 &&
|
||||
roles.stream().noneMatch(role -> role.getName().equalsIgnoreCase(trustedRoleName)) &&
|
||||
roles.stream().noneMatch(role -> role.getName().equalsIgnoreCase(adminRoleName))
|
||||
) return Component.text("You're not in the trusted role!").color(NamedTextColor.RED);
|
||||
|
||||
if (
|
||||
command.trustLevel() == 2 &&
|
||||
command.trustLevel == 2 &&
|
||||
roles.stream().noneMatch(role -> role.getName().equalsIgnoreCase(adminRoleName))
|
||||
) return Component.text("You're not in the admin role!").color(NamedTextColor.RED);
|
||||
} else {
|
||||
if (
|
||||
command.trustLevel() == 1 &&
|
||||
command.trustLevel == 1 &&
|
||||
!userHash.equals(hash) &&
|
||||
!userHash.equals(ownerHash)
|
||||
) return Component.text("Invalid hash").color(NamedTextColor.RED);
|
||||
|
||||
if (
|
||||
command.trustLevel() == 2 &&
|
||||
command.trustLevel == 2 &&
|
||||
!userHash.equals(ownerHash)
|
||||
) return Component.text("Invalid OwnerHash").color(NamedTextColor.RED);
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@ public class CommandSuggestionPlugin extends ChatPlugin.ChatListener {
|
|||
output.add(Component.text(transactionId));
|
||||
|
||||
for (Command command : bot.commandHandler().commands()) {
|
||||
if (!command.name().startsWith(input)) continue;
|
||||
if (!command.name.startsWith(input)) continue;
|
||||
|
||||
output.add(Component.text(command.name()));
|
||||
output.add(Component.text(command.name));
|
||||
}
|
||||
|
||||
bot.chat().tellraw(Component.join(JoinConfiguration.noSeparators(), output), player);
|
||||
|
|
|
@ -9,7 +9,7 @@ public class ElementUtilities {
|
|||
for (Command command : commands) {
|
||||
if (
|
||||
(
|
||||
command.name().equals(searchTerm.toLowerCase()) ||
|
||||
command.name.equals(searchTerm.toLowerCase()) ||
|
||||
command.alias().contains(searchTerm.toLowerCase())
|
||||
) &&
|
||||
!searchTerm.equals("") // ig yup
|
||||
|
|
Loading…
Reference in a new issue