else if(this instanceof DesireProtectOwner)
reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER;
else if(this instanceof DesireHelpAttacking)
reason = EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET;
EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(this.getEntityHandle(), inEntity, reason);
if(event.isCancelled() || event.getTarget() == null)
{
if(this.getEntityHandle() instanceof EntityCreature)
NMSUtil.setGoalTarget(this.getEntityHandle(), null);
return false;
}
else if(inEntity.getBukkitEntity() != event.getTarget())
NMSUtil.setGoalTarget(this.getEntityHandle(), (EntityLiving)((CraftEntity) event.getTarget()).getHandle());
if(this.getEntityHandle() instanceof EntityCreature)
((EntityCreature)this.getEntityHandle()).target = ((CraftEntity) event.getTarget()).getHandle();
return true;
}
}