aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures
diff options
context:
space:
mode:
authorRoman / Linnea Gräf <roman.graef@gmail.com>2023-03-04 02:54:50 +0100
committerGitHub <noreply@github.com>2023-03-04 12:54:50 +1100
commit5dd063fbba6bde64806a7620541dc2d9bdf42871 (patch)
tree01aee1a743a32a0b2546513c59a43559ce3085fe /src/main/java/io/github/moulberry/notenoughupdates/miscfeatures
parentdb86c98e0c72b18663ef26cd46cef7d53c1d6414 (diff)
downloadnotenoughupdates-5dd063fbba6bde64806a7620541dc2d9bdf42871.tar.gz
notenoughupdates-5dd063fbba6bde64806a7620541dc2d9bdf42871.tar.bz2
notenoughupdates-5dd063fbba6bde64806a7620541dc2d9bdf42871.zip
Replace all commands in NEU with a brigadier implementation (#599)
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java80
1 files changed, 8 insertions, 72 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 5a611178..97aa25d4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java
@@ -26,7 +26,6 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
-import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import io.github.moulberry.notenoughupdates.util.Constants;
@@ -34,8 +33,6 @@ import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Utils;
import lombok.var;
import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
-import net.minecraft.command.ICommandSender;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
@@ -56,7 +53,6 @@ import java.io.OutputStreamWriter;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -87,6 +83,14 @@ public class FairySouls {
return instance;
}
+ public boolean isTrackSouls() {
+ return trackSouls;
+ }
+
+ public boolean isShowSouls() {
+ return showSouls;
+ }
+
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
currentLocation = null;
@@ -379,25 +383,6 @@ public class FairySouls {
Utils.addChatMessage(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 showing waypoint markers");
- print(EnumChatFormatting.YELLOW +
- "/neusouls clear/unclear - Marks every waypoint in your current world as completed/uncompleted");
- print("");
- }
-
@SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true)
public void onChatReceived(ClientChatReceivedEvent event) {
if (!trackSouls || event.type == 2) return;
@@ -407,53 +392,4 @@ public class FairySouls {
markClosestSoulFound();
}
}
-
- public static class FairySoulsCommand extends ClientCommandBase {
- public FairySoulsCommand() {
- super("neusouls");
- }
-
- @Override
- public List<String> getCommandAliases() {
- return Collections.singletonList("fairysouls");
- }
-
- @Override
- public void processCommand(ICommandSender sender, String[] args) throws CommandException {
- if (args.length != 1) {
- printHelp();
- return;
- }
-
- String subcommand = args[0].toLowerCase();
- switch (subcommand) {
- case "help":
- printHelp();
- break;
- case "on":
- case "enable":
- if (!FairySouls.instance.trackSouls) {
- print(
- EnumChatFormatting.RED + "Fairy soul tracking is off, enable it using /neu before using this command");
- return;
- }
- print(EnumChatFormatting.DARK_PURPLE + "Enabled fairy soul waypoints");
- FairySouls.getInstance().setShowFairySouls(true);
- break;
- case "off":
- case "disable":
- FairySouls.getInstance().setShowFairySouls(false);
- print(EnumChatFormatting.DARK_PURPLE + "Disabled fairy soul waypoints");
- break;
- case "clear":
- FairySouls.getInstance().markAllAsFound();
- break;
- case "unclear":
- FairySouls.getInstance().markAllAsMissing();
- break;
- default:
- print(EnumChatFormatting.RED + "Unknown subcommand: " + subcommand);
- }
- }
- }
}