Class CreateItem

java.lang.Object
net.joseplay.allianceutils.api.menu.CreateItem

public class CreateItem extends Object
Utility class for creating ItemStack instances with predefined metadata.

This class centralizes item creation logic, including name, lore, custom model data, and persistent data container usage.

Warning:
  • No null-safety checks are performed
  • ItemMeta is assumed to always be non-null
  • Incorrect material types may cause ClassCastException
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.inventory.ItemStack
    createItemStack(String name, List<String> lore, org.bukkit.Material material)
    Creates a basic ItemStack with name and lore.
    static org.bukkit.inventory.ItemStack
    createItemStack(String name, List<String> lore, org.bukkit.Material material, int modelData)
    Creates an ItemStack with name, lore and custom model data.
    static org.bukkit.inventory.ItemStack
    createItemStack(String name, List<String> lore, org.bukkit.Material material, org.bukkit.NamespacedKey namespacedKey)
    Creates an ItemStack with name, lore and a persistent data key.
    static org.bukkit.inventory.ItemStack
    createItemStack(String name, List<String> lore, org.bukkit.Material material, org.bukkit.NamespacedKey namespacedKey, int modelData)
    Creates an ItemStack with name, lore, custom model data and persistent data.
    static org.bukkit.inventory.ItemStack
    createLeatherItemStack(String name, List<String> lore, org.bukkit.Material material, org.bukkit.Color color)
    Creates a leather armor ItemStack with custom color.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CreateItem

      public CreateItem()
  • Method Details

    • createItemStack

      public static org.bukkit.inventory.ItemStack createItemStack(String name, List<String> lore, org.bukkit.Material material, org.bukkit.NamespacedKey namespacedKey)
      Creates an ItemStack with name, lore and a persistent data key.
      Parameters:
      name - display name
      lore - lore lines
      material - item material
      namespacedKey - key to store in PersistentDataContainer
      Returns:
      configured ItemStack
    • createItemStack

      public static org.bukkit.inventory.ItemStack createItemStack(String name, List<String> lore, org.bukkit.Material material, org.bukkit.NamespacedKey namespacedKey, int modelData)
      Creates an ItemStack with name, lore, custom model data and persistent data.
      Parameters:
      name - display name
      lore - lore lines
      material - item material
      namespacedKey - key to store in PersistentDataContainer
      modelData - custom model data value
      Returns:
      configured ItemStack
    • createItemStack

      public static org.bukkit.inventory.ItemStack createItemStack(String name, List<String> lore, org.bukkit.Material material)
      Creates a basic ItemStack with name and lore.
      Parameters:
      name - display name
      lore - lore lines
      material - item material
      Returns:
      configured ItemStack
    • createItemStack

      public static org.bukkit.inventory.ItemStack createItemStack(String name, List<String> lore, org.bukkit.Material material, int modelData)
      Creates an ItemStack with name, lore and custom model data.
      Parameters:
      name - display name
      lore - lore lines
      material - item material
      modelData - custom model data value
      Returns:
      configured ItemStack
    • createLeatherItemStack

      public static org.bukkit.inventory.ItemStack createLeatherItemStack(String name, List<String> lore, org.bukkit.Material material, org.bukkit.Color color)
      Creates a leather armor ItemStack with custom color. Warning: - The material must be a leather armor piece - Otherwise a ClassCastException will be thrown
      Parameters:
      name - display name
      lore - lore lines
      material - leather armor material
      color - armor color
      Returns:
      configured ItemStack