aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0255-WitchConsumePotionEvent.patch
blob: 71638ec34216b8dba1eb6edf7bc42267ccc5d4c3 (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
25
26
27
From 342abd56794abdc32b82160b0044e6cce4c67d61 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/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java
index eaae9ea9af..0d579c7e47 100644
--- a/src/main/java/net/minecraft/server/EntityWitch.java
+++ b/src/main/java/net/minecraft/server/EntityWitch.java
@@ -67,7 +67,11 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
 
                     this.setSlot(EnumItemSlot.MAINHAND, ItemStack.a);
                     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();
-- 
2.21.0