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 InventoryasInventoryTitle(InventoryHolder holder, int size) Creates a new inventory with the wrapped value as the inventory's title.@NotNull InventoryasInventoryTitle(InventoryHolder holder, InventoryType type) Creates a new inventory with the wrapped value as the inventory's title.voidasItemDisplayName(ItemMeta meta) Modifies the specified meta: sets the display name to the wrapped value.voidasItemLoreAtEnd(ItemMeta meta) Modifies the specified meta: adds the wrapped value as a new lore line at the end@NotNull StringConverts the text wrapped by this class instance to a legacy string, keeping the original formatting.@NotNull MerchantCreates a new merchant with the wrapped value as the merchant's title.static @NotNull StringHolderempty()Gets an instance that contains no characters.booleaninthashCode()static @NotNull StringHolderWraps the specified legacy string.@NotNull StringtoString()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:
toStringin classTextHolder
-
hashCode
public int hashCode()- Specified by:
hashCodein classTextHolder
-
equals
- Specified by:
equalsin classTextHolder
-
asLegacyString
Description copied from class:TextHolderConverts the text wrapped by this class instance to a legacy string, keeping the original formatting.- Specified by:
asLegacyStringin 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:TextHolderCreates a new inventory with the wrapped value as the inventory's title.- Specified by:
asInventoryTitlein 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:TextHolderCreates a new inventory with the wrapped value as the inventory's title.- Specified by:
asInventoryTitlein 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:TextHolderCreates a new merchant with the wrapped value as the merchant's title.- Specified by:
asMerchantTitlein classTextHolder- Returns:
- a newly created inventory with the wrapped value as its title
-
asItemDisplayName
Description copied from class:TextHolderModifies the specified meta: sets the display name to the wrapped value.- Specified by:
asItemDisplayNamein classTextHolder- Parameters:
meta- the meta whose display name to set
-
asItemLoreAtEnd
Description copied from class:TextHolderModifies the specified meta: adds the wrapped value as a new lore line at the end- Specified by:
asItemLoreAtEndin classTextHolder- Parameters:
meta- the meta whose lore to append to
-