Class CraftRecipe
java.lang.Object
valorless.valorlessutils.crafting.CraftRecipe
- All Implemented Interfaces:
- org.bukkit.event.Listener
Represents a custom crafting recipe in Minecraft.
 
Supports both shaped and shapeless recipes using the base Minecraft crafting system. Recipes can optionally require a permission to craft.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumEnum representing the type of crafting recipe.
- 
Constructor SummaryConstructorsConstructorDescriptionCraftRecipe(org.bukkit.plugin.java.JavaPlugin plugin, String recipe, CraftRecipe.RecipeType type, List<Ingredient> ingredients, org.bukkit.inventory.ItemStack result, List<String>... shape) Constructs a new CraftRecipe.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd()Adds this recipe to the server.Gets the ingredients of the recipe.org.bukkit.permissions.PermissionGets the permission required to craft this recipe.org.bukkit.inventory.ItemStackGets the result of the recipe.GetShape()Gets the shape of the recipe.GetType()Gets the recipe type.voidonPrepareItemCraft(org.bukkit.event.inventory.PrepareItemCraftEvent event) Event handler for when a player prepares an item for crafting.voidRemove()Removes this recipe from the server.voidSetIngredients(List<Ingredient> ingredients) Sets the ingredients of the recipe.voidSetPermission(String permission) Sets the permission required to craft this recipe by string.voidSetPermission(org.bukkit.permissions.Permission permission) Sets the permission required to craft this recipe directly.voidSetResult(org.bukkit.inventory.ItemStack result) Sets the result of the recipe.voidSets the shape of a shaped recipe.voidSets the recipe type (shaped or shapeless).toString()Returns a string representation of this CraftRecipe.
- 
Constructor Details- 
CraftRecipe@SafeVarargs public CraftRecipe(org.bukkit.plugin.java.JavaPlugin plugin, String recipe, CraftRecipe.RecipeType type, List<Ingredient> ingredients, org.bukkit.inventory.ItemStack result, List<String>... shape) Constructs a new CraftRecipe.- Parameters:
- plugin- The plugin used for the NamespacedKey.
- recipe- The unique recipe ID.
- type- The type of the recipe (shaped or shapeless).
- ingredients- The ingredients required for crafting.
- result- The resulting item.
- shape- Optional shape for shaped recipes.
 
 
- 
- 
Method Details- 
SetShapeSets the shape of a shaped recipe.
- 
GetShapeGets the shape of the recipe.
- 
SetIngredientsSets the ingredients of the recipe.
- 
GetIngredientsGets the ingredients of the recipe.
- 
SetTypeSets the recipe type (shaped or shapeless).
- 
GetTypeGets the recipe type.
- 
SetPermissionSets the permission required to craft this recipe by string.If null, no permission is required. 
- 
SetPermissionpublic void SetPermission(@Nullable org.bukkit.permissions.Permission permission) Sets the permission required to craft this recipe directly.
- 
GetPermissionpublic org.bukkit.permissions.Permission GetPermission()Gets the permission required to craft this recipe.
- 
SetResultpublic void SetResult(org.bukkit.inventory.ItemStack result) Sets the result of the recipe.
- 
GetResultpublic org.bukkit.inventory.ItemStack GetResult()Gets the result of the recipe.
- 
Removepublic void Remove()Removes this recipe from the server.
- 
Addpublic void Add()Adds this recipe to the server.
- 
onPrepareItemCraftpublic void onPrepareItemCraft(org.bukkit.event.inventory.PrepareItemCraftEvent event) Event handler for when a player prepares an item for crafting.Ensures that only players with the required permission can craft the recipe. - Parameters:
- event- The PrepareItemCraftEvent.
 
- 
toStringReturns a string representation of this CraftRecipe.
 
-