#718: Add consumed item, hand and consumeItem boolean to EntityShootBowEvent
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
@@ -507,16 +507,18 @@ public class CraftEventFactory {
|
||||
/**
|
||||
* EntityShootBowEvent
|
||||
*/
|
||||
public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack itemstack, Entity entityArrow, float force) {
|
||||
public static EntityShootBowEvent callEntityShootBowEvent(EntityLiving who, ItemStack bow, ItemStack consumableItem, Entity entityArrow, EnumHand hand, float force, boolean consumeItem) {
|
||||
LivingEntity shooter = (LivingEntity) who.getBukkitEntity();
|
||||
CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
|
||||
CraftItemStack itemInHand = CraftItemStack.asCraftMirror(bow);
|
||||
CraftItemStack itemConsumable = CraftItemStack.asCraftMirror(consumableItem);
|
||||
org.bukkit.entity.Entity arrow = entityArrow.getBukkitEntity();
|
||||
EquipmentSlot handSlot = (hand == EnumHand.MAIN_HAND) ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND;
|
||||
|
||||
if (itemInHand != null && (itemInHand.getType() == Material.AIR || itemInHand.getAmount() == 0)) {
|
||||
itemInHand = null;
|
||||
}
|
||||
|
||||
EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, arrow, force);
|
||||
EntityShootBowEvent event = new EntityShootBowEvent(shooter, itemInHand, itemConsumable, arrow, handSlot, force, consumeItem);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
return event;
|
||||
|
||||
Reference in New Issue
Block a user