Bukkit/src/main/java/org/bukkit/event/hanging/HangingBreakEvent.java
2012-10-31 00:21:04 -04:00

64 lines
1.5 KiB
Java

package org.bukkit.event.hanging;
import org.bukkit.entity.Hanging;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/**
* Triggered when a hanging entity is removed
*/
public class HangingBreakEvent extends HangingEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private final HangingBreakEvent.RemoveCause cause;
public HangingBreakEvent(final Hanging hanging, final HangingBreakEvent.RemoveCause cause) {
super(hanging);
this.cause = cause;
}
/**
* Gets the cause for the hanging entity's removal
*
* @return the RemoveCause for the hanging entity's removal
*/
public HangingBreakEvent.RemoveCause getCause() {
return cause;
}
public boolean isCancelled() {
return cancelled;
}
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}
/**
* An enum to specify the cause of the removal
*/
public enum RemoveCause {
/**
* Removed by an entity
*/
ENTITY,
/**
* Removed by placing a block on it
*/
OBSTRUCTION,
/**
* Removed by destroying the block behind it, etc
*/
PHYSICS,
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}