summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r--src/main/java/net/minecraft/server/EntityPotion.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/EntityPotion.java b/src/main/java/net/minecraft/server/EntityPotion.java
index 884b052c..3641e52f 100644
--- a/src/main/java/net/minecraft/server/EntityPotion.java
+++ b/src/main/java/net/minecraft/server/EntityPotion.java
@@ -3,6 +3,16 @@ package net.minecraft.server;
import java.util.Iterator;
import java.util.List;
+// CraftBukkit start
+import java.util.Collection;
+import java.util.HashMap;
+
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.entity.PotionSplashEvent;
+// CraftBukkit end
+
public class EntityPotion extends EntityProjectile {
private int d;
@@ -48,6 +58,9 @@ public class EntityPotion extends EntityProjectile {
if (list1 != null && !list1.isEmpty()) {
Iterator iterator = list1.iterator();
+ // CraftBukkit
+ HashMap<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>();
+
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
double d0 = this.i(entity);
@@ -59,6 +72,21 @@ public class EntityPotion extends EntityProjectile {
d1 = 1.0D;
}
+ // CraftBukkit start
+ affected.put((LivingEntity) entity.getBukkitEntity(), d1);
+ }
+ }
+
+ PotionSplashEvent event = CraftEventFactory.callPotionSplashEvent(this, affected);
+ if (!event.isCancelled()) {
+ for (LivingEntity victim : event.getAffectedEntities()) {
+ if (!(victim instanceof CraftLivingEntity)) {
+ continue;
+ }
+ EntityLiving entity = ((CraftLivingEntity) victim).getHandle();
+ double d1 = event.getIntensity(victim);
+ // CraftBukkit end
+
Iterator iterator1 = list.iterator();
while (iterator1.hasNext()) {