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 multipleEntityinstances as a bulk action. The constraint is that if an action can be deemed as necessary for selective individualized processing, such asDamageEntityEvent, the actionedEventis handled individually. If a bulk ofEntityinstances are being affected, for example by anExplosion"damaging" a varying amount ofEntityinstances. 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 theListof entities who will be affected after event resolution.List<EntitySnapshot>entitySnapshots()Gets anListof the entity data un-affected by event changes.voidfilterEntities(Predicate<Entity> predicate)Filters outEntity's fromentities()to be affected by this event.default voidfilterEntityLocations(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 anListof the entity data un-affected by event changes.This method MUST be called at
Order.PREin 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 anIllegalStateExceptionwhen invoked.- Returns:
- The ImmutableList
- Throws:
IllegalStateException- If the method is called after the pre order
-
entities
List<Entity> entities()
Gets theListof 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
falsewill 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
falsewill be removed fromentities().- Parameters:
predicate- The predicate to use for filtering
-
-