9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-26 02:19:19 +00:00

Move leaf config saving after config post load

This commit is contained in:
Dreeam
2025-04-25 13:06:52 -04:00
parent 1a693822bc
commit b17a0b3550
2 changed files with 9 additions and 3 deletions

View File

@@ -46,6 +46,13 @@ public abstract class ConfigModules extends LeafConfig {
for (ConfigModules module : MODULES) {
module.onPostLoaded();
}
// Save config to disk
try {
LeafConfig.config().saveConfig();
} catch (Exception e) {
LeafConfig.LOGGER.error("Failed to save config file!", e);
}
}
private static List<Field> getAnnotatedStaticFields(Class<?> clazz, Class<? extends Annotation> annotation) {

View File

@@ -58,6 +58,7 @@ public class LeafConfig {
/* Load & Reload */
// Reload config (async)
public static @NotNull CompletableFuture<Void> reloadAsync(CommandSender sender) {
return CompletableFuture.runAsync(() -> {
try {
@@ -76,6 +77,7 @@ public class LeafConfig {
}, Util.ioPool());
}
// Init config
public static void loadConfig() {
try {
long begin = System.nanoTime();
@@ -100,9 +102,6 @@ public class LeafConfig {
// Load config modules
ConfigModules.initModules();
// Save config to disk
leafGlobalConfig.saveConfig();
}
public static LeafGlobalConfig config() {