diff options
author | Cow <cow@volloeko.de> | 2023-07-23 18:33:18 +0200 |
---|---|---|
committer | Cow <cow@volloeko.de> | 2023-07-23 18:33:18 +0200 |
commit | 799046f0ff32a43956dc2f46df9ae5707d9dcfbf (patch) | |
tree | bfbb9b362f5d3054f0f39e413eccf71f98771b04 /src/main/java/de/cowtipper/cowlection/command/MooCommand.java | |
parent | b039b737e57be6c16b8170edbf0eee894c8c30dd (diff) | |
download | Cowlection-799046f0ff32a43956dc2f46df9ae5707d9dcfbf.tar.gz Cowlection-799046f0ff32a43956dc2f46df9ae5707d9dcfbf.tar.bz2 Cowlection-799046f0ff32a43956dc2f46df9ae5707d9dcfbf.zip |
Added 2nd parameter to `/moo directory` to open config or mods directory
Diffstat (limited to 'src/main/java/de/cowtipper/cowlection/command/MooCommand.java')
-rw-r--r-- | src/main/java/de/cowtipper/cowlection/command/MooCommand.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/command/MooCommand.java b/src/main/java/de/cowtipper/cowlection/command/MooCommand.java index ae79603..f0a9c6c 100644 --- a/src/main/java/de/cowtipper/cowlection/command/MooCommand.java +++ b/src/main/java/de/cowtipper/cowlection/command/MooCommand.java @@ -172,8 +172,22 @@ public class MooCommand extends CommandBase { } else if (args[0].equalsIgnoreCase("version")) { main.getVersionChecker().handleVersionStatus(true); } else if (args[0].equalsIgnoreCase("directory") || args[0].equalsIgnoreCase("folder")) { + File directory = null; + if (args.length > 1) { + if (args[1].startsWith("c")) { + directory = main.getConfigDirectory(); + } else if (args[1].startsWith("m")) { + directory = main.getModsDirectory(); + } + } + if (directory == null) { + main.getChatHelper().sendMessage(new MooChatComponent("[§2Cowlection§a] open directory:").green() + .appendFreshSibling(new MooChatComponent(" §6➊ §a/config/cowlection/").setSuggestCommand("/" + getCommandName() + " directory config")) + .appendFreshSibling(new MooChatComponent(" §6➋ §a/mods/").setSuggestCommand("/" + getCommandName() + " directory mods"))); + return; + } try { - Desktop.getDesktop().open(main.getModsDirectory()); + Desktop.getDesktop().open(directory); } catch (IOException e) { e.printStackTrace(); throw new MooCommandException("✖ An error occurred trying to open the mod's directory. I guess you have to open it manually ¯\\_(ツ)_/¯"); @@ -1021,7 +1035,7 @@ public class MooCommand extends CommandBase { .appendSibling(createCmdHelpEntry("update", "Check for new mod updates")) .appendSibling(createCmdHelpEntry("updateHelp", "Show mod update instructions")) .appendSibling(createCmdHelpEntry("version", "View results of last mod update check")) - .appendSibling(createCmdHelpEntry("directory", "Open Minecraft's mods directory")); + .appendSibling(createCmdHelpEntry("directory", "Open Minecraft's 'mods' or Cowlection's 'config' directory")); if (main.getFriendsHandler().getBestFriendsListSize() > 0) { usage.appendSibling(createCmdHelpEntry("bestfriends", "§dMigrate best friends list")); } @@ -1067,6 +1081,8 @@ public class MooCommand extends CommandBase { return getListOfStringsMatchingLastWord(args, "off", "on", "disable", "enable"); } else if (args.length == 2 && (args[0].equalsIgnoreCase("chestAnalyzer") || args[0].equalsIgnoreCase("chestAnalyser") || args[0].equalsIgnoreCase("analyzeChests") || args[0].equalsIgnoreCase("analyseChests"))) { return getListOfStringsMatchingLastWord(args, "stop"); + } else if (args.length == 2 && (args[0].equalsIgnoreCase("directory") || args[0].equalsIgnoreCase("folder"))) { + return getListOfStringsMatchingLastWord(args, "config", "mods"); } String commandArg = args[0].toLowerCase(); if (args.length == 2 && (commandArg.equals("s") || commandArg.equals("ss") || commandArg.contains("stalk") || commandArg.contains("askpolitely"))) { // stalk & stalkskyblock |