onEvent

inline fun <T : Event> Entity.onEvent(plugin: Plugin, crossinline getEntity: T.() -> Entity?, noinline handle: T.() -> Unit)

Registers an event listener for this specific entity. The listener will be automatically unregistered if the entity is no longer valid.

Parameters

plugin

the plugin to register the listener

handle

the event handler