[Bleeding] Added new target events. Fixes BUKKIT-935
By: feildmaster <admin@feildmaster.com>
This commit is contained in:
parent
e9f7ab207b
commit
bdca84f357
1 changed files with 7 additions and 2 deletions
|
@ -430,7 +430,13 @@ public class CraftEventFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EntityTargetEvent callEntityTargetEvent(Entity entity, Entity target, EntityTargetEvent.TargetReason reason) {
|
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);
|
entity.getBukkitEntity().getServer().getPluginManager().callEvent(event);
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
@ -458,7 +464,6 @@ public class CraftEventFactory {
|
||||||
public static ItemStack callPreCraftEvent(InventoryCrafting matrix, ItemStack result, InventoryView lastCraftView, boolean isRepair) {
|
public static ItemStack callPreCraftEvent(InventoryCrafting matrix, ItemStack result, InventoryView lastCraftView, boolean isRepair) {
|
||||||
CraftInventoryCrafting inventory = new CraftInventoryCrafting(matrix, matrix.resultInventory);
|
CraftInventoryCrafting inventory = new CraftInventoryCrafting(matrix, matrix.resultInventory);
|
||||||
inventory.setResult(new CraftItemStack(result));
|
inventory.setResult(new CraftItemStack(result));
|
||||||
|
|
||||||
PrepareItemCraftEvent event = new PrepareItemCraftEvent(inventory, lastCraftView, isRepair);
|
PrepareItemCraftEvent event = new PrepareItemCraftEvent(inventory, lastCraftView, isRepair);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue