#718: Add consumed item, hand and consumeItem boolean to EntityShootBowEvent

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
CraftBukkit/Spigot
2020-08-31 18:39:12 +10:00
parent 393115aca2
commit 5d37d3d19d
4 changed files with 11 additions and 8 deletions

View File

@@ -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;