Class StringHolder
java.lang.Object
com.github.stefvanschie.inventoryframework.adventuresupport.TextHolder
com.github.stefvanschie.inventoryframework.adventuresupport.StringHolder
Wrapper of a legacy string value.
ChatColor
based formatting is used.- Since:
- 0.10.0
-
Method Summary
Modifier and TypeMethodDescription@NotNull Inventory
asInventoryTitle
(InventoryHolder holder, int size) Creates a new inventory with the wrapped value as the inventory's title.@NotNull Inventory
asInventoryTitle
(InventoryHolder holder, InventoryType type) Creates a new inventory with the wrapped value as the inventory's title.void
asItemDisplayName
(ItemMeta meta) Modifies the specified meta: sets the display name to the wrapped value.void
asItemLoreAtEnd
(ItemMeta meta) Modifies the specified meta: adds the wrapped value as a new lore line at the end@NotNull String
Converts the text wrapped by this class instance to a legacy string, keeping the original formatting.@NotNull Merchant
Creates a new merchant with the wrapped value as the merchant's title.static @NotNull StringHolder
empty()
Gets an instance that contains no characters.boolean
int
hashCode()
static @NotNull StringHolder
Wraps the specified legacy string.@NotNull String
toString()
Methods inherited from class com.github.stefvanschie.inventoryframework.adventuresupport.TextHolder
deserialize
-
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
Gets an instance that contains no characters.- Returns:
- an instance without any characters
- Since:
- 0.10.0
-
toString
- Specified by:
toString
in classTextHolder
-
hashCode
public int hashCode()- Specified by:
hashCode
in classTextHolder
-
equals
- Specified by:
equals
in classTextHolder
-
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 classTextHolder
- 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 classTextHolder
- Parameters:
holder
- the holder to use for the new inventorytype
- 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 classTextHolder
- Parameters:
holder
- the holder to use for the new inventorysize
- 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
Description copied from class:TextHolder
Creates a new merchant with the wrapped value as the merchant's title.- Specified by:
asMerchantTitle
in classTextHolder
- Returns:
- a newly created inventory with the wrapped value as its title
-
asItemDisplayName
Description copied from class:TextHolder
Modifies the specified meta: sets the display name to the wrapped value.- Specified by:
asItemDisplayName
in classTextHolder
- Parameters:
meta
- the meta whose display name to set
-
asItemLoreAtEnd
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 classTextHolder
- Parameters:
meta
- the meta whose lore to append to
-