Class CraftManager
java.lang.Object
me.wolfyscript.customcrafting.utils.CraftManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable org.bukkit.inventory.ItemStackcheckRecipe(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 singleCraftingRecipeand returns theCustomItemif it's valid.voidconsumeRecipe(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.booleanorg.bukkit.inventory.ItemStackpreCheckRecipe(org.bukkit.inventory.ItemStack[] matrix, org.bukkit.entity.Player player, org.bukkit.inventory.Inventory inventory, boolean elite, boolean advanced)Checks for a possibleCraftingRecipeand returns the result ItemStack of theCraftingRecipethat is valid.voidput(UUID uuid, CraftingData craftingData)Sets the current activeCraftingDatafor the player.voidRemoves 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 possibleCraftingRecipeand returns the result ItemStack of theCraftingRecipethat 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 singleCraftingRecipeand returns theCustomItemif it's valid.- Parameters:
recipe- TheCraftingRecipeto 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
CustomItemif theCraftingRecipeis 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 resultItemStackfrom the inventory.matrix- The matrix of the crafting grid. TheItemStacks of the matrix will be edited directly! It will not add new instances!event- TheInventoryClickEventthat caused this click.
-
put
Sets the current activeCraftingDatafor the player.- Parameters:
uuid- TheUUIDof the player.craftingData- TheCraftingDataof 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!
-