diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index a7d88fe6ac..54a6b98d47 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -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 */