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
-
Method Summary
Modifier and TypeMethodDescription@NotNull com.google.gson.JsonElement
asJson()
Gets the wrapped Adventure component in a JSON representation.@NotNull String
Converts the text wrapped by this class instance to a legacy string, keeping the original formatting.boolean
@NotNull Component
Gets the Adventure component this instance wraps.int
hashCode()
static @NotNull ComponentHolder
Wraps the specified Adventure component.@NotNull String
toString()
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:
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
-