All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bukkit.event.painting.PaintingBreakEvent Maven / Gradle / Ivy

package org.bukkit.event.painting;

import org.bukkit.Warning;
import org.bukkit.entity.Painting;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;

/**
 * Triggered when a painting is removed
 *
 * @deprecated Use {@link org.bukkit.event.hanging.HangingBreakEvent} instead.
 */
@Deprecated
@Warning(reason = "This event has been replaced by HangingBreakEvent")
public class PaintingBreakEvent extends PaintingEvent implements Cancellable {
  private static final HandlerList handlers = new HandlerList();
  private final RemoveCause cause;
  private boolean cancelled;

  public PaintingBreakEvent(final Painting painting, final RemoveCause cause) {
    super(painting);
    this.cause = cause;
  }

  public static HandlerList getHandlerList() {
    return handlers;
  }

  /**
   * Gets the cause for the painting's removal
   *
   * @return the RemoveCause for the painting's removal
   */
  public RemoveCause getCause() {
    return cause;
  }

  public boolean isCancelled() {
    return cancelled;
  }

  public void setCancelled(boolean cancel) {
    this.cancelled = cancel;
  }

  @Override
  public HandlerList getHandlers() {
    return handlers;
  }

  /**
   * An enum to specify the cause of the removal
   */
  public enum RemoveCause {
    /**
     * Removed by an entity
     */
    ENTITY,
    /**
     * Removed by fire
     */
    FIRE,
    /**
     * Removed by placing a block on it
     */
    OBSTRUCTION,
    /**
     * Removed by water flowing over it
     */
    WATER,
    /**
     * Removed by destroying the block behind it, etc
     */
    PHYSICS,
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy