More logical event broadcasting

This commit is contained in:
Him188 2019-12-30 23:10:09 +08:00
parent 1ff206a420
commit 3c818dad9f

View File

@ -221,9 +221,14 @@ internal class TIMPCBotNetworkHandler internal constructor(coroutineContext: Cor
} }
} }
when (packet) { if (packet is Subscribable) {
is Cancellable /* Cancellable : Subscribable */ -> if ((packet as Cancellable).broadcast().cancelled) return if (packet is BroadcastControllable) {
is Subscribable -> if ((packet as? BroadcastControllable)?.shouldBroadcast != false) packet.broadcast() if (packet.shouldBroadcast) packet.broadcast()
} else {
packet.broadcast()
}
if (packet is Cancellable && packet.cancelled) return
} }
temporaryPacketHandlers.forEach { temporaryPacketHandlers.forEach {