From 03eb1c64fce49454fa1cf90be015fa0be7064a57 Mon Sep 17 00:00:00 2001 From: "Erymanthus[#5074] | (u/)RayDeeUx" <51521765+RayDeeUx@users.noreply.github.com> Date: Fri, 20 Oct 2023 09:57:01 -0400 Subject: Feature: Per #400, add command alias "dungeonsguide". Also added "dungeonguide" since everyone keeps forgetting plural (#428) * add alias per #400 * add alias per #400 (attempt #2) * add another alias * revise arraylist initalization * intellij is saying this import is unused. removed it * add justifications for aliases * swap "dg" and "dungeonsguide" * Revert "swap "dg" and "dungeonsguide"" This reverts commit 2ddbaf8f58d5d7937389909d96d5797c76c16639. * swap "dg" and "dungeonsguide" (for real this time) --- .../mod/commands/CommandDungeonsGuide.java | 29 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'mod/src/main/java') diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java index 74846206..1ea1cee1 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java @@ -49,6 +49,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.json.JSONObject; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -56,12 +57,25 @@ public class CommandDungeonsGuide extends CommandBase { @Override public String getCommandName() { - return "dg"; + return "dungeonsguide"; } @Override public String getCommandUsage(ICommandSender sender) { - return "dg"; + return "dungeonsguide"; + } + + @Override + public List getCommandAliases() { + return new ArrayList() {{ + add("dg"); //per issue #400 + add("dungeonguide"); //because people keep saying "dungeon guide" the singular + add("deegee"); //in case another mod/server somehow uses a command "/dg" and no one wants to type out the entire name "dungeonsguide" + add("던전가이드"); //easter egg + add("던전안내"); //easter egg + // for each new alias, make a new line, then: add("[INSERT YOUR ALIAS HERE]"); + // Shoutout to coobird for the anonymous inner class idea: stackoverflow.com/a/1005083 + }}; } //List of subcommands for tab support @@ -76,7 +90,8 @@ public class CommandDungeonsGuide extends CommandBase { "purge", "pbroadcast", "partymax", - "unload" + "unload", + "aliases" }; @Override @@ -133,6 +148,14 @@ public class CommandDungeonsGuide extends CommandBase { unloadCommand(); break; + + case "aliases": + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide aliases§7::")); + ChatTransmitter.addToQueue(new ChatComponentText(" §7- §e/dungeonsguide")); + ChatTransmitter.addToQueue(new ChatComponentText(" §7- §e/dungeonguide")); + ChatTransmitter.addToQueue(new ChatComponentText(" §7- §e/deegee")); + break; + default: ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui")); ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §e/dg gui §7-§fOpens configuration gui")); -- cgit