diff options
author | DoKM <mcazzyman@gmail.com> | 2021-08-20 20:35:36 +0200 |
---|---|---|
committer | DoKM <mcazzyman@gmail.com> | 2021-08-20 20:35:36 +0200 |
commit | 45005ca693c7b43ff7eedd509b0b4a784cedd9f1 (patch) | |
tree | f8ffd15cd1184b35330b9a4e8ac5575db2ca1259 /src/main | |
parent | bb2583030b8230e46358c85c342335a82ee91039 (diff) | |
download | NotEnoughUpdates-45005ca693c7b43ff7eedd509b0b4a784cedd9f1.tar.gz NotEnoughUpdates-45005ca693c7b43ff7eedd509b0b4a784cedd9f1.tar.bz2 NotEnoughUpdates-45005ca693c7b43ff7eedd509b0b4a784cedd9f1.zip |
Clean up fairysouls commands a bit more
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java | 137 |
1 files changed, 66 insertions, 71 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java index 28b03f52..05591e81 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java @@ -296,90 +296,85 @@ public class FairySouls { public static class FairySoulsCommandAlt extends SimpleCommand { public FairySoulsCommandAlt() { - super("fairysouls", new ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/neusouls"); - } - } - ); + super("fairysouls", fairysoulRunnable); } } public static class FairySoulsCommand extends SimpleCommand { public FairySoulsCommand() { - super("neusouls", new ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - if(args.length != 1) { - printHelp(); - return; + super("neusouls", fairysoulRunnable); + } + } + + private static SimpleCommand.ProcessCommandRunnable fairysoulRunnable = new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + if(args.length != 1) { + printHelp(); + return; + } + String subcommand = args[0].toLowerCase(); + + switch (subcommand) { + case "help": + printHelp(); + return; + case "on": + case "enable": + print(EnumChatFormatting.DARK_PURPLE+"Enabled fairy soul waypoints"); + enabled = true; + return; + case "off": + case "disable": + print(EnumChatFormatting.DARK_PURPLE+"Disabled fairy soul waypoints"); + enabled = false; + return; + case "clear": { + String location = SBInfo.getInstance().getLocation(); + if(currentSoulList == null || location == null) { + print(EnumChatFormatting.RED+"No fairy souls found in your current world"); + } else { + Set<Integer> found = foundSouls.computeIfAbsent(location, k -> new HashSet<>()); + for(int i=0; i<currentSoulList.size(); i++) { + found.add(i); + } + print(EnumChatFormatting.DARK_PURPLE+"Marked all fairy souls as found"); } - String subcommand = args[0].toLowerCase(); - - switch (subcommand) { - case "help": - printHelp(); - return; - case "on": - case "enable": - print(EnumChatFormatting.DARK_PURPLE+"Enabled fairy soul waypoints"); - enabled = true; - return; - case "off": - case "disable": - print(EnumChatFormatting.DARK_PURPLE+"Disabled fairy soul waypoints"); - enabled = false; - return; - case "clear": { - String location = SBInfo.getInstance().getLocation(); - if(currentSoulList == null || location == null) { - print(EnumChatFormatting.RED+"No fairy souls found in your current world"); - } else { - Set<Integer> found = foundSouls.computeIfAbsent(location, k -> new HashSet<>()); - for(int i=0; i<currentSoulList.size(); i++) { - found.add(i); - } - print(EnumChatFormatting.DARK_PURPLE+"Marked all fairy souls as found"); - } - } - return; - case "unclear": - String location = SBInfo.getInstance().getLocation(); - if(location == null) { - print(EnumChatFormatting.RED+"No fairy souls found in your current world"); - } else { - print(EnumChatFormatting.DARK_PURPLE+"Marked all fairy souls as not found"); - foundSouls.remove(location); - } - return; + } + return; + case "unclear": + String location = SBInfo.getInstance().getLocation(); + if(location == null) { + print(EnumChatFormatting.RED+"No fairy souls found in your current world"); + } else { + print(EnumChatFormatting.DARK_PURPLE+"Marked all fairy souls as not found"); + foundSouls.remove(location); } + return; + } - print(EnumChatFormatting.RED+"Unknown subcommand: " + subcommand); - } - }); + print(EnumChatFormatting.RED+"Unknown subcommand: " + subcommand); } + }; - private static void print(String s) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(s)); - } + private static void print(String s) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(s)); + } - private static void printHelp() { - print(""); - print(EnumChatFormatting.DARK_PURPLE.toString()+EnumChatFormatting.BOLD+" NEU Fairy Soul Waypoint Guide"); - print(EnumChatFormatting.LIGHT_PURPLE+"Shows waypoints for every fairy soul in your world"); - print(EnumChatFormatting.LIGHT_PURPLE+"Clicking a fairy soul automatically removes it from the list"); - if(!NotEnoughUpdates.INSTANCE.config.hidden.dev) { - print(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.OBFUSCATED + "Ab" + EnumChatFormatting.RESET + EnumChatFormatting.DARK_RED + "!" + EnumChatFormatting.RESET + EnumChatFormatting.RED + " This feature cannot and will not work in Dungeons. " + EnumChatFormatting.DARK_RED + "!" + EnumChatFormatting.OBFUSCATED + "Ab"); - } - print(EnumChatFormatting.GOLD.toString()+EnumChatFormatting.BOLD+" Commands:"); - print(EnumChatFormatting.YELLOW+"/neusouls help - Display this message"); - print(EnumChatFormatting.YELLOW+"/neusouls on/off - Enable/disable the waypoint markers"); - print(EnumChatFormatting.YELLOW+"/neusouls clear/unclear - Marks every waypoint in your current world as completed/uncompleted"); - print(""); + private static void printHelp() { + print(""); + print(EnumChatFormatting.DARK_PURPLE.toString()+EnumChatFormatting.BOLD+" NEU Fairy Soul Waypoint Guide"); + print(EnumChatFormatting.LIGHT_PURPLE+"Shows waypoints for every fairy soul in your world"); + print(EnumChatFormatting.LIGHT_PURPLE+"Clicking a fairy soul automatically removes it from the list"); + if(!NotEnoughUpdates.INSTANCE.config.hidden.dev) { + print(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.OBFUSCATED + "Ab" + EnumChatFormatting.RESET + EnumChatFormatting.DARK_RED + "!" + EnumChatFormatting.RESET + EnumChatFormatting.RED + " This feature cannot and will not work in Dungeons. " + EnumChatFormatting.DARK_RED + "!" + EnumChatFormatting.OBFUSCATED + "Ab"); } - + print(EnumChatFormatting.GOLD.toString()+EnumChatFormatting.BOLD+" Commands:"); + print(EnumChatFormatting.YELLOW+"/neusouls help - Display this message"); + print(EnumChatFormatting.YELLOW+"/neusouls on/off - Enable/disable the waypoint markers"); + print(EnumChatFormatting.YELLOW+"/neusouls clear/unclear - Marks every waypoint in your current world as completed/uncompleted"); + print(""); } } |