aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/neodymium/util/WarningHelper.java
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2023-05-16 23:06:06 +0200
committermakamys <makamys@outlook.com>2023-05-16 23:39:39 +0200
commita2c230a4bf3659c99af90ecd5eeeab8e6d32c478 (patch)
tree8d1b02e35d4a674a08c2c29306f133f4e31ef1f7 /src/main/java/makamys/neodymium/util/WarningHelper.java
parent2a226d6b9ea7a8fdea6e1922f9c3646277d5a1d4 (diff)
downloadNeodymium-a2c230a4bf3659c99af90ecd5eeeab8e6d32c478.tar.gz
Neodymium-a2c230a4bf3659c99af90ecd5eeeab8e6d32c478.tar.bz2
Neodymium-a2c230a4bf3659c99af90ecd5eeeab8e6d32c478.zip
Only show warning once per session
Diffstat (limited to 'src/main/java/makamys/neodymium/util/WarningHelper.java')
-rw-r--r--src/main/java/makamys/neodymium/util/WarningHelper.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/makamys/neodymium/util/WarningHelper.java b/src/main/java/makamys/neodymium/util/WarningHelper.java
new file mode 100644
index 0000000..1204aef
--- /dev/null
+++ b/src/main/java/makamys/neodymium/util/WarningHelper.java
@@ -0,0 +1,24 @@
+package makamys.neodymium.util;
+
+import static makamys.neodymium.Constants.LOGGER;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class WarningHelper {
+
+ private static Set<Integer> shownWarnings = new HashSet<>();
+
+ public static void showDebugMessageOnce(String warning) {
+ int hash = warning.hashCode();
+ if(!shownWarnings.contains(hash)) {
+ LOGGER.debug(warning);
+ shownWarnings.add(hash);
+ }
+ }
+
+ public static void reset() {
+ shownWarnings.clear();
+ }
+
+}