Interface DynamicItemStack

All Superinterfaces:
Cloneable

public interface DynamicItemStack extends Cloneable
Represents an ItemStack that may persist of placeholders.

Server admins may include PAPI placeholders within their item for dynamic item representation. This class supports both cases (with and without placeholders) for efficient processing.

  • Method Details

    • getInput

      String getInput()
      Gets the input with which it is possible to recreate the item.

      May not be exactly what was given with from(String), as it might make use of Helper.composeItemStack(org.bukkit.inventory.ItemStack).

      Returns:
      The string input of the item
    • get

      ItemStack get()
      Gets the uncloned, regular item, in case the player is not known.
      Returns:
      The regular item
    • getClone

      ItemStack getClone()
      Gets the cloned, regular item, in case the player is not known.
      Returns:
      The cloned regular item
    • get

      ItemStack get(Player player)
      Gets the uncloned, player-specific item.
      Parameters:
      player - The player to check for
      Returns:
      The uncloned player-specific item
    • getClone

      ItemStack getClone(Player player)
      Gets the cloned, player-specific item.
      Parameters:
      player - The player to check for
      Returns:
      The cloned player-specific item
    • clone

      Creates a clone of this instance.
      Returns:
      A cloned instance
    • isDynamic

      boolean isDynamic()
      Get whether the output is dynamic or static.
      Returns:
      true if the output depends on the player, or false if the output is always the same
    • from

      @Nullable static @Nullable DynamicItemStack from(String string)
      Constructs an ItemStack (similar to Helper.parseItemStack(String)).
      Parameters:
      string - The string to parse
      Returns:
      The parsed instance, may be null if parsing failed
    • from

      static DynamicItemStack from(ItemStack is)
      Constructs a static DynamicItemStack instance.
      Parameters:
      is - The itemstack to use as the base for the instance
      Returns:
      The created instance