diff options
author | t00thpick1 <t00thpick1dirko@gmail.com> | 2013-12-11 13:13:06 -0500 |
---|---|---|
committer | Nate Mortensen <nate.richard.mortensen@gmail.com> | 2013-12-13 22:20:39 -0700 |
commit | ae9cd0729e26b5f271989579c12f8fec38060a19 (patch) | |
tree | 9c7aabbb3543de36b74de44fa90f4c3372e7b0ff /src/main | |
parent | 1154484815d665a8103763a6e4e1bc7811f8f592 (diff) | |
download | craftbukkit-ae9cd0729e26b5f271989579c12f8fec38060a19.tar craftbukkit-ae9cd0729e26b5f271989579c12f8fec38060a19.tar.gz craftbukkit-ae9cd0729e26b5f271989579c12f8fec38060a19.tar.lz craftbukkit-ae9cd0729e26b5f271989579c12f8fec38060a19.tar.xz craftbukkit-ae9cd0729e26b5f271989579c12f8fec38060a19.zip |
[Bleeding] Call EntityTargetEvent for EnderDragons. Fixes BUKKIT-5160
EnderDragons did not call an EntityTargetEvent when they
were targeting random players in the End. This commit
adds that event call into the targeting code.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityEnderDragon.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java index 6cb09c43..68e97f17 100644 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java @@ -10,6 +10,7 @@ import org.bukkit.event.entity.EntityCreatePortalEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.Bukkit; // CraftBukkit end @@ -377,7 +378,19 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo private void bO() { this.bz = false; if (this.random.nextInt(2) == 0 && !this.world.players.isEmpty()) { - this.bD = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size())); + // CraftBukkit start + Entity target = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size())); + EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.RANDOM_TARGET); + this.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + if (event.getTarget() == null) { + this.bD = null; + } else { + this.bD = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle(); + } + } + // CraftBukkit end } else { boolean flag = false; |