Skip to content

Commit ccdb028

Browse files
committed
fix: fixed plugin config migration not finishing migration
1 parent 519b41a commit ccdb028

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/main/kotlin/co/statu/parsek/api/config/PluginConfigManager.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,13 @@ class PluginConfigManager<T : PluginConfig>(
103103
updateConfig(JsonObject(config.root().unwrapped()))
104104
}
105105

106-
private fun migrate(configVersion: Int = config.version, saveConfig: Boolean = false) {
106+
private fun migrate(
107+
configAsJsonObject: JsonObject = JsonObject(gson.toJson(config)),
108+
configVersion: Int = config.version,
109+
saveConfig: Boolean = false
110+
) {
107111
logger.info("Checking available config migrations")
108112

109-
val configAsJsonObject = JsonObject(gson.toJson(config))
110-
111113
migrations
112114
.find { configMigration -> configMigration.isMigratable(configVersion) }
113115
?.let { migration ->
@@ -117,7 +119,7 @@ class PluginConfigManager<T : PluginConfig>(
117119

118120
migration.migrate(configAsJsonObject)
119121

120-
migrate(migration.to, true)
122+
migrate(configAsJsonObject, migration.to, true)
121123

122124
return
123125
}

0 commit comments

Comments
 (0)