[BUG] Use Sync config loading, so config doesn't parse before it's loaded

This commit is contained in:
2024-08-30 16:10:33 +02:00
parent fcc1c816e7
commit c808f53841
4 changed files with 4 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ import java.io.File;
* Base Config class containing the save, upgrading and loading logic. * Base Config class containing the save, upgrading and loading logic.
* All config classes must extend this class * All config classes must extend this class
*/ */
@Deprecated @Deprecated(forRemoval = true, since = "2.1.0")
public class ModuleConfig extends AbstractConfig { public class ModuleConfig extends AbstractConfig {
/** /**

View File

@@ -26,7 +26,7 @@ public class JsonConfigFormat<S> extends AbstractConfigFormat<S> {
public S readConfig(S conf) { public S readConfig(S conf) {
/* Set up the Serializer and Config Object */ /* Set up the Serializer and Config Object */
ObjectConverter converter = new ObjectConverter(); ObjectConverter converter = new ObjectConverter();
FileConfig config = FileConfig.builder(getConfigPath()).build(); FileConfig config = FileConfig.builder(getConfigPath()).sync().build();
config.load(); config.load();
/* Load the config and return the loaded config */ /* Load the config and return the loaded config */

View File

@@ -26,7 +26,7 @@ public class TomlConfigFormat<S> extends AbstractConfigFormat<S> {
public S readConfig(S conf) { public S readConfig(S conf) {
/* Set up the Serializer and Config Object */ /* Set up the Serializer and Config Object */
ObjectConverter converter = new ObjectConverter(); ObjectConverter converter = new ObjectConverter();
CommentedFileConfig config = CommentedFileConfig.builder(getConfigPath()).build(); CommentedFileConfig config = CommentedFileConfig.builder(getConfigPath()).sync().build();
config.load(); config.load();
/* Load the config and return the loaded config */ /* Load the config and return the loaded config */

View File

@@ -2,7 +2,7 @@
version_major=2 version_major=2
version_minor=1 version_minor=1
version_patch=0 version_patch=0
version_build=0 version_build=1
#Mod #Mod
mod_author=HypherionSA mod_author=HypherionSA