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 TypeMethodDescriptionvoidaddTokenRecipe(String token, org.bukkit.inventory.ItemStack itemStack) Adds a custom token recipe.private chargetChar(int count) Gets the character for a recipe slot based on the count.org.bukkit.inventory.ItemStackgetGraveTokenFromPlayer(String token, List<org.bukkit.inventory.ItemStack> itemStackList) Retrieves a token item from a player's inventory.org.bukkit.inventory.ItemStackRetrieves 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.booleanChecks if an item stack is a token of a specified type.booleanisToken(org.bukkit.inventory.ItemStack itemStack) Checks if an item stack is a token.voidload()Loads the recipes from the configuration.voidreload()Reloads the recipes.voidsetRecipeData(String token, org.bukkit.inventory.ItemStack itemStack) Sets the recipe data on an item stack.voidunload()Unloads the custom recipes.
-
Field Details
-
plugin
The main plugin instance associated with Graves.This
Gravesinstance represents the core plugin that Graves is part of. It provides access to the plugin's functionality, configuration, and other services. -
namespacedKeyList
A list ofNamespacedKeyobjects used for managing and accessing custom data.This
ListholdsNamespacedKeyinstances 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.
-