mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-31 22:22:49 +00:00
SPIGOT-8014: Add method for getting and setting remaining items in CrafterCraftEvent
This commit is contained in:
parent
c0ecd48cfd
commit
b00ec19acf
1 changed files with 19 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
package org.bukkit.event.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
@ -15,12 +17,19 @@ public class CrafterCraftEvent extends BlockEvent implements Cancellable {
|
|||
private static final HandlerList handlers = new HandlerList();
|
||||
private final CraftingRecipe recipe;
|
||||
private ItemStack result;
|
||||
private List<ItemStack> remainingItems;
|
||||
private boolean cancelled;
|
||||
|
||||
@Deprecated
|
||||
public CrafterCraftEvent(@NotNull Block theBlock, @NotNull CraftingRecipe recipe, @NotNull ItemStack result) {
|
||||
this(theBlock, recipe, result, new ArrayList<>());
|
||||
}
|
||||
|
||||
public CrafterCraftEvent(@NotNull Block theBlock, @NotNull CraftingRecipe recipe, @NotNull ItemStack result, @NotNull List<ItemStack> remainingItems) {
|
||||
super(theBlock);
|
||||
this.result = result;
|
||||
this.recipe = recipe;
|
||||
this.remainingItems = remainingItems;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,6 +51,16 @@ public class CrafterCraftEvent extends BlockEvent implements Cancellable {
|
|||
this.result = result.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the items that will remain after the recipe has been crafted.
|
||||
*
|
||||
* @return a list of the remaining items
|
||||
*/
|
||||
@NotNull
|
||||
public List<ItemStack> getRemainingItems() {
|
||||
return remainingItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the recipe that was used to craft this item.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue