63 lines
1.4 KiB
Java
63 lines
1.4 KiB
Java
package org.bukkit.event.entity;
|
|
|
|
import org.bukkit.Material;
|
|
import org.bukkit.block.Block;
|
|
import org.bukkit.entity.Entity;
|
|
import org.bukkit.event.Cancellable;
|
|
import org.bukkit.event.HandlerList;
|
|
|
|
@SuppressWarnings("serial")
|
|
/**
|
|
* 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 Entity what, final Block block, final Material to) {
|
|
super(what);
|
|
this.block = block;
|
|
this.cancel = false;
|
|
this.to = to;
|
|
}
|
|
|
|
/**
|
|
* 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;
|
|
}
|
|
}
|