aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/config')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/Config.java20
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java9
2 files changed, 7 insertions, 22 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/Config.java b/src/main/java/cc/polyfrost/oneconfig/config/Config.java
index 7ecd4d0..c2661fa 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/Config.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/Config.java
@@ -21,8 +21,6 @@ import cc.polyfrost.oneconfig.internal.config.annotations.Option;
import cc.polyfrost.oneconfig.internal.config.core.ConfigCore;
import cc.polyfrost.oneconfig.internal.config.core.KeyBindHandler;
import cc.polyfrost.oneconfig.utils.JsonUtils;
-import cc.polyfrost.oneconfig.utils.Multithreading;
-import cc.polyfrost.oneconfig.utils.TickDelay;
import cc.polyfrost.oneconfig.utils.gui.GuiUtils;
import com.google.gson.*;
@@ -49,22 +47,13 @@ public class Config {
/**
* @param modData information about the mod
* @param configFile file where config is stored
- * @param initialize whether to initialize the config.
- */
- public Config(Mod modData, String configFile, boolean initialize) {
- this.configFile = configFile;
- Multithreading.runAsync(() -> init(modData)); // wait a bit to give everything time to initialize
- }
-
- /**
- * @param modData information about the mod
- * @param configFile file where config is stored
*/
public Config(Mod modData, String configFile) {
- this(modData, configFile, true);
+ this.configFile = configFile;
+ this.mod = modData;
}
- public void init(Mod mod) {
+ public void initialize() {
boolean migrate = false;
if (Profiles.getProfileFile(configFile).exists()) load();
else if (!hasBeenInitialized && mod.migrator != null) migrate = true;
@@ -72,8 +61,7 @@ public class Config {
mod.config = this;
generateOptionList(this, mod.defaultPage, mod, migrate);
if (migrate) save();
- ConfigCore.oneConfigMods.add(mod);
- this.mod = mod;
+ ConfigCore.mods.add(mod);
hasBeenInitialized = true;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java
index ad148df..1948e0a 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java
@@ -4,9 +4,7 @@ import cc.polyfrost.oneconfig.config.core.ConfigUtils;
import cc.polyfrost.oneconfig.internal.config.core.ConfigCore;
import cc.polyfrost.oneconfig.config.core.OneColor;
import cc.polyfrost.oneconfig.config.data.Mod;
-import cc.polyfrost.oneconfig.config.elements.OptionCategory;
import cc.polyfrost.oneconfig.config.elements.OptionPage;
-import cc.polyfrost.oneconfig.config.elements.OptionSubcategory;
import cc.polyfrost.oneconfig.config.elements.BasicOption;
import cc.polyfrost.oneconfig.config.Config;
import cc.polyfrost.oneconfig.gui.elements.config.*;
@@ -31,16 +29,15 @@ public class VigilanceConfig extends Config {
public VigilanceConfig(Mod modData, String configFile, Vigilant vigilant) {
super(modData, configFile);
this.vigilant = vigilant;
- init(modData);
+ initialize();
}
@Override
- public void init(Mod mod) {
+ public void initialize() {
if (vigilant != null) {
mod.config = this;
generateOptionsList(mod.defaultPage);
- ConfigCore.oneConfigMods.add(mod);
- this.mod = mod;
+ ConfigCore.mods.add(mod);
}
}