diff --git a/paper-api/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java b/paper-api/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java new file mode 100644 index 0000000000..99af154032 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java @@ -0,0 +1,53 @@ +package org.bukkit.event.inventory; + +import org.bukkit.event.HandlerList; +import org.bukkit.inventory.InventoryView; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.SmithingInventory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Called when an item is put in a slot for upgrade by a Smithing Table. + */ +public class PrepareSmithingEvent extends InventoryEvent { + + private static final HandlerList handlers = new HandlerList(); + private ItemStack result; + + public PrepareSmithingEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { + super(inventory); + this.result = result; + } + + @NotNull + @Override + public SmithingInventory getInventory() { + return (SmithingInventory) super.getInventory(); + } + + /** + * Get result item, may be null. + * + * @return result item + */ + @Nullable + public ItemStack getResult() { + return result; + } + + public void setResult(@Nullable ItemStack result) { + this.result = result; + } + + @NotNull + @Override + public HandlerList getHandlers() { + return handlers; + } + + @NotNull + public static HandlerList getHandlerList() { + return handlers; + } +}