make plugin more correctly serializable

This commit is contained in:
InsanusMokrassar 2021-02-18 00:38:18 +06:00
parent d3d5e70818
commit ceb60e3c6a

View File

@ -45,7 +45,9 @@ object PluginSerializer : KSerializer<Plugin> {
}
}
@InternalSerializationApi
override fun serialize(encoder: Encoder, value: Plugin) {
polymorphic.serialize(encoder, value)
val serializer = (value::class.serializerOrNull() ?: polymorphic) as KSerializer<Plugin>
serializer.serialize(encoder, value)
}
}