From 97a75485fa125b37c27ffd53ac1c4fbc875a7b40 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Wed, 10 Aug 2022 12:47:30 +0200 Subject: Profile fix (#89) * e * omg finish profile shit * api and fix 1.12.2 preprocess * fix class names * fix compat mode profile stuff * api --- src/main/java/cc/polyfrost/oneconfig/config/Config.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/main/java/cc/polyfrost/oneconfig/config') diff --git a/src/main/java/cc/polyfrost/oneconfig/config/Config.java b/src/main/java/cc/polyfrost/oneconfig/config/Config.java index 0f74b31..7c3b7ed 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/Config.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/Config.java @@ -68,7 +68,6 @@ public class Config { transient protected final Gson nonProfileSpecificGson = new GsonBuilder().setExclusionStrategies(new NonProfileSpecificExclusionStrategy()).excludeFieldsWithModifiers(Modifier.TRANSIENT).setPrettyPrinting().create(); transient protected final HashMap defaults = new HashMap<>(); transient public Mod mod; - public transient boolean hasBeenInitialized = false; public boolean enabled; /** @@ -93,14 +92,17 @@ public class Config { public void initialize() { boolean migrate = false; if (Profiles.getProfileFile(configFile).exists()) load(); - else if (!hasBeenInitialized && mod.migrator != null) migrate = true; + else if (mod.migrator != null) migrate = true; else save(); - if (hasBeenInitialized) return; mod.config = this; generateOptionList(this, mod.defaultPage, mod, migrate); if (migrate) save(); ConfigCore.mods.add(mod); - hasBeenInitialized = true; + } + + public void reInitialize() { + if (Profiles.getProfileFile(configFile).exists()) load(); + else save(); } /** @@ -382,4 +384,11 @@ public class Config { option.reset(this); } } + + /** + * @return If this mod supports profiles, false for compatibility mode + */ + public boolean supportsProfiles() { + return true; + } } -- cgit