mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 19:34:09 +01:00
eed041d629
By: md_5 <git@md-5.net>
26 lines
1.5 KiB
Diff
26 lines
1.5 KiB
Diff
--- a/net/minecraft/world/item/ItemProjectileWeapon.java
|
|
+++ b/net/minecraft/world/item/ItemProjectileWeapon.java
|
|
@@ -62,7 +62,22 @@
|
|
IProjectile iprojectile = this.createProjectile(worldserver, entityliving, itemstack, itemstack1, flag);
|
|
|
|
this.shootProjectile(entityliving, iprojectile, i, f, f1, f6, entityliving1);
|
|
- worldserver.addFreshEntity(iprojectile);
|
|
+ // CraftBukkit start
|
|
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityliving, itemstack, itemstack1, iprojectile, enumhand, f, true);
|
|
+ if (event.isCancelled()) {
|
|
+ event.getProjectile().remove();
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (event.getProjectile() == iprojectile.getBukkitEntity()) {
|
|
+ if (!worldserver.addFreshEntity(iprojectile)) {
|
|
+ if (entityliving instanceof net.minecraft.server.level.EntityPlayer) {
|
|
+ ((net.minecraft.server.level.EntityPlayer) entityliving).getBukkitEntity().updateInventory();
|
|
+ }
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
itemstack.hurtAndBreak(this.getDurabilityUse(itemstack1), entityliving, EntityLiving.getSlotForHand(enumhand));
|
|
if (itemstack.isEmpty()) {
|
|
break;
|