aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/config
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-30 16:01:02 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-30 16:01:02 +0200
commit68a2dfb5a22137fb433531542e8660bae023595f (patch)
treed9b8808db52e1c196e37cd3d3b41bf491cf341d0 /src/main/java/cc/polyfrost/oneconfig/config
parentdcee46d4d0039993466fc7c0e2d0be7b31af3d4b (diff)
downloadOneConfig-68a2dfb5a22137fb433531542e8660bae023595f.tar.gz
OneConfig-68a2dfb5a22137fb433531542e8660bae023595f.tar.bz2
OneConfig-68a2dfb5a22137fb433531542e8660bae023595f.zip
lots of stuff
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);
}
}