001 package org.bukkit.event.entity;
002
003 import org.bukkit.block.Block;
004 import org.bukkit.entity.Entity;
005 import org.bukkit.event.Cancellable;
006 import org.bukkit.event.HandlerList;
007
008 /**
009 * Called when an entity interacts with an object
010 */
011 public class EntityInteractEvent extends EntityEvent implements Cancellable {
012 private static final HandlerList handlers = new HandlerList();
013 protected Block block;
014 private boolean cancelled;
015
016 public EntityInteractEvent(final Entity entity, final Block block) {
017 super(entity);
018 this.block = block;
019 }
020
021 public boolean isCancelled() {
022 return cancelled;
023 }
024
025 public void setCancelled(boolean cancel) {
026 cancelled = cancel;
027 }
028
029 /**
030 * Returns the involved block
031 *
032 * @return the block clicked with this item.
033 */
034 public Block getBlock() {
035 return block;
036 }
037
038 @Override
039 public HandlerList getHandlers() {
040 return handlers;
041 }
042
043 public static HandlerList getHandlerList() {
044 return handlers;
045 }
046 }