java.lang.Object
com.github.stefvanschie.inventoryframework.adventuresupport.TextHolder
com.github.stefvanschie.inventoryframework.adventuresupport.StringHolder

public final class StringHolder extends TextHolder
Wrapper of a legacy string value. ChatColor based formatting is used.
Since:
0.10.0
  • Method Details

    • of

      @NotNull @Contract(pure=true) public static @NotNull StringHolder of(@NotNull @NotNull String value)
      Wraps the specified legacy string.
      Parameters:
      value - the value to wrap
      Returns:
      an instance that wraps the specified value
      Since:
      0.10.0
    • empty

      @NotNull @Contract(pure=true) public static @NotNull StringHolder empty()
      Gets an instance that contains no characters.
      Returns:
      an instance without any characters
      Since:
      0.10.0
    • toString

      @NotNull @Contract(pure=true) public @NotNull String toString()
      Specified by:
      toString in class TextHolder
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class TextHolder
    • equals

      public boolean equals(Object other)
      Specified by:
      equals in class TextHolder
    • asLegacyString

      @NotNull @Contract(pure=true) public @NotNull String asLegacyString()
      Description copied from class: TextHolder
      Converts the text wrapped by this class instance to a legacy string, keeping the original formatting.
      Specified by:
      asLegacyString in class TextHolder
      Returns:
      the wrapped value represented as a legacy string
    • asInventoryTitle

      @NotNull @Contract(pure=true) public @NotNull Inventory asInventoryTitle(InventoryHolder holder, InventoryType type)
      Description copied from class: TextHolder
      Creates a new inventory with the wrapped value as the inventory's title.
      Specified by:
      asInventoryTitle in class TextHolder
      Parameters:
      holder - the holder to use for the new inventory
      type - the type of inventory to create
      Returns:
      a newly created inventory with the wrapped value as its title
    • asInventoryTitle

      @NotNull @Contract(pure=true) public @NotNull Inventory asInventoryTitle(InventoryHolder holder, int size)
      Description copied from class: TextHolder
      Creates a new inventory with the wrapped value as the inventory's title.
      Specified by:
      asInventoryTitle in class TextHolder
      Parameters:
      holder - the holder to use for the new inventory
      size - the count of slots the inventory should have (normal size restrictions apply)
      Returns:
      a newly created inventory with the wrapped value as its title
    • asMerchantTitle

      @NotNull @Contract(pure=true) public @NotNull Merchant asMerchantTitle()
      Description copied from class: TextHolder
      Creates a new merchant with the wrapped value as the merchant's title.
      Specified by:
      asMerchantTitle in class TextHolder
      Returns:
      a newly created inventory with the wrapped value as its title
    • asItemDisplayName

      public void asItemDisplayName(ItemMeta meta)
      Description copied from class: TextHolder
      Modifies the specified meta: sets the display name to the wrapped value.
      Specified by:
      asItemDisplayName in class TextHolder
      Parameters:
      meta - the meta whose display name to set
    • asItemLoreAtEnd

      public void asItemLoreAtEnd(ItemMeta meta)
      Description copied from class: TextHolder
      Modifies the specified meta: adds the wrapped value as a new lore line at the end
      Specified by:
      asItemLoreAtEnd in class TextHolder
      Parameters:
      meta - the meta whose lore to append to