Class PlainText
java.lang.Object
xyz.gmitch215.socketmc.util.render.text.Text
xyz.gmitch215.socketmc.util.render.text.PlainText
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BukkitText
Represents a text element with plain text.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
The color for this text element.protected String
The text content for this text element.Fields inherited from class xyz.gmitch215.socketmc.util.render.text.Text
dropShadow, FONT_HEIGHT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionempty()
Creates a new text element with empty text content.int
getAlpha()
Gets the alpha value for the color in this text element.int
getColor()
Gets the color as an ARGB integer.getText()
Gets the text content for this text element.Creates a new text element with the specified text content.void
setAlpha
(int alpha) Sets the alpha value for the color in this text element.void
setColor
(int color) 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.Text
isDropShadow, setDropShadow
-
Field Details
-
text
The text content for this text element. -
color
protected int colorThe color for this text element.
-
-
Constructor Details
-
PlainText
public PlainText()Constructs a new, empty text element. -
PlainText
Constructs a new text element.- Parameters:
text
- Text Content
-
PlainText
Constructs a new text element.- Parameters:
text
- Text Contentcolor
- Color
-
PlainText
Constructs a new text element.- Parameters:
text
- Text Contentcolor
- Color as an ARGB integer
-
-
Method Details
-
getText
Gets the text content for this text element.- Returns:
- Text Content
-
setText
Sets the text content for this text element.- Parameters:
text
- Text Content- Throws:
IllegalArgumentException
- if the text is null
-
getColor
public int getColor()Description copied from class:Text
Gets the color as an ARGB integer. -
setColor
public void setColor(int color) Sets the color for this text element.- Parameters:
color
- Color as an ARGB integer
-
getAlpha
public int getAlpha()Gets the alpha value for the color in this text element.- Returns:
- Color Alpha
-
setAlpha
public void setAlpha(int alpha) Sets the alpha value for the color in this text element.- Parameters:
alpha
- Color Alpha
-
toJSON
Description copied from class:Text
Serializes this text element to a JSON string compatible with the Minecraft Component format. -
empty
Creates a new text element with empty text content.- Returns:
- Empty Text Element
-
of
Creates a new text element with the specified text content.- Parameters:
text
- Text Content- Returns:
- Text Element
-