Class PreSpawnSpawnerEvent
java.lang.Object
org.bukkit.event.Event
com.kamikazejam.kamicommon.nms.abstraction.event.PreSpawnSpawnerEvent
- All Implemented Interfaces:
Cancellable
Custom event fired before a spawner attempts to spawn an entity.
This event provides cross-version compatibility for spawner monitoring, allowing plugins to intercept and potentially cancel spawner activations before entities are actually created. The implementation varies based on the Minecraft version and available server software.
Version Compatibility:
- Pre-1.12:
- 1.8.8: Requires TacoSpigot with
net.techcable.tacospigot.event.entity.SpawnerPreSpawnEvent
- Other versions: Requires Paper with
com.destroystokyo.paper.event.entity.SpawnerSpawnEvent
- 1.8.8: Requires TacoSpigot with
- 1.13+: Requires Paper with
com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent
This event is Cancellable
, allowing plugins to prevent specific
spawner activations while maintaining compatibility across server versions.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Constructor Summary
ConstructorsConstructorDescriptionPreSpawnSpawnerEvent
(@NotNull Block spawnerBlock, @NotNull EntityType type, @Nullable Location spawnLocation) Constructs a new PreSpawnSpawnerEvent. -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerList
@NotNull Block
Gets the spawner block that is attempting to spawn an entity.@Nullable Location
Gets the location where the entity will spawn.@NotNull EntityType
getType()
Gets the type of entity that the spawner is attempting to spawn.Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bukkit.event.Cancellable
isCancelled, setCancelled
-
Constructor Details
-
PreSpawnSpawnerEvent
public PreSpawnSpawnerEvent(@NotNull @NotNull Block spawnerBlock, @NotNull @NotNull EntityType type, @Nullable @Nullable Location spawnLocation) Constructs a new PreSpawnSpawnerEvent.- Parameters:
spawnerBlock
- theBlock
representing the spawnertype
- theEntityType
that the spawner is attempting to spawnspawnLocation
- theLocation
where the entity will spawn, may benull
on older versions or server software
-
-
Method Details
-
getHandlerList
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getSpawnerBlock
Gets the spawner block that is attempting to spawn an entity.- Returns:
- the
Block
representing the spawner
-
getSpawnLocation
Gets the location where the entity will spawn.Note: This may be
null
on older Minecraft versions or server software that doesn't provide spawn location information in their spawner events.- Returns:
- the spawn
Location
, ornull
if not available
-
getType
Gets the type of entity that the spawner is attempting to spawn.- Returns:
- the
EntityType
to be spawned
-