Class CancellableEvent

java.lang.Object
civitas.celestis.event.Event
civitas.celestis.event.CancellableEvent
All Implemented Interfaces:
Cancellable, Handleable, Unique<UUID>

public class CancellableEvent extends Event implements Cancellable
An event which can be cancelled by a lower priority listener, which flags the event as cancelled, notifying higher priority listeners that this event should be ignored as if it had not happened in the first place.
See Also:
  • Constructor Details

    • CancellableEvent

      public CancellableEvent()
      Creates a new cancellable event with a random unique identifier and no cause.
    • CancellableEvent

      public CancellableEvent(@Nonnull UUID uniqueId)
      Creates a new cancellable event with no cause.
      Parameters:
      uniqueId - The unique identifier of this event
    • CancellableEvent

      public CancellableEvent(@Nullable Handleable cause)
      Creates a new cancellable event with a random unique identifier.
      Parameters:
      cause - The cause of this event
    • CancellableEvent

      public CancellableEvent(@Nonnull UUID uniqueId, @Nullable Handleable cause)
      Creates a new cancellable event.
      Parameters:
      uniqueId - The unique identifier of this event
      cause - The cause of this event
  • Method Details

    • isCancelled

      public boolean isCancelled()
      Returns whether this event has been flagged as cancelled.
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if this event has been flagged as cancelled
    • setCancelled

      public void setCancelled(boolean cancelled)
      Sets whether this event has been flagged as cancelled.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancelled - Whether this event has been cancelled