Fix Witch Throw Potion error - Resolves #1129

This commit is contained in:
Aikar 2018-05-23 23:08:04 -04:00
parent aedd155be1
commit 3eb1cdef72
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
2 changed files with 9 additions and 9 deletions

View file

@ -1,4 +1,4 @@
From dc665a8ed1861da017603e6be0f484fce75a8ff5 Mon Sep 17 00:00:00 2001
From 03b5a5e31bb52b1eefb424ba06b975649b32dd40 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 16 May 2018 20:39:09 -0400
Subject: [PATCH] WitchThrowPotionEvent
@ -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
@@ -1,13 +1,51 @@
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

@ -1,4 +1,4 @@
From f449fff0a099790efb09046533d21718cd49db9d Mon Sep 17 00:00:00 2001
From eabbb64378c01313979e23f1e76ecfcf7920176e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 16 May 2018 20:44:58 -0400
Subject: [PATCH] WitchThrowPotionEvent
@ -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
@@ -158,7 +158,15 @@ 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;
+ }