Interface ZentrixItem


public interface ZentrixItem
Read-only view of a custom item definition.

Addons can register these items for use in phases, player classes, and other game mechanics. Items may come from ItemsAdder or Nexo.

Example


 ItemService service = ZentrixAPI.get().getItemService();

 // Get the item definition
 Optional<ZentrixItem> item = service.getItemDefinition("tracking-compass");
 item.ifPresent(def -> {
     System.out.println("Item: " + def.getId());
     System.out.println("Material: " + def.getMaterial());
     System.out.println("Display Name: " + def.getDisplayName());

     // Create an ItemStack
     ItemStack stack = def.toItemStack();
     player.getInventory().addItem(stack);
 });
 
Since:
1.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Optional<String>
    Gets the addon ID that registered this item.
    int
    Gets the default amount for this item.
    @NotNull Map<String,Object>
    Gets custom metadata fields for this item.
    int
    Gets the custom model data for this item.
    @NotNull String
    Gets the display name for this item.
    @NotNull Map<org.bukkit.enchantments.Enchantment,Integer>
    Gets the enchantments applied to this item.
    @NotNull Optional<String>
    Gets the external source identifier for this item.
    @NotNull Set<org.bukkit.inventory.ItemFlag>
    Gets the item flags applied to this item.
    @NotNull String
    Gets the unique identifier for this item.
    @NotNull List<String>
    Gets the lore lines for this item.
    @NotNull org.bukkit.Material
    Gets the base material for this item.
    int
    Gets the preferred inventory slot for this item.
    boolean
    Returns whether an addon registered this item at runtime.
    boolean
    Checks if this item is enabled.
    boolean
    Checks if this item uses an external source (ItemsAdder, Nexo, etc.).
    boolean
    Checks if this item has a glow effect.
    boolean
    Checks if this item is unbreakable.
    @NotNull org.bukkit.inventory.ItemStack
    Creates a usable ItemStack from this item definition.
    @NotNull org.bukkit.inventory.ItemStack
    toItemStack(int amount)
    Creates a usable ItemStack with a specific amount.
  • Method Details

    • getId

      @NotNull @NotNull String getId()
      Gets the unique identifier for this item.
      Returns:
      The item ID (never null)
    • getMaterial

      @NotNull @NotNull org.bukkit.Material getMaterial()
      Gets the base material for this item.

      For external items, this may return the fallback material.

      Returns:
      The material (never null)
    • getExternalSource

      @NotNull @NotNull Optional<String> getExternalSource()
      Gets the external source identifier for this item.

      Format: "itemsadder:namespace:id" or "nexo:id"

      Returns:
      Optional containing the external source, or empty if vanilla/custom
    • isExternal

      boolean isExternal()
      Checks if this item uses an external source (ItemsAdder, Nexo, etc.).
      Returns:
      true if external
    • getDisplayName

      @NotNull @NotNull String getDisplayName()
      Gets the display name for this item.
      Returns:
      The display name with color codes (never null)
    • getLore

      @NotNull @NotNull List<String> getLore()
      Gets the lore lines for this item.
      Returns:
      An unmodifiable list of lore lines (never null, may be empty)
    • getAmount

      int getAmount()
      Gets the default amount for this item.
      Returns:
      The item amount
    • getEnchantments

      @NotNull @NotNull Map<org.bukkit.enchantments.Enchantment,Integer> getEnchantments()
      Gets the enchantments applied to this item.
      Returns:
      An unmodifiable map of enchantments to levels (never null, may be empty)
    • getFlags

      @NotNull @NotNull Set<org.bukkit.inventory.ItemFlag> getFlags()
      Gets the item flags applied to this item.
      Returns:
      An unmodifiable set of item flags (never null, may be empty)
    • getCustomModelData

      int getCustomModelData()
      Gets the custom model data for this item.

      Returns 0 if not set.

      Returns:
      The custom model data value
    • isUnbreakable

      boolean isUnbreakable()
      Checks if this item is unbreakable.
      Returns:
      true if unbreakable
    • isGlow

      boolean isGlow()
      Checks if this item has a glow effect.
      Returns:
      true if glowing
    • getSlot

      int getSlot()
      Gets the preferred inventory slot for this item.

      Returns -1 if no specific slot is configured.

      Returns:
      The slot index (0-8 for hotbar), or -1 if not specified
    • isEnabled

      boolean isEnabled()
      Checks if this item is enabled.
      Returns:
      true if enabled
    • toItemStack

      @NotNull @NotNull org.bukkit.inventory.ItemStack toItemStack()
      Creates a usable ItemStack from this item definition.

      The returned ItemStack is a clone and safe to modify.

      Returns:
      A new ItemStack (never null)
    • toItemStack

      @NotNull @NotNull org.bukkit.inventory.ItemStack toItemStack(int amount)
      Creates a usable ItemStack with a specific amount.

      The returned ItemStack is a clone and safe to modify.

      Parameters:
      amount - The item amount
      Returns:
      A new ItemStack with the specified amount (never null)
    • getAddonId

      @NotNull @NotNull Optional<String> getAddonId()
      Gets the addon ID that registered this item.
      Returns:
      Optional containing the addon ID, or empty if not addon-registered
    • isDynamicallyRegistered

      boolean isDynamicallyRegistered()
      Returns whether an addon registered this item at runtime.
      Returns:
      true if dynamically registered
    • getCustomFields

      @NotNull @NotNull Map<String,Object> getCustomFields()
      Gets custom metadata fields for this item.
      Returns:
      An unmodifiable map of custom fields (never null, may be empty)