aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/util/NEUDebugLogger.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/NEUDebugLogger.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/NEUDebugLogger.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/NEUDebugLogger.java b/src/main/java/io/github/moulberry/notenoughupdates/util/NEUDebugLogger.java
new file mode 100644
index 00000000..d662a872
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/NEUDebugLogger.java
@@ -0,0 +1,30 @@
+package io.github.moulberry.notenoughupdates.util;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.options.customtypes.NEUDebugFlag;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.function.Consumer;
+
+public class NEUDebugLogger {
+ private static final Minecraft mc = Minecraft.getMinecraft();
+ public static Consumer<String> logMethod = NEUDebugLogger::chatLogger;
+
+ private static void chatLogger(String message) {
+ mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU DEBUG] " + message));
+ }
+
+ public static boolean isFlagEnabled(NEUDebugFlag flag) {
+ return NotEnoughUpdates.INSTANCE.config.hidden.debugFlags.contains(flag);
+ }
+
+ public static void log(NEUDebugFlag flag, String message) {
+ if (logMethod != null && isFlagEnabled(flag)) {
+ logMethod.accept(message);
+ }
+ }
+}