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:
@@ -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) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user