listen

inline fun <T : Event> listen(eventPriority: EventPriority = EventPriority.NORMAL, ignoreCancelled: Boolean = true, shouldRegister: Boolean = true, crossinline consumer: (event: T) -> Unit): KListener<T>(source)

This function is used to listen to an event

Return

The listener that is created

Parameters

T

The type of event that this listener listens to

eventPriority

The priority of the event

ignoreCancelled

Whether the event should be ignored if it is already canceled

shouldRegister

Whether the listener should be registered

consumer

The consumer that is called when the event is triggered