From 45005ca693c7b43ff7eedd509b0b4a784cedd9f1 Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 20 Aug 2021 20:35:36 +0200 Subject: Clean up fairysouls commands a bit more --- .../notenoughupdates/miscfeatures/FairySouls.java | 137 ++++++++++----------- 1 file changed, 66 insertions(+), 71 deletions(-) (limited to 'src/main/java') 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 found = foundSouls.computeIfAbsent(location, k -> new HashSet<>()); + for(int i=0; i found = foundSouls.computeIfAbsent(location, k -> new HashSet<>()); - for(int i=0; i