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

org.bukkit.event.inventory.FurnaceSmeltEvent Maven / Gradle / Ivy

package org.bukkit.event.inventory;

import org.bukkit.block.Block;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockEvent;
import org.bukkit.inventory.ItemStack;

/**
 * Called when an ItemStack is successfully smelted in a furnace.
 */
public class FurnaceSmeltEvent extends BlockEvent implements Cancellable {
  private static final HandlerList handlers = new HandlerList();
  private final ItemStack source;
  private ItemStack result;
  private boolean cancelled;

  public FurnaceSmeltEvent(final Block furnace, final ItemStack source, final ItemStack result) {
    super(furnace);
    this.source = source;
    this.result = result;
    this.cancelled = false;
  }

  public static HandlerList getHandlerList() {
    return handlers;
  }

  /**
   * Gets the block for the furnace involved in this event
   *
   * @return the block of the furnace
   * @deprecated In favour of {@link #getBlock()}.
   */
  @Deprecated
  public Block getFurnace() {
    return getBlock();
  }

  /**
   * Gets the smelted ItemStack for this event
   *
   * @return smelting source ItemStack
   */
  public ItemStack getSource() {
    return source;
  }

  /**
   * Gets the resultant ItemStack for this event
   *
   * @return smelting result ItemStack
   */
  public ItemStack getResult() {
    return result;
  }

  /**
   * Sets the resultant ItemStack for this event
   *
   * @param result new result ItemStack
   */
  public void setResult(ItemStack result) {
    this.result = result;
  }

  public boolean isCancelled() {
    return cancelled;
  }

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy