aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0192-WitchReadyPotionEvent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0192-WitchReadyPotionEvent.patch')
-rw-r--r--patches/server/0192-WitchReadyPotionEvent.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/patches/server/0192-WitchReadyPotionEvent.patch b/patches/server/0192-WitchReadyPotionEvent.patch
new file mode 100644
index 0000000000..6581d99e31
--- /dev/null
+++ b/patches/server/0192-WitchReadyPotionEvent.patch
@@ -0,0 +1,42 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Aikar <[email protected]>
+Date: Tue, 5 Jun 2018 22:47:26 -0400
+Subject: [PATCH] WitchReadyPotionEvent
+
+
+diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
+index a14e00d55930628333cc63b18727ea56dbdc4ee3..f6d01d21745391595d61b191832be4c28a3e58cb 100644
+--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
++++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
+@@ -151,7 +151,11 @@ public class Witch extends Raider implements RangedAttackMob {
+ }
+
+ if (holder != null) {
+- this.setItemSlot(EquipmentSlot.MAINHAND, PotionContents.createItemStack(Items.POTION, holder));
++ // Paper start
++ ItemStack potion = PotionContents.createItemStack(Items.POTION, holder);
++ potion = org.bukkit.craftbukkit.event.CraftEventFactory.handleWitchReadyPotionEvent(this, potion);
++ this.setItemSlot(EquipmentSlot.MAINHAND, potion);
++ // Paper end
+ this.usingTime = this.getMainHandItem().getUseDuration(this);
+ this.setUsingItem(true);
+ if (!this.isSilent()) {
+diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+index 0aa10b1709c195d766eb49e21d9bc19d7cecf760..9c463d551fc402dbcbc81aad5251a9183596830a 100644
+--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+@@ -1926,4 +1926,14 @@ public class CraftEventFactory {
+ ).callEvent();
+ }
+ // Paper end - PlayerUseUnknownEntityEvent
++
++ // Paper start - WitchReadyPotionEvent
++ public static ItemStack handleWitchReadyPotionEvent(net.minecraft.world.entity.monster.Witch witch, @Nullable ItemStack potion) {
++ com.destroystokyo.paper.event.entity.WitchReadyPotionEvent event = new com.destroystokyo.paper.event.entity.WitchReadyPotionEvent((org.bukkit.entity.Witch) witch.getBukkitEntity(), CraftItemStack.asCraftMirror(potion));
++ if (!event.callEvent() || event.getPotion() == null) {
++ return ItemStack.EMPTY;
++ }
++ return org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion());
++ }
++ // Paper end - WitchReadyPotionEvent
+ }