diff --git a/paper-api/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java new file mode 100644 index 0000000000..9353f0d092 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java @@ -0,0 +1,24 @@ +package org.bukkit.event.entity; + +import org.bukkit.block.CreatureSpawner; +import org.bukkit.entity.Entity; +import org.jetbrains.annotations.NotNull; + +/** + * Called when an entity is spawned into a world by a spawner. + *
+ * If a Spawner Spawn event is cancelled, the entity will not spawn. + */ +public class SpawnerSpawnEvent extends EntitySpawnEvent { + private final CreatureSpawner spawner; + + public SpawnerSpawnEvent(@NotNull final Entity spawnee, @NotNull final CreatureSpawner spawner) { + super(spawnee); + this.spawner = spawner; + } + + @NotNull + public CreatureSpawner getSpawner() { + return spawner; + } +}