Cancellable Event

Creating

public class EventName extends CancellableEvent {
    
    public final @NotNull String parameter;
    
    public EventName(@NotNull String parameter) {
        this.parameter = parameter;
    }
}

Listening

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

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 cancelled set to true.
boolean containsCancelled = resultCollection.containsCancelled();

Last updated