Class JsonText
java.lang.Object
xyz.gmitch215.socketmc.util.render.text.Text
xyz.gmitch215.socketmc.util.render.text.JsonText
- All Implemented Interfaces:
Serializable
Represents text formatted from a JSON string.
- See Also:
-
Field Summary
Fields inherited from class xyz.gmitch215.socketmc.util.render.text.Text
dropShadow, FONT_HEIGHT
-
Method Summary
Modifier and TypeMethodDescriptionempty()
Creates an empty JsonText object.int
getColor()
Deprecated.UnsupportedCreates a new JsonText object with the given JSON string.Creates a new JsonText object with the given message in text form.toJSON()
Gets the JSON string.Creates a new JsonText object with the given message in translation form.Methods inherited from class xyz.gmitch215.socketmc.util.render.text.Text
isDropShadow, setDropShadow
-
Method Details
-
getColor
Deprecated.UnsupportedDescription copied from class:Text
Gets the color as an ARGB integer. -
toJSON
Gets the JSON string. -
empty
Creates an empty JsonText object.- Returns:
- JsonText object
-
raw
@NotNull public static @NotNull JsonText raw(@NotNull @NotNull String json) throws IllegalArgumentException Creates a new JsonText object with the given JSON string. This method does not perform JSON validation.- Parameters:
json
- JSON string- Returns:
- JsonText object
- Throws:
IllegalArgumentException
- if the JSON is null or empty
-
text
@NotNull public static @NotNull JsonText text(@NotNull @NotNull String text) throws IllegalArgumentException Creates a new JsonText object with the given message in text form.- Parameters:
text
- JSON string- Returns:
- JsonText object
- Throws:
IllegalArgumentException
- if the text is null or empty
-
translate
@NotNull public static @NotNull JsonText translate(@NotNull @NotNull String key) throws IllegalArgumentException Creates a new JsonText object with the given message in translation form.- Parameters:
key
- Translation key- Returns:
- JsonText object
- Throws:
IllegalArgumentException
- if the key is null or empty
-