Cancellable
interface Cancellable
Optional interface for events that support cancellation.
When a Cancellable event is posted, dispatch stops as soon as any handler sets isCancelled to true; remaining handlers are skipped.
class BlockBreakEvent : Event, Cancellable {
override var isCancelled = false
}Content copied to clipboard
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; }
}Content copied to clipboard
Cancellation is automatically thread-safe when the event is dispatched via EventBus.postAsync or to a bus with async handlers. A plain var isCancelled = false field is sufficient.
Properties
Functions
Link copied to clipboard
Sets isCancelled to true. Equivalent to isCancelled = true.