diff --git a/uranos-server/src/main/kotlin/space/uranos/net/PacketsAdapter.kt b/uranos-server/src/main/kotlin/space/uranos/net/PacketsAdapter.kt index f6739c8..b0d24a7 100644 --- a/uranos-server/src/main/kotlin/space/uranos/net/PacketsAdapter.kt +++ b/uranos-server/src/main/kotlin/space/uranos/net/PacketsAdapter.kt @@ -22,8 +22,8 @@ import space.uranos.util.awaitSuspending class PacketsAdapter(val session: UranosSession) { private val packetsForNextTick = ArrayList() - suspend fun tick() { - packetsForNextTick.forEach { send(it) } // TODO: Fix ConcurrentModificationException + suspend fun tick() = withContext(session.coroutineContext) { + packetsForNextTick.forEach { send(it) } packetsForNextTick.clear() }