[Bleeding] Add new sub-event for target goals, and DEFEND_VILLAGE TargetReason. Fixes BUKKIT-935

This commit is contained in:
feildmaster
2012-03-08 18:26:46 -06:00
committed by EvilSeph
parent 4c2068702a
commit 37f1ab2052
2 changed files with 37 additions and 2 deletions

View File

@@ -0,0 +1,32 @@
package org.bukkit.event.entity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
/**
* Called when an Entity targets a {@link LivingEntity} and can only target LivingEntity's.
*/
public class EntityTargetLivingEntityEvent extends EntityTargetEvent{
public EntityTargetLivingEntityEvent(final Entity entity, final LivingEntity target, final TargetReason reason) {
super(entity, target, reason);
}
public LivingEntity getTarget() {
return (LivingEntity) super.getTarget();
}
/**
* Set the Entity that you want the mob to target.
* It is possible to be null, null will cause the entity to be
* target-less.
* <p />
* Must be a LivingEntity, or null
*
* @param target The entity to target
*/
public void setTarget(Entity target) {
if (target == null || target instanceof LivingEntity) {
super.setTarget(target);
}
}
}