aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/commands/warp/WarpCommandHandler.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2022-08-09 20:33:04 -0400
committerGitHub <noreply@github.com>2022-08-09 20:33:04 -0400
commit0345c0ce9594d76a9ac1601bd039b1b64a6a38dc (patch)
tree7f762c94a742a07e5c3939e70d35cf7128071b32 /src/main/java/me/Danker/commands/warp/WarpCommandHandler.java
parentf56302bee3939677fc3fd015a97b12b5100c45b1 (diff)
parent4d2a84d9fd2f522b2ade9954f8d40f6d80e2b12b (diff)
downloadSkyblockMod-0345c0ce9594d76a9ac1601bd039b1b64a6a38dc.tar.gz
SkyblockMod-0345c0ce9594d76a9ac1601bd039b1b64a6a38dc.tar.bz2
SkyblockMod-0345c0ce9594d76a9ac1601bd039b1b64a6a38dc.zip
Merge pull request #90 from CuzImClicks/development
Highlight completed Commissions Fast warp commands Fix kill combo hider
Diffstat (limited to 'src/main/java/me/Danker/commands/warp/WarpCommandHandler.java')
-rw-r--r--src/main/java/me/Danker/commands/warp/WarpCommandHandler.java94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/commands/warp/WarpCommandHandler.java b/src/main/java/me/Danker/commands/warp/WarpCommandHandler.java
new file mode 100644
index 0000000..6cdf840
--- /dev/null
+++ b/src/main/java/me/Danker/commands/warp/WarpCommandHandler.java
@@ -0,0 +1,94 @@
+package me.Danker.commands.warp;
+
+import net.minecraftforge.client.ClientCommandHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class WarpCommandHandler {
+
+ private List<WarpCommand> commands;
+
+ /**
+ * Constructor of the WarpCommandHandler, it will register all commands when it is created
+ */
+ public WarpCommandHandler() {
+ this.commands = new ArrayList<WarpCommand>();
+ registerCommands();
+ }
+
+
+ /**
+ * @return List of all registered commands
+ */
+ public List<WarpCommand> getCommands() {
+ return this.commands;
+ }
+
+ /**
+ * Registers a command to the handler
+ * @param warpCommand WarpCommand to register
+ */
+ public void registerCommand(WarpCommand warpCommand) {
+ this.commands.add(warpCommand);
+ ClientCommandHandler.instance.registerCommand(warpCommand);
+ }
+
+ /**
+ * Get a command by its name
+ * @param name Name of the command
+ * @return WarpCommand with the given name
+ */
+ public WarpCommand getCommand(String name) {
+ for (WarpCommand command : this.commands) {
+ if (command.getCommandName().equalsIgnoreCase(name)) {
+ return command;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get a command by the class it extends from
+ * @param clazz Class to get the command from
+ * @return WarpCommand with the given class
+ */
+ public WarpCommand getCommand(Class<? extends WarpCommand> clazz) {
+ for (WarpCommand command : this.commands) {
+ if (command.getClass() == clazz) {
+ return command;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Register all commands
+ */
+ private void registerCommands() {
+ registerCommand(new WarpCommand("deep", "deep"));
+ registerCommand(new WarpCommand("nether", "nether"));
+ registerCommand(new WarpCommand("isle", "isle"));
+ registerCommand(new WarpCommand("crimson", "crimson"));
+ registerCommand(new WarpCommand("mines", "mines"));
+ registerCommand(new WarpCommand("forge", "forge"));
+ registerCommand(new WarpCommand("crystals", "crystals"));
+ registerCommand(new WarpCommand("gold", "gold"));
+ registerCommand(new WarpCommand("desert", "desert"));
+ registerCommand(new WarpCommand("spider", "spider"));
+ registerCommand(new WarpCommand("barn", "barn"));
+ registerCommand(new WarpCommand("end", "end"));
+ registerCommand(new WarpCommand("park", "park"));
+ registerCommand(new WarpCommand("castle", "castle"));
+ registerCommand(new WarpCommand("museum", "museum"));
+ registerCommand(new WarpCommand("da", "da"));
+ registerCommand(new WarpCommand("crypt", "crypt"));
+ registerCommand(new WarpCommand("nest", "nest"));
+ registerCommand(new WarpCommand("void", "void"));
+ registerCommand(new WarpCommand("drag", "dragon"));
+ registerCommand(new WarpCommand("jungle", "jungle"));
+ registerCommand(new WarpCommand("howl", "howl"));
+ registerCommand(new WarpCommand("dun", "dungeon_hub"));
+ }
+
+}