mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 06:50:12 +01:00
SPIGOT-4547: Call EntitySpawnEvent as general spawn fallback event
This commit is contained in:
parent
963f4a5fc1
commit
9642498d24
1 changed files with 13 additions and 0 deletions
|
@ -383,6 +383,8 @@ public class CraftEventFactory {
|
|||
event = CraftEventFactory.callProjectileLaunchEvent(entity);
|
||||
} else if (entity.getBukkitEntity() instanceof org.bukkit.entity.Vehicle){
|
||||
event = CraftEventFactory.callVehicleCreateEvent(entity);
|
||||
} else {
|
||||
event = CraftEventFactory.callEntitySpawnEvent(entity);
|
||||
}
|
||||
|
||||
if (event != null && (event.isCancelled() || entity.dead)) {
|
||||
|
@ -400,6 +402,17 @@ public class CraftEventFactory {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* EntitySpawnEvent
|
||||
*/
|
||||
public static EntitySpawnEvent callEntitySpawnEvent(Entity entity) {
|
||||
org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
||||
|
||||
EntitySpawnEvent event = new EntitySpawnEvent(bukkitEntity);
|
||||
bukkitEntity.getServer().getPluginManager().callEvent(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* CreatureSpawnEvent
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue