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 | |
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')
3 files changed, 24 insertions, 4 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/Cowlection.java b/src/main/java/de/cowtipper/cowlection/Cowlection.java index 4e9a858..0b0532d 100644 --- a/src/main/java/de/cowtipper/cowlection/Cowlection.java +++ b/src/main/java/de/cowtipper/cowlection/Cowlection.java @@ -41,6 +41,7 @@ public class Cowlection { public static KeyBinding[] keyBindings; private static Cowlection instance; private File modsDir; + private File configDir; private File modOutDir; private MooConfig config; private CredentialStorage moo; @@ -62,7 +63,7 @@ public class Cowlection { chatHelper = new ChatHelper(); - File configDir = new File(e.getModConfigurationDirectory(), MODID + File.separatorChar); + configDir = new File(e.getModConfigurationDirectory(), MODID + File.separatorChar); if (!configDir.exists()) { configDir.mkdirs(); } @@ -168,6 +169,10 @@ public class Cowlection { return modsDir; } + public File getConfigDirectory() { + return configDir; + } + public File getModOutDirectory() { if (!modOutDir.exists() && !modOutDir.mkdirs()) { // dir didn't exist and couldn't be created 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 diff --git a/src/main/java/de/cowtipper/cowlection/data/DataHelper.java b/src/main/java/de/cowtipper/cowlection/data/DataHelper.java index 94f8234..d078373 100644 --- a/src/main/java/de/cowtipper/cowlection/data/DataHelper.java +++ b/src/main/java/de/cowtipper/cowlection/data/DataHelper.java @@ -184,7 +184,6 @@ public final class DataHelper { public static Map<String, Minion> getMinions() { // key = skin id, value = minion type and tier Map<String, Minion> minions = new HashMap<>(); - // TODO currently Fishing VI + VII and Revenant I + XII and Flower XI + XII + Magma Cube XI + XII use the same skull texture (server-side) - thus can't be distinguished minions.put("2f93289a82bd2a06cbbe61b733cfdc1f1bd93c4340f7a90abd9bdda774109071", new Minion("Cobblestone", 1)); minions.put("3fd87486dc94cb8cd04a3d7d06f191f027f38dad7b4ed34c6681fb4d08834c06", new Minion("Cobblestone", 2)); minions.put("cc088ed6bb8763af4eb7d006e00fda7dc11d7681e97c983b7011c3e872f6aab9", new Minion("Cobblestone", 3)); |