Package org.bukkit.event.entity

Examples of org.bukkit.event.entity.EntityTargetLivingEntityEvent


        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;
      }
    }
View Full Code Here

TOP

Related Classes of org.bukkit.event.entity.EntityTargetLivingEntityEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.