> For the complete documentation index, see [llms.txt](https://smuddgge.gitbook.io/kerb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smuddgge.gitbook.io/kerb/developer-api/cancellable-event.md).

# Cancellable Event

## Creating

{% code title="" overflow="wrap" %}

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

{% endcode %}

## Listening

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

## Calling

```java
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();
```
