Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
EntityTargetLivingEntityEvent.java
1 package org.bukkit.event.entity;
2 
3 import org.bukkit.entity.Entity;
5 
6 /**
7  * Called when an Entity targets a {@link LivingEntity} and can only target
8  * LivingEntity's.
9  */
11  public EntityTargetLivingEntityEvent(final Entity entity, final LivingEntity target, final TargetReason reason) {
12  super(entity, target, reason);
13  }
14 
15  public LivingEntity getTarget() {
16  return (LivingEntity) super.getTarget();
17  }
18 
19  /**
20  * Set the Entity that you want the mob to target.
21  * <p>
22  * It is possible to be null, null will cause the entity to be
23  * target-less.
24  * <p>
25  * Must be a LivingEntity, or null.
26  *
27  * @param target The entity to target
28  */
29  public void setTarget(Entity target) {
30  if (target == null || target instanceof LivingEntity) {
31  super.setTarget(target);
32  }
33  }
34 }