SPIGOT-5950: Add PrepareSmithingEvent event

By: jameslfc19 <jameslfc19@gmail.com>
This commit is contained in:
Bukkit/Spigot 2020-07-22 18:21:43 +10:00
parent 4e44fa11b3
commit 0fac9ae437

View file

@ -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;
}
}