mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 02:22:12 +01:00
SPIGOT-5950: Add PrepareSmithingEvent event
By: jameslfc19 <jameslfc19@gmail.com>
This commit is contained in:
parent
4e44fa11b3
commit
0fac9ae437
1 changed files with 53 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue