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 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 Event
getEventName, isAsynchronousMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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
-
getSpawnLocation
-
getType
Gets the type of entity that the spawner is attempting to spawn.- Returns:
- the
EntityTypeto be spawned
-