001 package org.bukkit.event.entity;
002
003 import org.bukkit.entity.Entity;
004 import org.bukkit.entity.LivingEntity;
005
006 /**
007 * Called when an Entity targets a {@link LivingEntity} and can only target
008 * LivingEntity's.
009 */
010 public class EntityTargetLivingEntityEvent extends EntityTargetEvent{
011 public EntityTargetLivingEntityEvent(final Entity entity, final LivingEntity target, final TargetReason reason) {
012 super(entity, target, reason);
013 }
014
015 public LivingEntity getTarget() {
016 return (LivingEntity) super.getTarget();
017 }
018
019 /**
020 * Set the Entity that you want the mob to target.
021 * <p>
022 * It is possible to be null, null will cause the entity to be
023 * target-less.
024 * <p>
025 * Must be a LivingEntity, or null.
026 *
027 * @param target The entity to target
028 */
029 public void setTarget(Entity target) {
030 if (target == null || target instanceof LivingEntity) {
031 super.setTarget(target);
032 }
033 }
034 }