Completable Event

Creating

public class EventName extends CompletableEvent {

    public final @NotNull String parameter;

    public EventName(@NotNull String parameter) {
        this.parameter = parameter;
    }
}

Listening

client.registerListener((EventListener<EventName>) event -> {
    return event.complete();
});

Calling

CompletableResultSet<EventName> resultCollection = client
        .callEvent(new PingEvent("Somthing"));


// Wait for the final result.
List<EventName> result = resultCollection.waitForFinalResult();

// Quick way to check if it contains an event that has completed set to true.
boolean containsCompleted = resultCollection.containsCompleted();

Last updated