diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/ConfigModules.java b/leaf-server/src/main/java/org/dreeam/leaf/config/ConfigModules.java index 8df9a5c5..0a030cfa 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/config/ConfigModules.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/config/ConfigModules.java @@ -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 getAnnotatedStaticFields(Class clazz, Class annotation) { diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/LeafConfig.java b/leaf-server/src/main/java/org/dreeam/leaf/config/LeafConfig.java index 2d868c62..230e6b77 100644 --- a/leaf-server/src/main/java/org/dreeam/leaf/config/LeafConfig.java +++ b/leaf-server/src/main/java/org/dreeam/leaf/config/LeafConfig.java @@ -58,6 +58,7 @@ public class LeafConfig { /* Load & Reload */ + // Reload config (async) public static @NotNull CompletableFuture 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() {