Class CraftManager

java.lang.Object
me.wolfyscript.customcrafting.utils.CraftManager

public class CraftManager extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    CraftManager​(CustomCrafting customCrafting)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @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 single CraftingRecipe and returns the CustomItem 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
    has​(UUID uuid)
     
    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 possible CraftingRecipe and returns the result ItemStack of the CraftingRecipe that is valid.
    void
    put​(UUID uuid, CraftingData craftingData)
    Sets the current active CraftingData for the player.
    void
    remove​(UUID uuid)
    Removes the active CustomRecipe of the specified player.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CraftManager

      public CraftManager(CustomCrafting customCrafting)
  • 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 possible CraftingRecipe and returns the result ItemStack of the CraftingRecipe 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 single CraftingRecipe and returns the CustomItem if it's valid.
      Parameters:
      recipe - The CraftingRecipe to check.
      ingredients - The ingredients of the matrix without surrounding empty columns/rows (via DataHandler.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 the CraftingRecipe 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 result ItemStack from the inventory.
      matrix - The matrix of the crafting grid. The ItemStacks of the matrix will be edited directly! It will not add new instances!
      event - The InventoryClickEvent that caused this click.
    • put

      public void put(UUID uuid, CraftingData craftingData)
      Sets the current active CraftingData for the player.
      Parameters:
      uuid - The UUID of the player.
      craftingData - The CraftingData of the latest check.
    • remove

      public void remove(UUID uuid)
      Removes the active CustomRecipe of the specified player.
      Parameters:
      uuid - The UUID of the player.
    • has

      public boolean has(UUID uuid)
      Parameters:
      uuid - The uuid of the player.
      Returns:
      If the player has an active CustomRecipe.
    • getRecipeUtils

      @Deprecated public RecipeUtils getRecipeUtils()
      Deprecated.
      Returns:
      The old deprecated RecipeUtils!