Change ModuleConfig to allow modules to override the migration system

This commit is contained in:
2023-06-08 21:46:12 +02:00
parent 602360a3d8
commit 2fb2d216cb

View File

@@ -107,7 +107,7 @@ public class ModuleConfig {
* *
* @param conf - The config class to load * @param conf - The config class to load
*/ */
private void migrateConfig(ModuleConfig conf) { public void migrateConfig(ModuleConfig conf) {
/* Set up the Serializer and Config Objects */ /* Set up the Serializer and Config Objects */
CommentedFileConfig config = CommentedFileConfig.builder(configPath).build(); CommentedFileConfig config = CommentedFileConfig.builder(configPath).build();
CommentedFileConfig newConfig = CommentedFileConfig.builder(configPath).build(); CommentedFileConfig newConfig = CommentedFileConfig.builder(configPath).build();
@@ -122,7 +122,7 @@ public class ModuleConfig {
newConfig.close(); newConfig.close();
} }
private void updateConfigValues(CommentedConfig oldConfig, CommentedConfig newConfig, CommentedConfig outputConfig, String subKey) { public void updateConfigValues(CommentedConfig oldConfig, CommentedConfig newConfig, CommentedConfig outputConfig, String subKey) {
/* Loop over the config keys and check what has changed */ /* Loop over the config keys and check what has changed */
newConfig.valueMap().forEach((key, value) -> { newConfig.valueMap().forEach((key, value) -> {
String finalKey = subKey + (subKey.isEmpty() ? "" : ".") + key; String finalKey = subKey + (subKey.isEmpty() ? "" : ".") + key;