subscribe

@NotNull
abstract fun <T : ModelEvent?> subscribe(@NotNull application: @NotNull ModelEventApplication, @NotNull eventClass: @NotNull Class<T>, @NotNull consumer: @NotNull Consumer<T>): @NotNull ModelEventListener

Subscribes a consumer to a specific event type.

Return

a listener handle that can be used to unregister the subscription

Since

2.0.0

Parameters

application

the application 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