Changes migrator to ensure old-style configuration is used during migration
All checks were successful
KnarCraft/KnarLib/pipeline/head This commit looks good

This commit is contained in:
2025-09-05 20:56:29 +02:00
parent 49cc4183da
commit 9d46a8398b

View File

@@ -75,7 +75,15 @@ public final class ConfigHelper {
//Load old and new configuration
plugin.reloadConfig();
FileConfiguration oldConfiguration = plugin.getConfig();
FileConfiguration oldConfiguration;
try {
oldConfiguration = new YamlConfiguration();
oldConfiguration.load(new File(dataFolder, CONFIG_FILE));
} catch (IOException | InvalidConfigurationException exception) {
plugin.getLogger().log(Level.WARNING, "Unable to load old configuration and do migration");
return false;
}
InputStream configStream = FileHelper.getInputStreamForInternalFile("/" + CONFIG_FILE);
if (configStream == null) {
plugin.getLogger().log(Level.SEVERE, "Could not migrate the configuration, as the internal " +