diff options
author | Taylor Kelly <tkelly910@gmail.com> | 2011-01-26 14:26:24 -0500 |
---|---|---|
committer | Taylor Kelly <tkelly910@gmail.com> | 2011-01-26 14:26:24 -0500 |
commit | c07e32c1de57898d5f7ad2fbfa0800d65fc20f5a (patch) | |
tree | 5bbc5a84094a38e0e098d5d1d4f9e21432e4d8f8 /src/main/java/net/minecraft/server/EntityMobs.java | |
parent | 0ba870434ea7ec6e75652cad0b3fb6b9d240bbb6 (diff) | |
download | craftbukkit-c07e32c1de57898d5f7ad2fbfa0800d65fc20f5a.tar craftbukkit-c07e32c1de57898d5f7ad2fbfa0800d65fc20f5a.tar.gz craftbukkit-c07e32c1de57898d5f7ad2fbfa0800d65fc20f5a.tar.lz craftbukkit-c07e32c1de57898d5f7ad2fbfa0800d65fc20f5a.tar.xz craftbukkit-c07e32c1de57898d5f7ad2fbfa0800d65fc20f5a.zip |
EntityTargetEvent
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityMobs.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityMobs.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/EntityMobs.java b/src/main/java/net/minecraft/server/EntityMobs.java index df910e41..e75b345c 100644 --- a/src/main/java/net/minecraft/server/EntityMobs.java +++ b/src/main/java/net/minecraft/server/EntityMobs.java @@ -5,10 +5,13 @@ import java.util.Random; // CraftBukkit start import org.bukkit.craftbukkit.entity.CraftMonster; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.EntityTargetEvent.TargetReason; // CraftBukkit end public class EntityMobs extends EntityCreature implements IMobs { @@ -57,7 +60,22 @@ public class EntityMobs extends EntityCreature implements IMobs { return true; } if (entity != this) { - d = entity; + // CraftBukkit start + org.bukkit.entity.Entity bukkitTarget = null; + if(entity != null) { + bukkitTarget = entity.getBukkitEntity(); + } + EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.TARGET_ATTACKED_ENTITY); + CraftServer server = ((WorldServer) this.l).getServer(); + server.getPluginManager().callEvent(event); + if(!event.isCancelled()) { + if(event.getTarget() == null) { + d = null; + } else { + d = ((CraftEntity) event.getTarget()).getHandle(); + } + } + // CraftBukkit end } return true; } else { |