3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

SPIGOT-4547: Call EntitySpawnEvent as general spawn fallback event

Dieser Commit ist enthalten in:
md_5 2018-12-26 08:00:00 +11:00
Ursprung 963f4a5fc1
Commit 9642498d24

Datei anzeigen

@ -383,6 +383,8 @@ public class CraftEventFactory {
event = CraftEventFactory.callProjectileLaunchEvent(entity); event = CraftEventFactory.callProjectileLaunchEvent(entity);
} else if (entity.getBukkitEntity() instanceof org.bukkit.entity.Vehicle){ } else if (entity.getBukkitEntity() instanceof org.bukkit.entity.Vehicle){
event = CraftEventFactory.callVehicleCreateEvent(entity); event = CraftEventFactory.callVehicleCreateEvent(entity);
} else {
event = CraftEventFactory.callEntitySpawnEvent(entity);
} }
if (event != null && (event.isCancelled() || entity.dead)) { if (event != null && (event.isCancelled() || entity.dead)) {
@ -400,6 +402,17 @@ public class CraftEventFactory {
return true; 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 * CreatureSpawnEvent
*/ */