001 package org.bukkit.event.inventory;
002
003 import org.bukkit.block.Block;
004 import org.bukkit.event.Cancellable;
005 import org.bukkit.event.HandlerList;
006 import org.bukkit.event.block.BlockEvent;
007 import org.bukkit.inventory.ItemStack;
008
009 /**
010 * Called when an ItemStack is successfully smelted in a furnace.
011 */
012 public class FurnaceSmeltEvent extends BlockEvent implements Cancellable {
013 private static final HandlerList handlers = new HandlerList();
014 private final ItemStack source;
015 private ItemStack result;
016 private boolean cancelled;
017
018 public FurnaceSmeltEvent(final Block furnace, final ItemStack source, final ItemStack result) {
019 super(furnace);
020 this.source = source;
021 this.result = result;
022 this.cancelled = false;
023 }
024
025 /**
026 * Gets the block for the furnace involved in this event
027 *
028 * @return the block of the furnace
029 * @deprecated In favour of {@link #getBlock()}.
030 */
031 @Deprecated
032 public Block getFurnace() {
033 return getBlock();
034 }
035
036 /**
037 * Gets the smelted ItemStack for this event
038 *
039 * @return smelting source ItemStack
040 */
041 public ItemStack getSource() {
042 return source;
043 }
044
045 /**
046 * Gets the resultant ItemStack for this event
047 *
048 * @return smelting result ItemStack
049 */
050 public ItemStack getResult() {
051 return result;
052 }
053
054 /**
055 * Sets the resultant ItemStack for this event
056 *
057 * @param result new result ItemStack
058 */
059 public void setResult(ItemStack result) {
060 this.result = result;
061 }
062
063 public boolean isCancelled() {
064 return cancelled;
065 }
066
067 public void setCancelled(boolean cancel) {
068 this.cancelled = cancel;
069 }
070
071 @Override
072 public HandlerList getHandlers() {
073 return handlers;
074 }
075
076 public static HandlerList getHandlerList() {
077 return handlers;
078 }
079 }