Class ItemBuilder

java.lang.Object
com.shanebeestudios.snippets.item.ItemBuilder

public class ItemBuilder extends Object
ItemBuilder class to quickly/easily create ItemStacks with chained methods
  • Method Details

    • builder

      public static ItemBuilder builder(Material material)
      Create a new ItemBuilder

      Defaults amount = 1

      Parameters:
      material - Material of Item
      Returns:
      Instance of ItemBuilder
    • builder

      public static ItemBuilder builder(Material material, int amount)
      Create a new ItemBuilder
      Parameters:
      material - Material of Item
      amount - Amount of items in stack
      Returns:
      Instance of ItemBuilder
    • amount

      public ItemBuilder amount(int amount)
      Set the amount of the item
      Parameters:
      amount - Amount of the item
      Returns:
      Instance of ItemBuilder
    • name

      public ItemBuilder name(String name)
      Set the name of the item
      Parameters:
      name - Name of the item
      Returns:
      Instance of ItemBuilder
    • addEnchant

      public ItemBuilder addEnchant(Enchantment enchantment, int level)
      Add an enchantment to the item
      Parameters:
      enchantment - Enchantment to add
      level - Level of enchantment to add
      Returns:
      Instance of ItemBuilder
    • lore

      public ItemBuilder lore(String... lores)
      Set the lore of the item
      Parameters:
      lores - Lore to set
      Returns:
      Instance of ItemBuilder
    • addLore

      public ItemBuilder addLore(String lore)
      Add a line of lore to the item
      Parameters:
      lore - Lore to add
      Returns:
      Instance of ItemBuilder
    • unbreakable

      public ItemBuilder unbreakable()
      Make the item unbreakable
      Returns:
      Instance of ItemBuilder
    • customModelData

      public ItemBuilder customModelData(int model)
      Set the custom model data of the item
      Parameters:
      model - Custom model data of the item
      Returns:
      Instance of ItemBuilder
    • attribute

      public ItemBuilder attribute(Attribute attribute, AttributeModifier modifier)
      Add an attribute modifier to the item
      Parameters:
      attribute - Attribute to add
      modifier - Attribute modifier to add
      Returns:
      Instance of ItemBuilder
    • item

      public ItemStack item()
      Get the ItemStack from this builder
      Returns:
      ItemStack from builder