WitchThrowPotionEvent

Fired when a witch throws a potion at a player
This commit is contained in:
Aikar 2018-05-16 20:44:58 -04:00
parent 72743537f4
commit a3b5f969ed

View file

@ -17,3 +17,17 @@
}
this.gameEvent(GameEvent.DRINK);
@@ -231,6 +237,13 @@
ServerLevel worldserver = (ServerLevel) world;
ItemStack itemstack = PotionContents.createItemStack(Items.SPLASH_POTION, holder);
+ // Paper start - WitchThrowPotionEvent
+ com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) target.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
+ if (!event.callEvent()) {
+ return;
+ }
+ itemstack = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion());
+ // Paper end - WitchThrowPotionEvent
Projectile.spawnProjectileUsingShoot(ThrownPotion::new, worldserver, itemstack, this, d0, d1 + d3 * 0.2D, d2, 0.75F, 8.0F);
}