public interface AffectEntityEvent extends Event, Cancellable
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.Modifier and Type | Method and Description |
---|---|
default List<? extends Entity> |
filterEntities(Predicate<Entity> predicate)
Filters out
Entity 's from getEntities()
to be affected by this event. |
default List<Entity> |
filterEntityLocations(Predicate<Location<World>> predicate)
Filters out
Location 's from
getEntities() to be affected by this event. |
List<Entity> |
getEntities()
Gets the
List who will be affected after event
resolution. |
List<EntitySnapshot> |
getEntitySnapshots()
Gets an
List of the entity data
un-affected by event changes. |
getCause, getContext, getSource
isCancelled, setCancelled
List<EntitySnapshot> getEntitySnapshots() throws IllegalStateException
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.
IllegalStateException
- If the method is called after the pre orderList<Entity> getEntities()
List
who will be affected after event
resolution.default List<Entity> filterEntityLocations(Predicate<Location<World>> predicate)
Location
's from
getEntities()
to be affected by this event.
Locations for which the predicate returns false
will
be removed from getEntities()
.
predicate
- The predicate to use for filteringgetEntities()
default List<? extends Entity> filterEntities(Predicate<Entity> predicate)
Entity
's from getEntities()
to be affected by this event.
Entities for which the predicate returns false
will
be removed from getEntities()
.
predicate
- The predicate to use for filteringgetEntities()