Packets

object Packets : Listener

Central singleton for managing packet interception, player injection, and global packet handlers.

Must be initialized via init before use. Automatically injects and removes players on join/quit events.

Types

Link copied to clipboard

Default NetworkSettings implementation used when no version-specific one is available.

Link copied to clipboard
class PacketHandler(val player: Player) : ChannelDuplexHandler

Netty ChannelDuplexHandler that intercepts inbound and outbound packets for a player.

Functions

Link copied to clipboard
Link copied to clipboard
fun getNetworkSettings(player: Player): NetworkSettings
Link copied to clipboard
fun init(plugin: Plugin)

Initializes the packet system, registers Bukkit events, and injects all online players.

Link copied to clipboard
fun onJoin(event: PlayerJoinEvent)
Link copied to clipboard
fun onPacket(player: Player, handler: PacketEvent.() -> Unit)

Subscribes to all packet events (both sent and received) for the given player.

Link copied to clipboard
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).

Link copied to clipboard
fun onQuit(event: PlayerQuitEvent)
Link copied to clipboard
fun removePlayer(player: Player)