Fix Witch Throw Potion error - Resolves #1129

This commit is contained in:
Aikar 2018-05-23 23:08:04 -04:00
parent bd9e73a2c6
commit efe156b1f7
2 changed files with 7 additions and 7 deletions

View file

@ -6,13 +6,13 @@ Subject: [PATCH] WitchThrowPotionEvent
Fired when a witch throws a potion at a player
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
index 6ef6367b..2f4ce49e 100644
index 6ef6367b..77487e28 100644
--- a/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
+++ b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
@@ -0,0 +0,0 @@
package com.destroystokyo.paper.event.entity;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Witch;
import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
@ -26,10 +26,10 @@ index 6ef6367b..2f4ce49e 100644
+ * Fired when a witch throws a potion at a player
+ */
+public class WitchThrowPotionEvent extends EntityEvent implements Cancellable {
+ private final Player target;
+ private final LivingEntity target;
+ private ItemStack potion;
+
+ public WitchThrowPotionEvent(Witch witch, Player target, ItemStack potion) {
+ public WitchThrowPotionEvent(Witch witch, LivingEntity target, ItemStack potion) {
+ super(witch);
+ this.target = target;
+ this.potion = potion;
@ -43,7 +43,7 @@ index 6ef6367b..2f4ce49e 100644
+ /**
+ * @return The target of the potion
+ */
+ public Player getTarget() {
+ public LivingEntity getTarget() {
+ return target;
+ }
+

View file

@ -6,7 +6,7 @@ Subject: [PATCH] WitchThrowPotionEvent
Fired when a witch throws a potion at a player
diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java
index 3a00a37eb..f51989588 100644
index 3a00a37eb..bf029ad1c 100644
--- a/src/main/java/net/minecraft/server/EntityWitch.java
+++ b/src/main/java/net/minecraft/server/EntityWitch.java
@@ -0,0 +0,0 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
@ -16,7 +16,7 @@ index 3a00a37eb..f51989588 100644
- EntityPotion entitypotion = new EntityPotion(this.world, this, PotionUtil.a(new ItemStack(Items.SPLASH_POTION), potionregistry));
+ // Paper start
+ ItemStack potion = PotionUtil.a(new ItemStack(Items.SPLASH_POTION), potionregistry);
+ com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.Player) entityliving.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));
+ com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));
+ if (!event.callEvent()) {
+ return;
+ }