aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColour.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColour.java')
-rw-r--r--src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColour.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColour.java b/src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColour.java
new file mode 100644
index 0000000..f80e0f4
--- /dev/null
+++ b/src/main/java/net/inyourwalls/customlevelcolour/CustomLevelColour.java
@@ -0,0 +1,30 @@
+package net.inyourwalls.customlevelcolour;
+
+import net.fabricmc.api.ClientModInitializer;
+import net.fabricmc.loader.api.FabricLoader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.nio.file.Path;
+
+public class CustomLevelColour implements ClientModInitializer {
+ public static final Logger LOGGER = LoggerFactory.getLogger(CustomLevelColour.class);
+ private static final Path CONFIG_PATH = FabricLoader.getInstance().getConfigDir().resolve("customlevelcolour.json");
+ private static CustomLevelColourConfig config;
+
+ @Override
+ public void onInitializeClient() {
+ try {
+ config = CustomLevelColourConfig.load(CONFIG_PATH);
+ } catch (IOException ex) {
+ LOGGER.debug("Failed to load config", ex);
+ config = new CustomLevelColourConfig();
+ }
+ }
+
+ public static CustomLevelColourConfig getConfig() {
+ if (config == null) throw new IllegalStateException("Attempted to get the configuration before it was loaded");
+ return config;
+ }
+}