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 burned as fuel in a furnace.
011 */
012 public class FurnaceBurnEvent extends BlockEvent implements Cancellable {
013 private static final HandlerList handlers = new HandlerList();
014 private final ItemStack fuel;
015 private int burnTime;
016 private boolean cancelled;
017 private boolean burning;
018
019 public FurnaceBurnEvent(final Block furnace, final ItemStack fuel, final int burnTime) {
020 super(furnace);
021 this.fuel = fuel;
022 this.burnTime = burnTime;
023 this.cancelled = false;
024 this.burning = true;
025 }
026
027 /**
028 * Gets the block for the furnace involved in this event
029 *
030 * @return the block of the furnace
031 * @deprecated In favour of {@link #getBlock()}.
032 */
033 @Deprecated
034 public Block getFurnace() {
035 return getBlock();
036 }
037
038 /**
039 * Gets the fuel ItemStack for this event
040 *
041 * @return the fuel ItemStack
042 */
043 public ItemStack getFuel() {
044 return fuel;
045 }
046
047 /**
048 * Gets the burn time for this fuel
049 *
050 * @return the burn time for this fuel
051 */
052 public int getBurnTime() {
053 return burnTime;
054 }
055
056 /**
057 * Sets the burn time for this fuel
058 *
059 * @param burnTime the burn time for this fuel
060 */
061 public void setBurnTime(int burnTime) {
062 this.burnTime = burnTime;
063 }
064
065 /**
066 * Gets whether the furnace's fuel is burning or not.
067 *
068 * @return whether the furnace's fuel is burning or not.
069 */
070 public boolean isBurning() {
071 return this.burning;
072 }
073
074 /**
075 * Sets whether the furnace's fuel is burning or not.
076 *
077 * @param burning true if the furnace's fuel is burning
078 */
079 public void setBurning(boolean burning) {
080 this.burning = burning;
081 }
082
083 public boolean isCancelled() {
084 return cancelled;
085 }
086
087 public void setCancelled(boolean cancel) {
088 this.cancelled = cancel;
089 }
090
091 @Override
092 public HandlerList getHandlers() {
093 return handlers;
094 }
095
096 public static HandlerList getHandlerList() {
097 return handlers;
098 }
099 }