This commit is contained in:
2023-05-04 21:18:04 +08:00
parent 4b65a2459b
commit f971211e33
34 changed files with 90 additions and 87 deletions
@@ -4,6 +4,7 @@ import cc.maxmc.msm.common.event.ChannelActiveEvent
import cc.maxmc.msm.common.event.ChannelInactiveEvent
import cc.maxmc.msm.common.event.PacketReceiveEvent
import cc.maxmc.msm.common.utils.awaiting
import cc.maxmc.msm.common.utils.log
import io.netty.channel.ChannelHandler.Sharable
import io.netty.channel.ChannelHandlerContext
import io.netty.channel.SimpleChannelInboundHandler
@@ -12,9 +13,7 @@ import kotlin.coroutines.resume
@Sharable
object ClusterPacketHandler : SimpleChannelInboundHandler<BungeePacket>() {
override fun channelRead0(ctx: ChannelHandlerContext, msg: BungeePacket) {
awaiting.filter { it.first == msg::class.java }
.filter { it.second(ctx.channel(), msg) }
.forEach {
awaiting.filter { it.first == msg::class.java }.filter { it.second(ctx.channel(), msg) }.forEach {
it.third.resume(msg)
}
PacketReceiveEvent(ctx.channel(), msg).callEvent()