Class RecipeManager

java.lang.Object
com.ranull.graves.manager.RecipeManager

public final class RecipeManager extends Object
6 Manages custom recipes for the Graves plugin.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final List<org.bukkit.NamespacedKey>
    A list of NamespacedKey objects used for managing and accessing custom data.
    private final Graves
    The main plugin instance associated with Graves.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initializes a new instance of the RecipeManager class.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addTokenRecipe(String token, org.bukkit.inventory.ItemStack itemStack)
    Adds a custom token recipe.
    private char
    getChar(int count)
    Gets the character for a recipe slot based on the count.
    org.bukkit.inventory.ItemStack
    getGraveTokenFromPlayer(String token, List<org.bukkit.inventory.ItemStack> itemStackList)
    Retrieves a token item from a player's inventory.
    org.bukkit.inventory.ItemStack
    Retrieves the token item based on the configuration.
    Retrieves the list of tokens from the configuration.
    getTokenName(org.bukkit.inventory.ItemStack itemStack)
    Retrieves the token name from an item stack.
    boolean
    isToken(String token, org.bukkit.inventory.ItemStack itemStack)
    Checks if an item stack is a token of a specified type.
    boolean
    isToken(org.bukkit.inventory.ItemStack itemStack)
    Checks if an item stack is a token.
    void
    Loads the recipes from the configuration.
    void
    Reloads the recipes.
    void
    setRecipeData(String token, org.bukkit.inventory.ItemStack itemStack)
    Sets the recipe data on an item stack.
    void
    Unloads the custom recipes.

    Methods inherited from class java.lang.Object

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

    • plugin

      private final Graves plugin
      The main plugin instance associated with Graves.

      This Graves instance represents the core plugin that Graves is part of. It provides access to the plugin's functionality, configuration, and other services.

    • namespacedKeyList

      private final List<org.bukkit.NamespacedKey> namespacedKeyList
      A list of NamespacedKey objects used for managing and accessing custom data.

      This List holds NamespacedKey instances which are used to uniquely identify and manage custom data keys within Graves. Namespaced keys are crucial for avoiding key collisions in persistent data containers.

  • Constructor Details

    • RecipeManager

      public RecipeManager(Graves plugin)
      Initializes a new instance of the RecipeManager class.
      Parameters:
      plugin - The plugin instance.
  • Method Details

    • reload

      public void reload()
      Reloads the recipes.
    • load

      public void load()
      Loads the recipes from the configuration.
    • unload

      public void unload()
      Unloads the custom recipes.
    • getToken

      public org.bukkit.inventory.ItemStack getToken(String token)
      Retrieves the token item based on the configuration.
      Parameters:
      token - The token identifier.
      Returns:
      The token item.
    • getTokenList

      public List<String> getTokenList()
      Retrieves the list of tokens from the configuration.
      Returns:
      The list of token identifiers.
    • addTokenRecipe

      public void addTokenRecipe(String token, org.bukkit.inventory.ItemStack itemStack)
      Adds a custom token recipe.
      Parameters:
      token - The token identifier.
      itemStack - The item stack representing the token.
    • getGraveTokenFromPlayer

      public org.bukkit.inventory.ItemStack getGraveTokenFromPlayer(String token, List<org.bukkit.inventory.ItemStack> itemStackList)
      Retrieves a token item from a player's inventory.
      Parameters:
      token - The token identifier.
      itemStackList - The list of item stacks in the player's inventory.
      Returns:
      The token item stack, or null if not found.
    • setRecipeData

      public void setRecipeData(String token, org.bukkit.inventory.ItemStack itemStack)
      Sets the recipe data on an item stack.
      Parameters:
      token - The token identifier.
      itemStack - The item stack.
    • isToken

      public boolean isToken(String token, org.bukkit.inventory.ItemStack itemStack)
      Checks if an item stack is a token of a specified type.
      Parameters:
      token - The token identifier.
      itemStack - The item stack.
      Returns:
      True if the item stack is a token of the specified type, otherwise false.
    • getTokenName

      public String getTokenName(org.bukkit.inventory.ItemStack itemStack)
      Retrieves the token name from an item stack.
      Parameters:
      itemStack - The item stack.
      Returns:
      The token name, or null if not found.
    • isToken

      public boolean isToken(org.bukkit.inventory.ItemStack itemStack)
      Checks if an item stack is a token.
      Parameters:
      itemStack - The item stack.
      Returns:
      True if the item stack is a token, otherwise false.
    • getChar

      private char getChar(int count)
      Gets the character for a recipe slot based on the count.
      Parameters:
      count - The count.
      Returns:
      The character for the recipe slot.