diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/ValueName.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/ValueName.kt index 9a5694b52..957902e49 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/ValueName.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/ValueName.kt @@ -14,7 +14,6 @@ package net.mamoe.mirai.console.data * * 例: * ``` - * @ValueName("accounts") * object AccountPluginData : PluginData by ... { * @ValueName("info") * val map: Map by value("a" to "b") @@ -23,7 +22,7 @@ package net.mamoe.mirai.console.data * * 将被保存为配置 (YAML 作为示例): * ```yaml - * accounts: + * AccountPluginData: * info: * a: b * ``` diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/CompositeValueImpl.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/CompositeValueImpl.kt index 10fcfea07..c45d135ab 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/CompositeValueImpl.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/CompositeValueImpl.kt @@ -188,7 +188,8 @@ internal fun MutableMap.patchImpl(_new: Map) { } internal fun , E> C.patchImpl(_new: Collection) { - this.retainAll(_new) + this.clear() + this.addAll(_new) } /** diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/MultiFilePluginDataStorageImpl.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/MultiFilePluginDataStorageImpl.kt index cd6816c4b..87c39b4db 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/MultiFilePluginDataStorageImpl.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/MultiFilePluginDataStorageImpl.kt @@ -18,6 +18,7 @@ import net.mamoe.mirai.console.util.ConsoleExperimentalAPI import net.mamoe.mirai.utils.MiraiLogger import net.mamoe.mirai.utils.SilentLogger import net.mamoe.mirai.utils.debug +import net.mamoe.mirai.utils.warning import net.mamoe.yamlkt.Yaml import java.io.File import java.nio.file.Path @@ -36,6 +37,7 @@ internal open class MultiFilePluginDataStorageImpl( val text = getPluginDataFile(holder, instance).readText() if (text.isNotBlank()) { + logger.warning { "Deserializing $text" } Yaml.default.decodeFromString(instance.updaterSerializer, text) } else { this.store(holder, instance) // save an initial copy