subscribe

@NotNull
open fun <T : ModelEvent?> subscribe(@NotNull plugin: @NotNull Plugin, @NotNull eventClass: @NotNull Class<T>, @NotNull consumer: @NotNull Consumer<T>): @NotNull ModelEventListener

Subscribes a consumer to a specific event type, associated with a Bukkit plugin.

Return

a listener handle that can be used to unregister the subscription

Since

2.0.0

Parameters

plugin

the plugin that subscribes to the event

eventClass

the class of the event to subscribe to

consumer

the consumer to handle the event

<T>

the type of the event