diff options
author | feildmaster <admin@feildmaster.com> | 2012-03-25 04:21:25 -0500 |
---|---|---|
committer | Warren Loo <evilseph@gmail.com> | 2012-03-26 16:05:38 -0400 |
commit | 9d0ea520213227a39e346571c7c502f7a3a241c7 (patch) | |
tree | d58f8cf547c301cbc12f4e287efb8c9e388c8430 /src/main/java/net/minecraft | |
parent | b45184fdf8f08a86b67c062eee8483254c93cdff (diff) | |
download | craftbukkit-9d0ea520213227a39e346571c7c502f7a3a241c7.tar craftbukkit-9d0ea520213227a39e346571c7c502f7a3a241c7.tar.gz craftbukkit-9d0ea520213227a39e346571c7c502f7a3a241c7.tar.lz craftbukkit-9d0ea520213227a39e346571c7c502f7a3a241c7.tar.xz craftbukkit-9d0ea520213227a39e346571c7c502f7a3a241c7.zip |
[Bleeding] Fixed potions throwing double events. Fixes BUKKIT-1332
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r-- | src/main/java/net/minecraft/server/MobEffectList.java | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/main/java/net/minecraft/server/MobEffectList.java b/src/main/java/net/minecraft/server/MobEffectList.java index 3b69deb9..78945bbc 100644 --- a/src/main/java/net/minecraft/server/MobEffectList.java +++ b/src/main/java/net/minecraft/server/MobEffectList.java @@ -1,13 +1,12 @@ package net.minecraft.server; // CraftBukkit start -import org.bukkit.Bukkit; -import org.bukkit.potion.PotionEffectType; import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.potion.CraftPotionEffectType; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.potion.PotionEffectType; // CraftBukkit end public class MobEffectList { @@ -86,7 +85,6 @@ public class MobEffectList { if (entityliving.getHealth() > 1) { // CraftBukkit start EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(null, entityliving, DamageCause.POISON, 1); - Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled() && event.getDamage() > 0) { entityliving.damageEntity(DamageSource.MAGIC, event.getDamage()); @@ -99,7 +97,6 @@ public class MobEffectList { if (this.id == HARM.id && !entityliving.aN() || this.id == HEAL.id && entityliving.aN()) { // CraftBukkit start EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(null, entityliving, DamageCause.MAGIC, 6 << i); - Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled() && event.getDamage() > 0) { entityliving.damageEntity(DamageSource.MAGIC, event.getDamage()); @@ -124,18 +121,11 @@ public class MobEffectList { if (this.id == HARM.id && !entityliving1.aN() || this.id == HEAL.id && entityliving1.aN()) { j = (int) (d0 * (double) (6 << i) + 0.5D); - // CraftBukkit start - EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(potion != null ? potion : entityliving, entityliving1, DamageCause.MAGIC, j); - j = event.getDamage(); - if (event.isCancelled() || j == 0) { - return; - } - // CraftBukkit end - if (entityliving == null) { entityliving1.damageEntity(DamageSource.MAGIC, j); } else { - entityliving1.damageEntity(DamageSource.b(entityliving1, entityliving), j); + // CraftBukkit - The "damager" needs to be the potion + entityliving1.damageEntity(DamageSource.b(potion != null ? potion : entityliving1, entityliving), j); } } } else { |