Interface CompositeEvent<E extends Event>

All Superinterfaces:
Cancellable, Event
All Known Subinterfaces:
InteractBlockEvent.Secondary.Post, InteractItemEvent.Secondary.Post
All Known Implementing Classes:
AbstractCompositeEvent

public interface CompositeEvent<E extends Event> extends Event, Cancellable
A CompositeEvent is an Event that contains multiple side effectual Events, which may have their own side effects and may be Cancellable. In some cases, the interactions of this event may be cancellable as a whole, but are not guaranteed to revert all side effects on the Game. The children() of this event are ordered in a "best-effort" basis, and may not be guaranteed to be in any particular order.

Using setCancelled(boolean) will perform a best effort cancellation on each of the children events.

  • Method Details

    • baseEvent

      E baseEvent()
    • children

      List<Event> children()
    • event

      default <A extends Event> List<? extends A> event(Class<A> type)
    • applyTo

      default <A extends Event> void applyTo(Class<A> type, Consumer<? super A> consumer)
    • setCancelled

      void setCancelled(boolean cancel)
      Sets the cancelled state of the Event. Cancels this event and all related events captured children(). Selectively, if individual events are wished to be cancelled, the individual events should be cancelled instead.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancel - The new cancelled state