package org.bukkit.event.entity; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; /** * Called when a LivingEntity changes a block * * This event specifically excludes player entities */ public class EntityChangeBlockEvent extends EntityEvent implements Cancellable { private static final HandlerList handlers = new HandlerList(); private final Block block; private boolean cancel; private final Material to; public EntityChangeBlockEvent(final LivingEntity what, final Block block, final Material to) { super(what); this.block = block; this.cancel = false; this.to = to; } @Override public LivingEntity getEntity() { return (LivingEntity) entity; } /** * Gets the block the entity is changing * * @return the block that is changing */ public Block getBlock() { return block; } public boolean isCancelled() { return cancel; } public void setCancelled(boolean cancel) { this.cancel = cancel; } /** * Gets the Material that the block is changing into * * @return the material that the block is changing into */ public Material getTo() { return to; } @Override public HandlerList getHandlers() { return handlers; } public static HandlerList getHandlerList() { return handlers; } }