Class SpawnEntityEvent

java.lang.Object
org.bukkit.event.Event
com.sk89q.worldguard.bukkit.event.DelegateEvent
com.sk89q.worldguard.bukkit.event.entity.SpawnEntityEvent
All Implemented Interfaces:
Handleable, org.bukkit.event.Cancellable

public class SpawnEntityEvent extends DelegateEvent
This event is an internal event. We do not recommend handling or throwing this event or its subclasses as the interface is highly subject to change.

Thrown when an entity is spawned.

  • Constructor Details

    • SpawnEntityEvent

      public SpawnEntityEvent(@Nullable org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.entity.Entity target)
    • SpawnEntityEvent

      public SpawnEntityEvent(@Nullable org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.Location location, org.bukkit.entity.EntityType type)
  • Method Details

    • getEffectiveType

      public org.bukkit.entity.EntityType getEffectiveType()
      Get the effective entity type of the spawned entity.
      Returns:
      the effective type
    • getHandlers

      public org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
    • getWorld

      public org.bukkit.World getWorld()
      Get the world.
      Returns:
      the world
    • getTarget

      public org.bukkit.Location getTarget()
      Get the target location being affected.
      Returns:
      a location
    • getEntity

      @Nullable public org.bukkit.entity.Entity getEntity()
      Get the target entity being affected.
      Returns:
      a entity
    • filter

      public boolean filter(com.google.common.base.Predicate<org.bukkit.Location> predicate, boolean cancelEventOnFalse)
      Filter the list of affected entities with the given predicate. If the predicate returns false, then the entity is not affected.
      Parameters:
      predicate - the predicate
      cancelEventOnFalse - true to cancel the event and clear the entity list once the predicate returns false
      Returns:
      true if one or more entities were filtered out