001 package org.bukkit.event.entity; 002 003 import org.bukkit.entity.AnimalTamer; 004 import org.bukkit.entity.LivingEntity; 005 import org.bukkit.event.Cancellable; 006 import org.bukkit.event.HandlerList; 007 008 /** 009 * Thrown when a LivingEntity is tamed 010 */ 011 public class EntityTameEvent extends EntityEvent implements Cancellable { 012 private static final HandlerList handlers = new HandlerList(); 013 private boolean cancelled; 014 private final AnimalTamer owner; 015 016 public EntityTameEvent(final LivingEntity entity, final AnimalTamer owner) { 017 super(entity); 018 this.owner = owner; 019 } 020 021 @Override 022 public LivingEntity getEntity() { 023 return (LivingEntity) entity; 024 } 025 026 public boolean isCancelled() { 027 return cancelled; 028 } 029 030 public void setCancelled(boolean cancel) { 031 cancelled = cancel; 032 } 033 034 /** 035 * Gets the owning AnimalTamer 036 * 037 * @return the owning AnimalTamer 038 */ 039 public AnimalTamer getOwner() { 040 return owner; 041 } 042 043 @Override 044 public HandlerList getHandlers() { 045 return handlers; 046 } 047 048 public static HandlerList getHandlerList() { 049 return handlers; 050 } 051 }