From 799046f0ff32a43956dc2f46df9ae5707d9dcfbf Mon Sep 17 00:00:00 2001 From: Cow Date: Sun, 23 Jul 2023 18:33:18 +0200 Subject: Added 2nd parameter to `/moo directory` to open config or mods directory --- CHANGELOG.md | 1 + .../java/de/cowtipper/cowlection/Cowlection.java | 7 ++++++- .../de/cowtipper/cowlection/command/MooCommand.java | 20 ++++++++++++++++++-- .../de/cowtipper/cowlection/data/DataHelper.java | 1 - 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35a8879..bd4405e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ All other features *do not* require an API key and thus should be unaffected by - Dungeons overlay: now disabled by default (old config entries aren't modified) - SkyBlock player lookup: removed 'last played/last profile save' as it's no longer part of the API - Analyze island: added new Minion (Vampire) and updated texture IDs for minions that previously erroneously shared the same skin +- `/moo directory`: added 2nd parameter to open either `/config/cowlection` or `/mods/` directory - some Hypixel API related changes regarding API key validation ## [1.8.9-0.15.1] - 22.12.2022 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 getMinions() { // key = skin id, value = minion type and tier Map 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)); -- cgit