Class ComponentHolder
java.lang.Object
com.github.stefvanschie.inventoryframework.adventuresupport.TextHolder
com.github.stefvanschie.inventoryframework.adventuresupport.ComponentHolder
Wrapper of an Adventure
Component.- Since:
- 0.10.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription@NotNull com.google.gson.JsonElementasJson()Gets the wrapped Adventure component in a JSON representation.@NotNull StringConverts the text wrapped by this class instance to a legacy string, keeping the original formatting.boolean@NotNull ComponentGets the Adventure component this instance wraps.inthashCode()static @NotNull ComponentHolderWraps the specified Adventure component.@NotNull StringtoString()Methods inherited from class com.github.stefvanschie.inventoryframework.adventuresupport.TextHolder
asInventoryTitle, asInventoryTitle, asItemDisplayName, asItemLoreAtEnd, asMerchantTitle, deserialize, empty
-
Field Details
-
value
The Adventure component this instance wraps.
-
-
Method Details
-
of
@NotNull @Contract(pure=true) public static @NotNull ComponentHolder of(@NotNull @NotNull Component value) Wraps the specified Adventure component.- Parameters:
value- the value to wrap- Returns:
- an instance that wraps the specified value
- Since:
- 0.10.0
-
getComponent
Gets the Adventure component this instance wraps.- Returns:
- the contained Adventure component
- Since:
- 0.10.0
-
asJson
@NotNull @Contract(pure=true) public @NotNull com.google.gson.JsonElement asJson()Gets the wrapped Adventure component in a JSON representation.- Returns:
- the contained Adventure component as JSON
- 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
-