on

inline fun <T : Event> Plugin.on(priority: EventPriority = EventPriority.NORMAL, ignoreCancelled: Boolean = false, noinline block: EventBuilder<T>.() -> Unit): EventBuilder<T>

Defines an event listener using a DSL.

Example usage:

on<PlayerJoinEvent> {
filter { player.isOp }
handle {
player.sendMessage("Welcome, OP!")
}
}

Return

The EventBuilder instance.

Parameters

T

The type of the event.

priority

The priority of the event listener.

ignoreCancelled

Whether to ignore cancelled events.

block

The builder block.