Class KnowledgeBookBuilder

java.lang.Object
io.github.lucfr1746.llibrary.itemstack.ItemBuilder
io.github.lucfr1746.llibrary.itemstack.KnowledgeBookBuilder

public class KnowledgeBookBuilder extends ItemBuilder
The KnowledgeBookBuilder class extends ItemBuilder to provide additional functionality for modifying KnowledgeBookMeta of an ItemStack. This class allows adding, setting, and retrieving recipes for the knowledge book.
  • Constructor Details

    • KnowledgeBookBuilder

      public KnowledgeBookBuilder(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      Constructs a KnowledgeBookBuilder using an existing ItemStack.
      Parameters:
      itemStack - the item stack to modify
      Throws:
      IllegalArgumentException - if the item's meta is not an instance of KnowledgeBookMeta
    • KnowledgeBookBuilder

      public KnowledgeBookBuilder(int amount)
      Constructs a KnowledgeBookBuilder with the specified amount.
      Parameters:
      amount - the quantity of items in the stack
  • Method Details

    • addRecipes

      public KnowledgeBookBuilder addRecipes(@NotNull @NotNull org.bukkit.NamespacedKey... recipes)
      Adds recipes to the knowledge book.
      Parameters:
      recipes - the recipes to add
      Returns:
      this KnowledgeBookBuilder instance for method chaining
    • setRecipes

      public KnowledgeBookBuilder setRecipes(@NotNull @NotNull List<org.bukkit.NamespacedKey> recipes)
      Sets the recipes for the knowledge book, replacing any existing ones.
      Parameters:
      recipes - the list of recipes to set
      Returns:
      this KnowledgeBookBuilder instance for method chaining
    • getRecipes

      public List<org.bukkit.NamespacedKey> getRecipes()
      Gets all recipes in the knowledge book.
      Returns:
      the list of recipes in the book
    • hasRecipes

      public boolean hasRecipes()
      Checks if the knowledge book contains any recipes.
      Returns:
      true if there are recipes, false otherwise