Class ItemBuilder

java.lang.Object
com.kamikazejam.kamicommon.item.ItemBuilder
All Implemented Interfaces:
IBuilder<ItemBuilder>, Cloneable

public final class ItemBuilder extends Object implements IBuilder<ItemBuilder>, Cloneable
A builder class for wrapping ItemStacks and applying patches to them.
Patches modify the base metadata and nbt of the item via easier to use methods exposed by this class.

NOTE: Using third party plugins like ItemsAdder which provide custom items IS SUPPORTED!
Just adjust your workflow to parse the ItemStack from their API, and then use that object as the prototype for this wrapper:
     ItemStack customItem = CustomStack.getInstance("my_namespaced_id");
     ItemBuilder builder = new ItemBuilder(customItem);
     // apply patches to the builder...
     ItemStack finalItem = builder.build();
 

There is also support in the loaders for using external ItemStack prototypes using ItemBuilderLoader.loadPatches(ItemStack, ConfigurationSection):
     ItemStack customItem = CustomStack.getInstance("my_namespaced_id");
     ItemBuilder builder = ItemBuilderLoader.loadPatches(customItem, configSection);
     // apply patches to the builder...
     ItemStack finalItem = builder.build();
 
  • Constructor Details

    • ItemBuilder

      public ItemBuilder(@NotNull @NotNull ItemStack prototype)
      Construct a new ItemBuilder from a prototype ItemStack.
      (The prototype is never modified, it is immutable, and accessed via getPrototype())

      Call ItemBuilder methods to set and update item 'patches', and then use IBuilder.build() to construct the final item.

      Parameters:
      prototype - The initial item this class applies patches on top of.
    • ItemBuilder

      public ItemBuilder(@NotNull @NotNull com.cryptomorin.xseries.XMaterial material)
      Construct a new ItemBuilder from an XMaterial.

      This is equivalent to calling ItemBuilder(ItemStack) with the result of XMaterial.parseItem()
    • ItemBuilder

      public ItemBuilder(@NotNull @NotNull Material material)
      Construct a new ItemBuilder from an Material.

      This is equivalent to calling ItemBuilder(XMaterial) with the result of XMaterial.matchXMaterial(Material)
  • Method Details

    • getPrototype

      @NotNull public @NotNull ItemStack getPrototype()
      Description copied from interface: IBuilder
      Get the prototype ItemStack this builder is based on.

      The prototype is never modified, it is immutable, and accessed via this method.
      Use IBuilder.build() to get the final version of the item with all patches applied.
      Specified by:
      getPrototype in interface IBuilder<ItemBuilder>
      Returns:
      The prototype ItemStack this builder is based on.
    • build

      @NotNull public @NotNull ItemStack build(@Nullable @Nullable Player viewer)
      Description copied from interface: IBuilder
      Compiles the patches, applying them on top of the prototype.
      Specified by:
      build in interface IBuilder<ItemBuilder>
      Parameters:
      viewer - The Player viewing this item, for PlaceholderAPI support. (Can be null)
      Returns:
      The final ItemStack with all patches applied.
    • setAmount

      @NotNull public @NotNull ItemBuilder setAmount(int amount)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Sets the amount of items in the stack.
      Range: 1 to ItemStack.getMaxStackSize() (inclusive) of the prototype.

      Clear this patch by calling IBuilder.resetAmount().
      (If the amount is out of range, it will be clamped within the valid range.)
      Specified by:
      setAmount in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • resetAmount

      @NotNull public @NotNull ItemBuilder resetAmount()
      Description copied from interface: IBuilder
      PATCH FUNCTION - Clears the amount patch, the Builder will then use the prototype's value.

      NOTE: The prototype's amount is now used by the builder, this only removes any existing amount patch.
      Specified by:
      resetAmount in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • setDamage

      @NotNull public @NotNull ItemBuilder setDamage(int damage)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Sets the damage of a damageable item.

      NOTE: This function has no effect on the item unless IBuilder.willUseDamage() returns true, otherwise the item will be unaffected and IBuilder.getDamage() will always return 0.

      Clear this patch by calling IBuilder.resetDamage().
      Specified by:
      setDamage in interface IBuilder<ItemBuilder>
      Parameters:
      damage - The damage value to set (0 = undamaged)
      Returns:
      This builder, for chaining
    • resetDamage

      @NotNull public @NotNull ItemBuilder resetDamage()
      Description copied from interface: IBuilder
      PATCH FUNCTION - Clears the damage patch, the Builder will then use the prototype's value.

      NOTE: This function has no effect on the item unless IBuilder.willUseDamage() returns true, otherwise the item will be unaffected and IBuilder.getDamage() will always return 0.

      NOTE: The prototype's damage is now used by the builder (if applicable), this only removes any existing damage patch.
      Specified by:
      resetDamage in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • setName

      @NotNull public @NotNull ItemBuilder setName(@NotNull @NotNull String name)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Applies a custom display name for the item.
      Color translations using StringUtilP.p(OfflinePlayer, String) will be applied during IBuilder.build(Player) automatically.

      Clear this patch by calling IBuilder.resetName().
      Specified by:
      setName in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • resetName

      @NotNull public @NotNull ItemBuilder resetName()
      Description copied from interface: IBuilder
      PATCH FUNCTION - Clears the name patch, the Builder will then use the prototype's value.

      NOTE: The prototype's name is now used by the builder, this only removes any existing name patch.
      Specified by:
      resetName in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • setLore

      @NotNull public @NotNull ItemBuilder setLore(@NotNull @NotNull String... loreLines)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Sets the custom lore for the item.
      Color translations using StringUtilP.p(OfflinePlayer, String) will be applied during IBuilder.build(Player) automatically.

      Clear this patch by calling IBuilder.resetLore().
      Specified by:
      setLore in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • setLore

      @NotNull public @NotNull ItemBuilder setLore(@NotNull @NotNull List<String> loreLines)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Sets the custom lore for the item.
      Color translations using StringUtilP.p(OfflinePlayer, String) will be applied during IBuilder.build(Player) automatically.

      Clear this patch by calling IBuilder.resetLore().
      Specified by:
      setLore in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • resetLore

      @NotNull public @NotNull ItemBuilder resetLore()
      Description copied from interface: IBuilder
      PATCH FUNCTION - Clears the lore patch, the Builder will then use the prototype's value.

      NOTE: The prototype's lore is now used by the builder, this only removes any existing lore patch.
      Specified by:
      resetLore in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • setUnbreakable

      @NotNull public @NotNull ItemBuilder setUnbreakable(boolean unbreakable)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Sets if the item is unbreakable or not.

      Clear this patch by calling IBuilder.resetUnbreakable().
      Specified by:
      setUnbreakable in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • resetUnbreakable

      @NotNull public @NotNull ItemBuilder resetUnbreakable()
      Description copied from interface: IBuilder
      PATCH FUNCTION - Clears the unbreakable patch, the Builder will then use the prototype's value.

      NOTE: The prototype's unbreakable value is now used by the builder, this only removes any existing unbreakable patch.
      Specified by:
      resetUnbreakable in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • addItemFlag

      @NotNull public @NotNull ItemBuilder addItemFlag(@NotNull @NotNull com.cryptomorin.xseries.XItemFlag flag)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Adds an item flag to the item.

      Remove an item flag via IBuilder.removeItemFlag(XItemFlag).
      Specified by:
      addItemFlag in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • addItemFlags

      @NotNull public @NotNull ItemBuilder addItemFlags(@NotNull @NotNull Collection<com.cryptomorin.xseries.XItemFlag> flags)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Adds several item flags to the item.

      Remove an item flag via IBuilder.removeItemFlag(XItemFlag).
      Specified by:
      addItemFlags in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • removeItemFlag

      @NotNull public @NotNull ItemBuilder removeItemFlag(@NotNull @NotNull com.cryptomorin.xseries.XItemFlag flag)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Removes an item flag from the item.

      Add an item flag via IBuilder.addItemFlag(XItemFlag).
      Specified by:
      removeItemFlag in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • removeItemFlags

      @NotNull public @NotNull ItemBuilder removeItemFlags(@NotNull @NotNull Collection<com.cryptomorin.xseries.XItemFlag> flags)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Removes several item flags from the item.

      Add an item flag via IBuilder.addItemFlag(XItemFlag).
      Specified by:
      removeItemFlags in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • resetItemFlag

      @NotNull public @NotNull ItemBuilder resetItemFlag(@NotNull @NotNull com.cryptomorin.xseries.XItemFlag flag)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Resets an item flag patch, the Builder will then use the prototype's value for this flag.

      Other Methods:
      - ADD an item flag via IBuilder.addItemFlag(XItemFlag)
      - REMOVE an item flag via IBuilder.removeItemFlag(XItemFlag)
      Specified by:
      resetItemFlag in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • resetAllItemFlags

      @NotNull public @NotNull ItemBuilder resetAllItemFlags()
      Description copied from interface: IBuilder
      PATCH FUNCTION - Clears all item flag patches, the Builder will then use the prototype's values.

      NOTE: The prototype's item flags will still be applied, this only clears the patches.
      Specified by:
      resetAllItemFlags in interface IBuilder<ItemBuilder>
    • setEnchantment

      @NotNull public @NotNull ItemBuilder setEnchantment(@NotNull @NotNull com.cryptomorin.xseries.XEnchantment enchant, int level)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Sets the level of an enchantment on the item.

      Other Methods:
      - REMOVE an enchantment via IBuilder.removeEnchantment(XEnchantment)
      - RESET an enchantment (remove patch) via IBuilder.resetEnchantment(XEnchantment)
      Specified by:
      setEnchantment in interface IBuilder<ItemBuilder>
      Parameters:
      level - The level of the enchantment to set (MUST be greater than 0)
      Returns:
      This builder, for chaining
    • setEnchantments

      @NotNull public @NotNull ItemBuilder setEnchantments(@NotNull @NotNull Map<com.cryptomorin.xseries.XEnchantment,Integer> enchantments)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Sets the level of several enchantments on the item.

      Other Methods:
      - REMOVE an enchantment via IBuilder.removeEnchantment(XEnchantment)
      - RESET an enchantment (remove patch) via IBuilder.resetEnchantment(XEnchantment)
      Specified by:
      setEnchantments in interface IBuilder<ItemBuilder>
      Parameters:
      enchantments - The map of enchantments to their levels to set (all levels MUST be greater than 0)
      Returns:
      This builder, for chaining
    • removeEnchantment

      @NotNull public @NotNull ItemBuilder removeEnchantment(@NotNull @NotNull com.cryptomorin.xseries.XEnchantment enchant)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Remove an enchantment from the item.

      Other Methods:
      - ADD or UPDATE an enchantment via IBuilder.setEnchantment(XEnchantment, int)
      - RESET an enchantment (remove patch) via IBuilder.resetEnchantment(XEnchantment)
      Specified by:
      removeEnchantment in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • resetEnchantment

      @NotNull public @NotNull ItemBuilder resetEnchantment(@NotNull @NotNull com.cryptomorin.xseries.XEnchantment enchant)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Reset an enchantment patch, the Builder will then use the prototype's value for this enchantment.

      Other Methods:
      - ADD or UPDATE an enchantment via IBuilder.setEnchantment(XEnchantment, int)
      - REMOVE an enchantment via IBuilder.removeEnchantment(XEnchantment)
      Specified by:
      resetEnchantment in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • resetAllEnchantments

      @NotNull public @NotNull ItemBuilder resetAllEnchantments()
      Description copied from interface: IBuilder
      PATCH FUNCTION - Clears all enchantment patches, the Builder will then use the prototype's values.

      NOTE: The prototype's enchantments will still be applied, this only clears the patches.
      Specified by:
      resetAllEnchantments in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • addGlow

      @NotNull public @NotNull ItemBuilder addGlow()
      Description copied from interface: IBuilder
      PATCH FUNCTION - Sets whether the item should have an added glow effect.

      Clear this patch by calling IBuilder.removeGlow().
      Specified by:
      addGlow in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • removeGlow

      @NotNull public @NotNull ItemBuilder removeGlow()
      Description copied from interface: IBuilder
      PATCH FUNCTION - Removes the glow effect patch, the Builder will then use the prototype's value.

      NOTE: The prototype's glow value is now used by the builder, this only removes any existing glow patch.
      NOTE: Even when the glow patch is removed, the item may still glow if the prototype has enchantments or a glow effect.
      Specified by:
      removeGlow in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • setSkullOwner

      @NotNull public @NotNull ItemBuilder setSkullOwner(@NotNull @NotNull String skullOwner)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Sets the owner of a player head item.

      NOTE: This function has no effect on the item unless IBuilder.willUseSkullOwner() returns true, otherwise the item will be unaffected and IBuilder.getSkullOwner() will always return null.

      Clear this patch by calling IBuilder.resetSkullOwner().
      Specified by:
      setSkullOwner in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • resetSkullOwner

      @NotNull public @NotNull ItemBuilder resetSkullOwner()
      Description copied from interface: IBuilder
      PATCH FUNCTION - Clears the skull owner patch, the Builder will then use the prototype's value.

      NOTE: This function has no effect on the item unless IBuilder.willUseSkullOwner() returns true, otherwise the item will be unaffected and IBuilder.getSkullOwner() will always return null.

      NOTE: The prototype's skull owner is now used by the builder (if applicable), this only removes any existing skull owner patch.
      Specified by:
      resetSkullOwner in interface IBuilder<ItemBuilder>
      Returns:
      This builder, for chaining
    • getAmount

      public int getAmount()
      Description copied from interface: IBuilder
      Get the amount of items in the stack.
      Range: 1 to ItemStack.getMaxStackSize() (inclusive) of the prototype.

      If the patch amount is null (not set), the prototype's amount is returned.
      Specified by:
      getAmount in interface IBuilder<ItemBuilder>
    • getName

      @Nullable public @Nullable String getName()
      Description copied from interface: IBuilder
      Get the custom display name for the item.
      Color translations using StringUtilP.p(OfflinePlayer, String) will be applied during IBuilder.build(Player) automatically.

      If the patch name is null (not set), the prototype's name will be returned (if available).
      Specified by:
      getName in interface IBuilder<ItemBuilder>
    • getLore

      @Nullable public @Nullable List<@NotNull String> getLore()
      Description copied from interface: IBuilder
      Get the custom lore for the item.

      If the patch lore is null (not set), the prototype's lore will be returned (if available).
      Specified by:
      getLore in interface IBuilder<ItemBuilder>
    • isUnbreakable

      public boolean isUnbreakable()
      Description copied from interface: IBuilder
      Get if the item is unbreakable or not.

      If the patch unbreakable is null (not set), the prototype's unbreakable value will be returned.
      Specified by:
      isUnbreakable in interface IBuilder<ItemBuilder>
    • hasItemFlag

      public boolean hasItemFlag(@NotNull @NotNull com.cryptomorin.xseries.XItemFlag flag)
      Description copied from interface: IBuilder
      Get if the item has the specified item flag.

      If the patch does not specify the presence of this flag, the prototype's value will be returned.
      Specified by:
      hasItemFlag in interface IBuilder<ItemBuilder>
    • getItemFlags

      @NotNull public @NotNull Set<com.cryptomorin.xseries.XItemFlag> getItemFlags()
      Description copied from interface: IBuilder
      Get a set of ALL item flags on the item.

      This is the combination of the prototype's item flags and the patch item flag overrides.
      This set is never null, but can be empty if no item flags are present on the prototype or patch.
      Specified by:
      getItemFlags in interface IBuilder<ItemBuilder>
    • getEnchantmentLevel

      public int getEnchantmentLevel(@NotNull @NotNull com.cryptomorin.xseries.XEnchantment enchant)
      Description copied from interface: IBuilder
      Get the level of an enchantment on the item, or 0 if the item does not have this enchantment.

      If the patch does not specify a level for this enchantment, the prototype's value will be returned.
      Specified by:
      getEnchantmentLevel in interface IBuilder<ItemBuilder>
    • getEnchantments

      @NotNull public @NotNull Map<com.cryptomorin.xseries.XEnchantment,Integer> getEnchantments()
      Description copied from interface: IBuilder
      Get a map of ALL enchantments on the item.

      This is the combination of the prototype's enchantments and the patch enchantment overrides.
      This map is never null, but can be empty if no enchantments are present on the prototype or patch.
      Specified by:
      getEnchantments in interface IBuilder<ItemBuilder>
    • hasGlow

      public boolean hasGlow()
      Description copied from interface: IBuilder
      Get if the item has an added glow effect.

      If the patch glow is null (not set), the prototype's glow value will be returned.
      Specified by:
      hasGlow in interface IBuilder<ItemBuilder>
    • getSkullOwner

      @Nullable public @Nullable String getSkullOwner()
      Description copied from interface: IBuilder
      Get the owner of a player head item, or null if not set / not a player head.

      NOTE: This will always return null if IBuilder.willUseSkullOwner() returns false.
      Specified by:
      getSkullOwner in interface IBuilder<ItemBuilder>
    • willUseSkullOwner

      public boolean willUseSkullOwner()
      Description copied from interface: IBuilder
      Check if the prototype item supports setting a skull owner (is a player head).

      If this returns true, then the following methods will modify the item:
      - IBuilder.setSkullOwner(String)
      - IBuilder.resetSkullOwner()
      - IBuilder.getSkullOwner()
      If this returns false, calling those methods have no effect and IBuilder.getSkullOwner() will always return null.
      Specified by:
      willUseSkullOwner in interface IBuilder<ItemBuilder>
    • getDamage

      public int getDamage()
      Description copied from interface: IBuilder
      Get the damage of a damageable item, or 0 if not damageable / undamaged.

      NOTE: This will always return 0 if IBuilder.willUseDamage() returns false.
      Specified by:
      getDamage in interface IBuilder<ItemBuilder>
    • willUseDamage

      public boolean willUseDamage()
      Description copied from interface: IBuilder
      Check if the prototype item supports setting damage (is damageable).

      If this returns true, then the following methods will modify the item:
      - IBuilder.setDamage(int)
      - IBuilder.resetDamage()
      - IBuilder.getDamage()
      If this returns false, calling those methods have no effect and IBuilder.getDamage() will always return 0.
      Specified by:
      willUseDamage in interface IBuilder<ItemBuilder>
    • replaceName

      @NotNull public @NotNull ItemBuilder replaceName(@NotNull @NotNull String find, @NotNull @NotNull String replacement)
      Description copied from interface: IBuilder
      PATCH PROPERTY HELPER - Replaces all occurrences of a substring in the name with another string.
      This transformation only applies to the name patch, if no name patch is set this does nothing.
      It does NOT modify the prototype's name.
      Specified by:
      replaceName in interface IBuilder<ItemBuilder>
      Parameters:
      find - The substring to find
      replacement - The sub
      Returns:
      This builder, for chaining
    • replaceNamePAPI

      @NotNull public @NotNull ItemBuilder replaceNamePAPI(@Nullable @Nullable OfflinePlayer player)
      Description copied from interface: IBuilder
      PATCH PROPERTY HELPER - Replaces all PlaceholderAPI placeholders in the name with their respective values.
      This transformation only applies to the name patch, if no name patch is set this does nothing.
      It does NOT modify the prototype's name.
      Specified by:
      replaceNamePAPI in interface IBuilder<ItemBuilder>
      Parameters:
      player - The player to use for PlaceholderAPI replacements, or null to skip player-specific placeholders
      Returns:
      This builder, for chaining
    • replaceLoreLine

      @NotNull public @NotNull ItemBuilder replaceLoreLine(@NotNull @NotNull String find, @NotNull @NotNull List<@NotNull String> replacement)
      Description copied from interface: IBuilder
      PATCH PROPERTY HELPER - Searches for a substring in the lore and replaces that entire line with replacement lines.
      This transformation only applies to the lore patch, if no lore patch is set this does nothing.
      It does NOT modify the prototype's lore.

      Uses ChatColor.stripColor(String) for comparison to ignore color formatting.
      Specified by:
      replaceLoreLine in interface IBuilder<ItemBuilder>
      Parameters:
      find - The string to search for in the lore (color codes will be stripped for comparison)
      replacement - The lines to swap in, in place of the entire line containing the find string
      Returns:
      This builder, for chaining
    • replaceLore

      @NotNull public @NotNull ItemBuilder replaceLore(@NotNull @NotNull String find, @NotNull @NotNull String replacement)
      Description copied from interface: IBuilder
      PATCH PROPERTY HELPER - Replaces all occurrences of a substring in each lore line with another string.
      This transformation only applies to the lore patch, if no lore patch is set this does nothing.
      It does NOT modify the prototype's lore.
      Specified by:
      replaceLore in interface IBuilder<ItemBuilder>
      Parameters:
      find - The substring to find in each lore line
      replacement - The string to replace each occurrence with
      Returns:
      This builder, for chaining
    • replaceLorePAPI

      @NotNull public @NotNull ItemBuilder replaceLorePAPI(@Nullable @Nullable OfflinePlayer player)
      Description copied from interface: IBuilder
      PATCH PROPERTY HELPER - Replaces all PlaceholderAPI placeholders in the lore with their respective values.
      This transformation only applies to the lore patch, if no lore patch is set this does nothing.
      It does NOT modify the prototype's lore.
      Specified by:
      replaceLorePAPI in interface IBuilder<ItemBuilder>
      Parameters:
      player - The player to use for PlaceholderAPI replacements, or null to skip player-specific placeholders
      Returns:
      This builder, for chaining
    • addLoreLines

      @NotNull public @NotNull ItemBuilder addLoreLines(@NotNull @NotNull List<@NotNull String> lines)
      Description copied from interface: IBuilder
      PATCH FUNCTION - Appends additional lines to the current lore.
      If no lore patch is currently set, this will create a new lore patch with the provided lines.
      If a lore patch is already set, the new lines will be added to the end of the existing lore.

      Color translations using StringUtilP.p(OfflinePlayer, String) will be applied during IBuilder.build(Player) automatically.
      Specified by:
      addLoreLines in interface IBuilder<ItemBuilder>
      Parameters:
      lines - The lore lines to append
      Returns:
      This builder, for chaining
    • clone

      @NotNull public @NotNull ItemBuilder clone()
      Specified by:
      clone in interface IBuilder<ItemBuilder>
      Overrides:
      clone in class Object
    • cloneWithNewPrototype

      @NotNull public @NotNull ItemBuilder cloneWithNewPrototype(@NotNull @NotNull ItemStack newPrototype)
      Description copied from interface: IBuilder
      Create a clone of this builder with all the same patches, but a different prototype ItemStack.
      Specified by:
      cloneWithNewPrototype in interface IBuilder<ItemBuilder>
    • load

      @NotNull public static @NotNull ItemBuilder load(@NotNull @NotNull ConfigurationSection section)
      Load a full ItemBuilder from a configuration section.

      The section can define the material, amount, name, lore, and many additional attributes of the item.
      Returns:
      The loaded ItemBuilder where the config values were set as IBuilder PATCHES.
      Throws:
      IllegalArgumentException - If any part of the parsing failed (for example if no valid material was defined).
    • load

      @NotNull public static @NotNull ItemBuilder load(@NotNull @NotNull com.cryptomorin.xseries.XMaterial material, @NotNull @NotNull ConfigurationSection section)
      Load an ItemBuilder from a prototype ItemStack and a configuration section which defines additional patches to apply to the item.

      The section can define the amount, name, lore, and many additional attributes of the item. (Everything except the material type)
      Parameters:
      material - The material to use for the prototype. Used as the base for the ItemBuilder.
      section - The configuration section to load additional patches from.
    • load

      @NotNull public static @NotNull ItemBuilder load(@NotNull @NotNull ItemStack prototype, @NotNull @NotNull ConfigurationSection section)
      Load an ItemBuilder from a prototype ItemStack and a configuration section which defines additional patches to apply to the item.

      The section can define the amount, name, lore, and many additional attributes of the item. (Everything except the material type)
      Parameters:
      prototype - The prototype item stack to base the ItemBuilder on, this defines the material type and any existing item meta.
      section - The configuration section to load additional patches from.