Package com.ranull.graves.manager
Class RecipeManager
java.lang.Object
com.ranull.graves.manager.RecipeManager
6
Manages custom recipes for the Graves plugin.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRecipeManager
(Graves plugin) Initializes a new instance of the RecipeManager class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
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
load()
Loads the recipes from the configuration.void
reload()
Reloads the recipes.void
setRecipeData
(String token, org.bukkit.inventory.ItemStack itemStack) Sets the recipe data on an item stack.void
unload()
Unloads the custom recipes.
-
Field Details
-
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
A list ofNamespacedKey
objects used for managing and accessing custom data.This
List
holdsNamespacedKey
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
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
Retrieves the token item based on the configuration.- Parameters:
token
- The token identifier.- Returns:
- The token item.
-
getTokenList
Retrieves the list of tokens from the configuration.- Returns:
- The list of token identifiers.
-
addTokenRecipe
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
Sets the recipe data on an item stack.- Parameters:
token
- The token identifier.itemStack
- The item stack.
-
isToken
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
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.
-