Interface AffectEntityEvent

All Superinterfaces:
Cancellable, Event
All Known Subinterfaces:
ChangeInventoryEvent.Drop, ChangeInventoryEvent.Drop.Full, ChangeInventoryEvent.Drop.Single, ClickContainerEvent.Creative.Drop, ClickContainerEvent.Drop, ClickContainerEvent.Drop.Full, ClickContainerEvent.Drop.Outside, ClickContainerEvent.Drop.Outside.Primary, ClickContainerEvent.Drop.Outside.Secondary, ClickContainerEvent.Drop.Single, CollideEntityEvent, CollideEntityEvent.Impact, DropItemEvent.Close, DropItemEvent.Custom, DropItemEvent.Destruct, DropItemEvent.Dispense, ExplosionEvent.Detonate, LightningEvent.Strike, SpawnEntityEvent, SpawnEntityEvent.Custom, SpawnEntityEvent.Pre
All Known Implementing Classes:
AbstractAffectEntityEvent, AbstractDetonateEvent, AbstractSpawnEntityEvent

public interface AffectEntityEvent extends Event, Cancellable
An event that affects multiple Entity instances as a bulk action. The constraint is that if an action can be deemed as necessary for selective individualized processing, such as DamageEntityEvent, the actioned Event is handled individually. If a bulk of Entity instances are being affected, for example by an Explosion "damaging" a varying amount of Entity instances. Other cases will be included as necessary.
  • Method Details

    • entitySnapshots

      List<EntitySnapshot> entitySnapshots() throws IllegalStateException
      Gets an List of the entity data un-affected by event changes.

      This method MUST be called at Order.PRE in order to be properly initialized, after which it can be called at any time. If it is not first called at Order.PRE, it will throw an IllegalStateException when invoked.

      Returns:
      The ImmutableList
      Throws:
      IllegalStateException - If the method is called after the pre order
    • entities

      List<Entity> entities()
      Gets the List of entities who will be affected after event resolution. This list can only be modified using filterEntities(Predicate).
      Returns:
      The list of entities that will be affected.
    • filterEntityLocations

      default void filterEntityLocations(Predicate<ServerLocation> predicate)
      Filters out ServerLocation's from entities() to be affected by this event.

      Locations for which the predicate returns false will be removed from entities().

      Parameters:
      predicate - The predicate to use for filtering
    • filterEntities

      void filterEntities(Predicate<Entity> predicate)
      Filters out Entity's from entities() to be affected by this event.

      Entities for which the predicate returns false will be removed from entities().

      Parameters:
      predicate - The predicate to use for filtering