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
ConstructorsConstructorDescriptionMobSpawnRemovalEvent(@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 TypeMethodDescription@NonNull org.bukkit.entity.EntityDeprecated, for removal: This API element is subject to removal in a future version.@Nullable org.bukkit.entity.EntityReturns the entity being attempted to be spawned, or null.org.bukkit.entity.EntityTypeReturns the type of the entity being attempted to be spawned.static org.bukkit.event.HandlerList@NonNull org.bukkit.event.HandlerListorg.bukkit.LocationReturns the location at which the entity is being attempted to be spawned.org.bukkit.event.entity.CreatureSpawnEvent.SpawnReasonReturns the reason for the entity being spawned.booleanvoidsetCancelled(boolean isCancelled) Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
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 thePreCreatureSpawnEvent. This method will attempt to create a default entity when it is not available, but you should usegetEntityOrNull()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:
isCancelledin interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean isCancelled) - Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable
-
getHandlers
public @NonNull org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlersin classorg.bukkit.event.Event
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList()
-
PreCreatureSpawnEvent.