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 multipleEntity
instances as a bulk action. The constraint is that if an action can be deemed as necessary for selective individualized processing, such asDamageEntityEvent
, the actionedEvent
is handled individually. If a bulk ofEntity
instances are being affected, for example by anExplosion
"damaging" a varying amount ofEntity
instances. Other cases will be included as necessary.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description List<Entity>
entities()
Gets theList
of entities who will be affected after event resolution.List<EntitySnapshot>
entitySnapshots()
Gets anList
of the entity data un-affected by event changes.void
filterEntities(Predicate<Entity> predicate)
Filters outEntity
's fromentities()
to be affected by this event.default void
filterEntityLocations(Predicate<ServerLocation> predicate)
Filters outServerLocation
's fromentities()
to be affected by this event.-
Methods inherited from interface org.spongepowered.api.event.Cancellable
isCancelled, setCancelled
-
-
-
-
Method Detail
-
entitySnapshots
List<EntitySnapshot> entitySnapshots() throws IllegalStateException
Gets anList
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 atOrder.PRE
, it will throw anIllegalStateException
when invoked.- Returns:
- The ImmutableList
- Throws:
IllegalStateException
- If the method is called after the pre order
-
entities
List<Entity> entities()
Gets theList
of entities who will be affected after event resolution. This list can only be modified usingfilterEntities(Predicate)
.- Returns:
- The list of entities that will be affected.
-
filterEntityLocations
default void filterEntityLocations(Predicate<ServerLocation> predicate)
Filters outServerLocation
's fromentities()
to be affected by this event.Locations for which the predicate returns
false
will be removed fromentities()
.- Parameters:
predicate
- The predicate to use for filtering
-
filterEntities
void filterEntities(Predicate<Entity> predicate)
Filters outEntity
's fromentities()
to be affected by this event.Entities for which the predicate returns
false
will be removed fromentities()
.- Parameters:
predicate
- The predicate to use for filtering
-
-