001 package org.bukkit.event.painting;
002
003 import org.bukkit.Warning;
004 import org.bukkit.entity.Painting;
005 import org.bukkit.event.Cancellable;
006 import org.bukkit.event.HandlerList;
007
008 /**
009 * Triggered when a painting is removed
010 *
011 * @deprecated Use {@link org.bukkit.event.hanging.HangingBreakEvent} instead.
012 */
013 @Deprecated
014 @Warning(reason="This event has been replaced by HangingBreakEvent")
015 public class PaintingBreakEvent extends PaintingEvent implements Cancellable {
016 private static final HandlerList handlers = new HandlerList();
017 private boolean cancelled;
018 private final RemoveCause cause;
019
020 public PaintingBreakEvent(final Painting painting, final RemoveCause cause) {
021 super(painting);
022 this.cause = cause;
023 }
024
025 /**
026 * Gets the cause for the painting's removal
027 *
028 * @return the RemoveCause for the painting's removal
029 */
030 public RemoveCause getCause() {
031 return cause;
032 }
033
034 public boolean isCancelled() {
035 return cancelled;
036 }
037
038 public void setCancelled(boolean cancel) {
039 this.cancelled = cancel;
040 }
041
042 /**
043 * An enum to specify the cause of the removal
044 */
045 public enum RemoveCause {
046 /**
047 * Removed by an entity
048 */
049 ENTITY,
050 /**
051 * Removed by fire
052 */
053 FIRE,
054 /**
055 * Removed by placing a block on it
056 */
057 OBSTRUCTION,
058 /**
059 * Removed by water flowing over it
060 */
061 WATER,
062 /**
063 * Removed by destroying the block behind it, etc
064 */
065 PHYSICS,
066 }
067
068 @Override
069 public HandlerList getHandlers() {
070 return handlers;
071 }
072
073 public static HandlerList getHandlerList() {
074 return handlers;
075 }
076 }