KListener

abstract class KListener<T : Event>(val priority: EventPriority, val ignoreCancelled: Boolean) : Listener(source)

This class is our own custom Listener class, which is used to handle events more easily

Parameters

T

The type of event that this listener listens to

priority

The priority of the event

ignoreCancelled

Whether the event should be ignored if it is already canceled

Constructors

Link copied to clipboard
constructor(priority: EventPriority, ignoreCancelled: Boolean)

Properties

Link copied to clipboard
Link copied to clipboard
val priority: EventPriority

Functions

Link copied to clipboard
abstract fun onEvent(event: T)

This function is called when the event is triggered

Link copied to clipboard
inline fun <T : Event> KListener<T>.register()

This function is used to register the listener

Link copied to clipboard
inline fun <T : Event> KListener<T>.unregister()

This function is used to unregister the listener