Class CraftManager
java.lang.Object
me.wolfyscript.customcrafting.utils.CraftManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable org.bukkit.inventory.ItemStack
checkRecipe(CraftingRecipe<?> recipe, List<List<org.bukkit.inventory.ItemStack>> ingredients, org.bukkit.entity.Player player, org.bukkit.block.Block block, org.bukkit.inventory.Inventory inventory)
Checks one singleCraftingRecipe
and returns theCustomItem
if it's valid.void
consumeRecipe(org.bukkit.inventory.ItemStack result, org.bukkit.inventory.ItemStack[] matrix, org.bukkit.event.inventory.InventoryClickEvent event)
Consumes the active Recipe from the matrix and sets the correct item to the cursor.Deprecated.boolean
org.bukkit.inventory.ItemStack
preCheckRecipe(org.bukkit.inventory.ItemStack[] matrix, org.bukkit.entity.Player player, org.bukkit.inventory.Inventory inventory, boolean elite, boolean advanced)
Checks for a possibleCraftingRecipe
and returns the result ItemStack of theCraftingRecipe
that is valid.void
put(UUID uuid, CraftingData craftingData)
Sets the current activeCraftingData
for the player.void
Removes the active CustomRecipe of the specified player.
-
Constructor Details
-
CraftManager
-
-
Method Details
-
preCheckRecipe
public org.bukkit.inventory.ItemStack preCheckRecipe(org.bukkit.inventory.ItemStack[] matrix, org.bukkit.entity.Player player, org.bukkit.inventory.Inventory inventory, boolean elite, boolean advanced)Checks for a possibleCraftingRecipe
and returns the result ItemStack of theCraftingRecipe
that is valid.- Parameters:
matrix
- The matrix of the crafting grid.player
- The player that executed the craft.inventory
- The inventory this craft was called from.elite
- If the workstation is an Elite Crafting Table.advanced
- If the workstation is an Advanced Crafting Table.- Returns:
- The result ItemStack of the valid
CraftingRecipe
.
-
checkRecipe
@Nullable public @Nullable org.bukkit.inventory.ItemStack checkRecipe(CraftingRecipe<?> recipe, List<List<org.bukkit.inventory.ItemStack>> ingredients, org.bukkit.entity.Player player, org.bukkit.block.Block block, org.bukkit.inventory.Inventory inventory)Checks one singleCraftingRecipe
and returns theCustomItem
if it's valid.- Parameters:
recipe
- TheCraftingRecipe
to check.ingredients
- The ingredients of the matrix without surrounding empty columns/rows (viaDataHandler.getIngredients(ItemStack[])
).player
- The player that crafts it.block
- The block of the workstation or players inventory.inventory
- The inventory of the workstation or player.- Returns:
- The result
CustomItem
if theCraftingRecipe
is valid. Else null.
-
consumeRecipe
public void consumeRecipe(org.bukkit.inventory.ItemStack result, org.bukkit.inventory.ItemStack[] matrix, org.bukkit.event.inventory.InventoryClickEvent event)Consumes the active Recipe from the matrix and sets the correct item to the cursor.- Parameters:
result
- The resultItemStack
from the inventory.matrix
- The matrix of the crafting grid. TheItemStack
s of the matrix will be edited directly! It will not add new instances!event
- TheInventoryClickEvent
that caused this click.
-
put
Sets the current activeCraftingData
for the player.- Parameters:
uuid
- TheUUID
of the player.craftingData
- TheCraftingData
of the latest check.
-
remove
Removes the active CustomRecipe of the specified player.- Parameters:
uuid
- The UUID of the player.
-
has
- Parameters:
uuid
- The uuid of the player.- Returns:
- If the player has an active CustomRecipe.
-
getRecipeUtils
Deprecated.- Returns:
- The old deprecated RecipeUtils!
-