onPacketAsync

inline fun <T> onPacketAsync(player: Player, crossinline handler: suspend PacketEvent.(T) -> Unit)

Subscribes to packet events of type T for the given player and handles them asynchronously on the player's Netty event-loop dispatcher (falls back to Dispatchers.Default).

Parameters

player

The player to observe.

handler

Suspend function called with the typed packet as argument.

Type Parameters

T

The packet type to listen for.