From c30e6c45cd0a20c8d084f90e3e6cc8da6ba03d16 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sat, 17 Jul 2021 11:19:48 +1000 Subject: [PATCH] #636: Add FurnaceStartSmeltEvent By: Rabbitual <38820203+Rabbitual@users.noreply.github.com> --- .../inventory/FurnaceStartSmeltEvent.java | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 paper-api/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java diff --git a/paper-api/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java b/paper-api/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java new file mode 100644 index 0000000000..533a33dbd4 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java @@ -0,0 +1,71 @@ +package org.bukkit.event.inventory; + +import org.bukkit.block.Block; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockEvent; +import org.bukkit.inventory.CookingRecipe; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.NotNull; + +public class FurnaceStartSmeltEvent extends BlockEvent { + private static final HandlerList handlers = new HandlerList(); + private final ItemStack source; + private final CookingRecipe recipe; + private int totalCookTime; + + public FurnaceStartSmeltEvent(@NotNull final Block furnace, @NotNull ItemStack source, @NotNull final CookingRecipe recipe) { + super(furnace); + this.source = source; + this.recipe = recipe; + this.totalCookTime = recipe.getCookingTime(); + } + + /** + * Gets the source ItemStack for this event + * + * @return the source ItemStack + */ + @NotNull + public ItemStack getSource() { + return source; + } + + /** + * Gets the FurnaceRecipe associated with this event + * + * @return the FurnaceRecipe being cooked + */ + @NotNull + public CookingRecipe getRecipe() { + return recipe; + } + + /** + * Gets the total cook time associated with this event + * + * @return the total cook time + */ + public int getTotalCookTime() { + return totalCookTime; + } + + /** + * Sets the total cook time for this event + * + * @param cookTime the new total cook time + */ + public void setTotalCookTime(int cookTime) { + this.totalCookTime = cookTime; + } + + @NotNull + @Override + public HandlerList getHandlers() { + return handlers; + } + + @NotNull + public static HandlerList getHandlerList() { + return handlers; + } +}