waitMatches

suspend fun <T : Event> EventListener.waitMatches(eventClass: Class<T>, priority: Short, predicate: Predicate<T>): T


inline suspend fun <T : Event> EventListener.waitMatches(priority: Short = 0, predicate: Predicate<T>): T

Wait an event of type T which matches given predicate.

The continuation resumes on the event handler thread. For example:

Parameters

priority

The priority of the event hook.

predicate

The predicate to match the event. If it throws a Throwable, the continuation will be resumed with Result.failure.