Class MobSpawnRemovalEvent

java.lang.Object
org.bukkit.event.Event
com.palmergames.bukkit.towny.event.mobs.MobSpawnRemovalEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class MobSpawnRemovalEvent extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
Called when Towny wants to prevent a mob from spawning. If canceled, the mob will be allowed to spawn, but follow-up removal attempts can still happen. These would be handled using MobRemovalEvent.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Constructor Summary

    Constructors
    Constructor
    Description
    MobSpawnRemovalEvent(@Nullable org.bukkit.entity.Entity entity, org.bukkit.entity.EntityType entityType, org.bukkit.Location location, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @NonNull org.bukkit.entity.Entity
    Deprecated, for removal: This API element is subject to removal in a future version.
    An entity instance is not available if we are cancelling the mob spawn using the PreCreatureSpawnEvent.
    @Nullable org.bukkit.entity.Entity
    Returns the entity being attempted to be spawned, or null.
    org.bukkit.entity.EntityType
    Returns the type of the entity being attempted to be spawned.
    static org.bukkit.event.HandlerList
     
    @NonNull org.bukkit.event.HandlerList
     
    org.bukkit.Location
    Returns the location at which the entity is being attempted to be spawned.
    org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason
    Returns the reason for the entity being spawned.
    boolean
     
    void
    setCancelled(boolean isCancelled)
     

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MobSpawnRemovalEvent

      @Internal public MobSpawnRemovalEvent(@Nullable org.bukkit.entity.Entity entity, org.bukkit.entity.EntityType entityType, org.bukkit.Location location, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason)
  • Method Details

    • getEntity

      @Deprecated(forRemoval=true, since="0.103.0.5") public @NonNull org.bukkit.entity.Entity getEntity()
      Deprecated, for removal: This API element is subject to removal in a future version.
      An entity instance is not available if we are cancelling the mob spawn using the PreCreatureSpawnEvent. This method will attempt to create a default entity when it is not available, but you should use getEntityOrNull() instead.
    • getEntityOrNull

      public @Nullable org.bukkit.entity.Entity getEntityOrNull()
      Returns the entity being attempted to be spawned, or null.
      Returns:
      the entity being attempted to be spawned, or null
    • getEntityType

      public org.bukkit.entity.EntityType getEntityType()
      Returns the type of the entity being attempted to be spawned.
      Returns:
      the type of the entity being attempted to be spawned
    • getLocation

      public org.bukkit.Location getLocation()
      Returns the location at which the entity is being attempted to be spawned.
      Returns:
      the location at which the entity is being attempted to be spawned
    • getSpawnReason

      public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getSpawnReason()
      Returns the reason for the entity being spawned.
      Returns:
      the reason for the entity being spawned
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
    • setCancelled

      public void setCancelled(boolean isCancelled)
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
    • getHandlers

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

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