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 BlockGets the spawner block that is attempting to spawn an entity.@Nullable LocationGets the location where the entity will spawn.@NotNull EntityTypegetType()Gets the type of entity that the spawner is attempting to spawn.Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronousMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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- theBlockrepresenting the spawnertype- theEntityTypethat the spawner is attempting to spawnspawnLocation- theLocationwhere the entity will spawn, may benullon older versions or server software
-
-
Method Details
-
getHandlerList
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getSpawnerBlock
Gets the spawner block that is attempting to spawn an entity.- Returns:
- the
Blockrepresenting the spawner
-
getSpawnLocation
Gets the location where the entity will spawn.Note: This may be
nullon older Minecraft versions or server software that doesn't provide spawn location information in their spawner events.- Returns:
- the spawn
Location, ornullif not available
-
getType
Gets the type of entity that the spawner is attempting to spawn.- Returns:
- the
EntityTypeto be spawned
-