aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0215-WitchConsumePotionEvent.patch
blob: 4c8539424474a98e48b52100ff459a3981a74922 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 16 May 2018 20:35:16 -0400
Subject: [PATCH] WitchConsumePotionEvent

Fires when a witch consumes the potion in their hand

diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java
index 814ef118e983ee6807108b2e07cd9b35ef9dae15..0bfdcbe4a792e8243de86ded6c64d930ec6e4de8 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java
@@ -124,7 +124,11 @@ public class EntityWitch extends EntityRaider implements IRangedEntity {
 
                     this.setSlot(EnumItemSlot.MAINHAND, ItemStack.b);
                     if (itemstack.getItem() == Items.POTION) {
-                        List<MobEffect> list = PotionUtil.getEffects(itemstack);
+                        // Paper start
+                        com.destroystokyo.paper.event.entity.WitchConsumePotionEvent event = new com.destroystokyo.paper.event.entity.WitchConsumePotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
+
+                        List<MobEffect> list = event.callEvent() ? PotionUtil.getEffects(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion())) : null;
+                        // Paper end
 
                         if (list != null) {
                             Iterator iterator = list.iterator();