Class ItemBuilder

java.lang.Object
dev.selena.luacore.utils.items.ItemBuilder

public class ItemBuilder extends Object
Used for easily creating custom items
  • Constructor Details

    • ItemBuilder

      public ItemBuilder(org.bukkit.Material type)
      Start the creation of the ItemBuilder and setting the type
      Parameters:
      type - Material you want to start with
    • ItemBuilder

      public ItemBuilder()
      Used for creating the item builder with no initial material type
      See Also:
  • Method Details

    • setType

      public ItemBuilder setType(org.bukkit.Material type)
      Used for setting the material type
      Parameters:
      type - Material you want to use
      Returns:
      This instance to continue the building
    • setTitle

      public ItemBuilder setTitle(String title)
      Used for setting the display name of the item
      Parameters:
      title - The display name you want
      Returns:
      This instance to continue the building
    • setLore

      public ItemBuilder setLore(String... lore)
      Sets the lore using a string array
      Parameters:
      lore - The string array you want to set the lore
      Returns:
      This instance to continue the building
      See Also:
    • setLore

      public ItemBuilder setLore(List<String> lore)
      Used for setting the lore using List
      Parameters:
      lore - The List you want to set the lore to
      Returns:
      This instance to continue the building
      See Also:
    • setEnchantsFromKey

      public ItemBuilder setEnchantsFromKey(Map<String,Integer> enchants)
      Used for setting enchantments
      Parameters:
      enchants - Map of the enchantment namespace key and level
      Returns:
      This instance to continue the building
      See Also:
    • setEnchantsFromEnchantments

      public ItemBuilder setEnchantsFromEnchantments(Map<org.bukkit.enchantments.Enchantment,Integer> enchantments)
      Used for setting the enchantment map using spigot Enchantments
      Parameters:
      enchantments - The map of enchantments you want to set
      Returns:
      This instance to continue the building
    • addEnchant

      public ItemBuilder addEnchant(String enchant, int level)
      Used for adding an enchantment
      Parameters:
      enchant - Namespace key of the enchantment
      level - Level of the enchantment
      Returns:
      This instance to continue the building
    • addEnchant

      public ItemBuilder addEnchant(org.bukkit.enchantments.Enchantment enchant, int level)
      Used for adding an enchantment
      Parameters:
      enchant - The enchantment you want to add
      level - Level of the enchantment
      Returns:
      This instance to continue the building
    • setStackable

      public ItemBuilder setStackable(boolean stackable)
      Used for making items only be able to stack to 1
      Parameters:
      stackable - if false the item will not stack
      Returns:
      This instance to continue the building
    • setGlowing

      public ItemBuilder setGlowing(boolean glowing)
      Used for making an item glow
      Parameters:
      glowing - true will give it an enchantment glint
      Returns:
      This instance to continue the building
    • setStringNBT

      public ItemBuilder setStringNBT(Map<String,String> stringNBT)
      Used for setting the NBTString map
      Parameters:
      stringNBT - Map of NBT strings
      Returns:
      This instance to continue the building
      See Also:
    • addNBTString

      public ItemBuilder addNBTString(String key, String value)
      Used for adding an NBT string value to the item
      Parameters:
      key - The key you will use to get the string later
      value - The string you want stored
      Returns:
      This instance to continue the building
    • setIntNBT

      public ItemBuilder setIntNBT(Map<String,Integer> intNBT)
      Used for setting the value of the NBT Int Map
      Parameters:
      intNBT - The map of NBT data you want to add
      Returns:
      This instance to continue the building
    • addNBTInt

      public ItemBuilder addNBTInt(String key, int value)
      Used for adding an NBT Int to the item
      Parameters:
      key - The key you will use to get the int later
      value - The value you want to store
      Returns:
      This instance to continue the building
    • setBooleanNBT

      public ItemBuilder setBooleanNBT(Map<String,Boolean> booleanNBT)
      Used for setting the values of the NBT boolean map
      Parameters:
      booleanNBT - The map of booleans you want to store
      Returns:
      This instance to continue the building
    • addNBTBoolean

      public ItemBuilder addNBTBoolean(String key, boolean value)
      Used for adding a boolean NBT value to the item
      Parameters:
      key - The key you will use to get the boolean later
      value - The value you want to store
      Returns:
      This instance to continue the building
    • setCustomNBT

      public ItemBuilder setCustomNBT(Map<String,Object> customNBT)
      Used for setting the values of the custom NBT map
      Parameters:
      customNBT - The map of custom NBT you want to store
      Returns:
      This instance to continue the building
    • addCustomNBT

      public ItemBuilder addCustomNBT(String nameSpace, Object content)
      Used for adding custom NBT data to the item
      Parameters:
      nameSpace - The key you will use to get the custom content later
      content - The content you want to store later
      Returns:
      This instance to continue the building
    • setAmount

      public ItemBuilder setAmount(int amount)
      Used for setting the amount of items
      Parameters:
      amount - The amount you want the ItemStack to be in
      Returns:
      This instance to continue the building
    • setUsable

      public ItemBuilder setUsable(boolean usable)
      Allows you to stop users from using items that should not be used
      Parameters:
      usable - set value as false to prevent players from using item
      Returns:
      This instance to continue the building
    • setColor

      public ItemBuilder setColor(org.bukkit.Color itemColor)
      Used for setting color of leather armor
      Parameters:
      itemColor - The color you want to set using bukkit Color
      Returns:
      This instance to continue
    • setArmorTrim

      public ItemBuilder setArmorTrim(org.bukkit.inventory.meta.trim.ArmorTrim trim)
      Used to add armor trims to a piece of armor
      Parameters:
      trim - The armor trim you want to add
      Returns:
      This instance to continue
    • setSkullTexture

      public ItemBuilder setSkullTexture(URL textureUrl)
      Used for setting the skull texture (Won't work if the material isn't Material.PLAYER_HEAD)
      Parameters:
      textureUrl - The skull texture (NOTE: MUST be a https://textures.minecraft.net texture)
      Returns:
      This instance to continue
    • setSkullProfile

      public ItemBuilder setSkullProfile(@NotNull @NotNull URL skullTextureUrl, @NotNull @NotNull UUID skullTextureUUID, @Nullable @Nullable String skullTextureName)
      Used for setting the skulls PlayerProfile texture.
      Parameters:
      skullTextureUrl - The skull texture (NOTE: MUST be a https://textures.minecraft.net texture)
      skullTextureUUID - The UUID of the skull, used for internal minecraft stuff
      skullTextureName - The texture name (from memory must be unique, but I haven't used this in a while)
      Returns:
      This instance to continue
    • setSkullProfile

      public ItemBuilder setSkullProfile(org.bukkit.profile.PlayerProfile skullProfile)
      Used for setting the skulls PlayerProfile
      Parameters:
      skullProfile - The PlayerProfile you want to set for the skull
      Returns:
      This instance to continue
    • build

      public org.bukkit.inventory.ItemStack build()
      Used for creating the previously created ItemStack
      Returns:
      The built ItemStack
    • fromItemStack

      public static ItemBuilder fromItemStack(org.bukkit.inventory.ItemStack item)
      Used for creating an instance of ItemBuilder from an ItemStack
      Parameters:
      item - The ItemStack you want to convert to ItemBuilder
      Returns:
      A fresh instance of ItemBuilder