Class BukkitText
java.lang.Object
xyz.gmitch215.socketmc.util.render.text.Text
xyz.gmitch215.socketmc.util.render.text.PlainText
xyz.gmitch215.socketmc.util.render.text.BukkitText
- All Implemented Interfaces:
Serializable
Represents a text element to be displayed on the client's screen, built by a
String
. This class will automatically strip color codes from PlainText.getText()
.- See Also:
-
Field Summary
Fields inherited from class xyz.gmitch215.socketmc.util.render.text.Text
dropShadow, FONT_HEIGHT
-
Constructor Summary
ConstructorDescriptionConstructs a new, empty text element.BukkitText
(@NotNull String text) Constructs a new text element.BukkitText
(@NotNull String text, int color) Constructs a new text element.BukkitText
(@NotNull String text, @NotNull ChatColor color) Constructs a new text element. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Sets the color for this text element.void
Sets the text content for this text element.toJSON()
Serializes this text element to a JSON string compatible with the Minecraft Component format.Methods inherited from class xyz.gmitch215.socketmc.util.render.text.PlainText
empty, getAlpha, getColor, getText, of, setAlpha, setColor
Methods inherited from class xyz.gmitch215.socketmc.util.render.text.Text
isDropShadow, setDropShadow
-
Constructor Details
-
BukkitText
public BukkitText()Constructs a new, empty text element. -
BukkitText
Constructs a new text element.- Parameters:
text
- Text Content
-
BukkitText
public BukkitText(@NotNull @NotNull String text, @NotNull @NotNull ChatColor color) throws IllegalArgumentException Constructs a new text element.- Parameters:
text
- Text Contentcolor
- ChatColor value- Throws:
IllegalArgumentException
-
BukkitText
Constructs a new text element.- Parameters:
text
- Text Contentcolor
- Color as an ARGB integer- Throws:
IllegalArgumentException
- if the text is null
-
-
Method Details
-
setText
Sets the text content for this text element.- Overrides:
setText
in classPlainText
- Parameters:
text
- Text Content- Throws:
IllegalArgumentException
- if the text is null
-
setColor
Sets the color for this text element.- Parameters:
color
- Color- Throws:
IllegalArgumentException
- if the color is null
-
toJSON
Description copied from class:Text
Serializes this text element to a JSON string compatible with the Minecraft Component format.
-