From 0fac9ae437473f072b0914b9f4ee6d1d148347ec Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 22 Jul 2020 18:21:43 +1000 Subject: [PATCH] SPIGOT-5950: Add PrepareSmithingEvent event By: jameslfc19 --- .../event/inventory/PrepareSmithingEvent.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 paper-api/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java 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; + } +}