diff options
author | GJ <gjmcferrin@gmail.com> | 2014-02-05 11:56:37 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2014-04-18 10:43:06 -0500 |
commit | 890a4af12fce9c28dcc69aebf14078420293dc00 (patch) | |
tree | 05a1f7938e78c3040aac869a25678c07750c7b13 /src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java | |
parent | 3abba823151c87050fb7680c3a7194eb1fe5d64d (diff) | |
download | craftbukkit-890a4af12fce9c28dcc69aebf14078420293dc00.tar craftbukkit-890a4af12fce9c28dcc69aebf14078420293dc00.tar.gz craftbukkit-890a4af12fce9c28dcc69aebf14078420293dc00.tar.lz craftbukkit-890a4af12fce9c28dcc69aebf14078420293dc00.tar.xz craftbukkit-890a4af12fce9c28dcc69aebf14078420293dc00.zip |
[Bleeding] Call EntityTargetEvent in many new places.
Adds BUKKIT-5388, BUKKIT-5387, BUKKIT-5386, BUKKIT-5483, BUKKIT-5484.
Fixes BUKKIT-5389.
Diffstat (limited to 'src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java')
-rw-r--r-- | src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java index 6686f059..2a0404ee 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java @@ -32,7 +32,13 @@ public class PathfinderGoalHurtByTarget extends PathfinderGoalTarget { EntityCreature entitycreature = (EntityCreature) iterator.next(); if (this.c != entitycreature && entitycreature.getGoalTarget() == null && !entitycreature.c(this.c.getLastDamager())) { - entitycreature.setGoalTarget(this.c.getLastDamager()); + // CraftBukkit start - call EntityTargetEvent + org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(entitycreature, this.c.getLastDamager(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY); + if (event.isCancelled()) { + continue; + } + entitycreature.setGoalTarget(event.getTarget() == null ? null : ((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getTarget()).getHandle()); + // CraftBukkit end } } } |