Skip to content

Commit a0fbe9a

Browse files
committed
fix subconfigs dying
1 parent 2c42a22 commit a0fbe9a

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/main/java/cc/polyfrost/oneconfig/config/Config.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ public void reInitialize() {
154154
* Save current config to file
155155
*/
156156
public void save() {
157+
if (this instanceof cc.polyfrost.oneconfig.config.elements.SubConfig) {
158+
Mod mod = ConfigCore.getParentMod(this.mod);
159+
if (mod == null) return;
160+
mod.config.save();
161+
return;
162+
}
157163
logger.trace("Saving config for {}...", mod.name);
158164

159165
Path profilePath = ConfigUtils.getProfileFile(configFile).toPath();

src/main/java/cc/polyfrost/oneconfig/internal/config/core/ConfigCore.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,4 @@ public static Mod getParentMod(Mod mod) {
7575
}
7676
return null;
7777
}
78-
79-
static {
80-
Executors.newSingleThreadScheduledExecutor()
81-
.scheduleAtFixedRate(
82-
ConfigCore::saveAll,
83-
0,
84-
60,
85-
TimeUnit.SECONDS
86-
);
87-
}
8878
}

0 commit comments

Comments
 (0)