aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/neodymium/util/WarningHelper.java
blob: 1204aeff402f92af57bb819333cec860de04ba3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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();
    }
    
}