Implement SpawnerSpawnEvent

By: md_5 <git@md-5.net>
Also-by: Andy Shulman <andy.shulman@hotmail.com>
This commit is contained in:
CraftBukkit/Spigot
2023-06-10 07:22:51 +10:00
parent 82dccdf1a6
commit 5301642c90
2 changed files with 23 additions and 2 deletions

View File

@@ -8,12 +8,17 @@
}
private boolean isNearPlayer(World world, BlockPosition blockposition) {
@@ -152,7 +153,7 @@
@@ -152,7 +153,12 @@
}
}
- if (!worldserver.tryAddFreshEntityWithPassengers(entity)) {
+ if (!worldserver.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER)) { // CraftBukkit
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) {
+ continue;
+ }
+ if (!worldserver.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER)) {
+ // CraftBukkit end
this.delay(worldserver, blockposition);
return;
}