diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt index d29089c53..85a678d7b 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt @@ -119,7 +119,7 @@ public sealed class CustomMessage : SingleMessage { private val factories: ConcurrentLinkedQueue> = ConcurrentLinkedQueue() internal fun register(factory: Factory) { - factories.removeIf { it::class == factory::class } + factories.removeAll { it::class == factory::class } val exist = factories.firstOrNull { it.typeName == factory.typeName } if (exist != null) { error("CustomMessage.Factory typeName ${factory.typeName} is already registered by ${exist::class.qualifiedName}")