Cancellable

interface Cancellable

Optional interface for events that support cancellation.

When a Cancellable event is posted, the bus stops dispatching as soon as isCancelled is true; remaining handlers are skipped.

class BlockBreakEvent : Event, Cancellable {
override var isCancelled = false
}

Java: Kotlin compiles var isCancelled to isCancelled() / setCancelled(boolean):

public class BlockBreakEvent implements Event, Cancellable {
private boolean cancelled = false;
@Override public boolean isCancelled() { return cancelled; }
@Override public void setCancelled(boolean v) { cancelled = v; }
}

Properties

Link copied to clipboard
abstract var isCancelled: Boolean

Whether this event has been cancelled.

Functions

Link copied to clipboard
open fun cancel()

Convenience method to cancel the event. Equivalent to isCancelled = true.