13
0
geforkt von Mirrors/Paper

[Bleeding] Added new target events. Fixes BUKKIT-935

By: feildmaster <admin@feildmaster.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2012-03-09 15:40:59 -06:00
Ursprung e9f7ab207b
Commit bdca84f357

Datei anzeigen

@ -430,7 +430,13 @@ public class CraftEventFactory {
}
public static EntityTargetEvent callEntityTargetEvent(Entity entity, Entity target, EntityTargetEvent.TargetReason reason) {
EntityTargetEvent event = new EntityTargetEvent(entity.getBukkitEntity(), target.getBukkitEntity(), reason);
EntityTargetEvent event = new EntityTargetEvent(entity.getBukkitEntity(), target == null ? null : target.getBukkitEntity(), reason);
entity.getBukkitEntity().getServer().getPluginManager().callEvent(event);
return event;
}
public static EntityTargetLivingEntityEvent callEntityTargetLivingEvent(Entity entity, EntityLiving target, EntityTargetEvent.TargetReason reason) {
EntityTargetLivingEntityEvent event = new EntityTargetLivingEntityEvent(entity.getBukkitEntity(), (LivingEntity) target.getBukkitEntity(), reason);
entity.getBukkitEntity().getServer().getPluginManager().callEvent(event);
return event;
}
@ -458,7 +464,6 @@ public class CraftEventFactory {
public static ItemStack callPreCraftEvent(InventoryCrafting matrix, ItemStack result, InventoryView lastCraftView, boolean isRepair) {
CraftInventoryCrafting inventory = new CraftInventoryCrafting(matrix, matrix.resultInventory);
inventory.setResult(new CraftItemStack(result));
PrepareItemCraftEvent event = new PrepareItemCraftEvent(inventory, lastCraftView, isRepair);
Bukkit.getPluginManager().callEvent(event);