Package dev.jaims.mcutils.bukkit.event

Types

ListenerExt
Link copied to clipboard
A listener extension that lets me easily call the onEvent method
interface ListenerExt<T : Event> : Listener

Functions

listenForEvent
Link copied to clipboard
Listen for an event as long as this plugin is Enabled. The predicate is optional. It can be nice for quick events, but it also default to true to allow for customization. You can also set ignoreCancelled and priority When this is detected, if the predicate is matched, the action is run
inline fun <T : Event> KotlinPlugin.listenForEvent(ignoreCancelled: Boolean, priority: EventPriority, crossinline predicate: (T) -> Boolean, crossinline action: (T) -> Unit)
waitForEvent
Link copied to clipboard
Wait for an event to occur, then unregister it on a timeout or when the event occurs once. Useful for listening to chat messages for example.
inline fun <T : Event> KotlinPlugin.waitForEvent(timeoutTicks: Long, ignoreCancelled: Boolean, priority: EventPriority, crossinline predicate: (T) -> Boolean, crossinline timeoutAction: () -> Unit, crossinline action: (T) -> Unit)