mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 18:00:33 +08:00
Replace usage of java.util.List.removeIf to Kotlin's MutableList.removeAll
This commit is contained in:
parent
ba61194fa4
commit
7b80ac5a0c
@ -119,7 +119,7 @@ public sealed class CustomMessage : SingleMessage {
|
|||||||
private val factories: ConcurrentLinkedQueue<Factory<*>> = ConcurrentLinkedQueue()
|
private val factories: ConcurrentLinkedQueue<Factory<*>> = ConcurrentLinkedQueue()
|
||||||
|
|
||||||
internal fun register(factory: Factory<out CustomMessage>) {
|
internal fun register(factory: Factory<out CustomMessage>) {
|
||||||
factories.removeIf { it::class == factory::class }
|
factories.removeAll { it::class == factory::class }
|
||||||
val exist = factories.firstOrNull { it.typeName == factory.typeName }
|
val exist = factories.firstOrNull { it.typeName == factory.typeName }
|
||||||
if (exist != null) {
|
if (exist != null) {
|
||||||
error("CustomMessage.Factory typeName ${factory.typeName} is already registered by ${exist::class.qualifiedName}")
|
error("CustomMessage.Factory typeName ${factory.typeName} is already registered by ${exist::class.qualifiedName}")
|
||||||
|
Loading…
Reference in New Issue
Block a user