Class SpigotText
java.lang.Object
xyz.gmitch215.socketmc.util.render.text.Text
xyz.gmitch215.socketmc.util.render.text.SpigotText
- All Implemented Interfaces:
Serializable
Represents a text element to be displayed on the client's screen, built by a
BaseComponent
.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
The alpha value for the color in this text element.protected net.md_5.bungee.api.chat.BaseComponent
The text content for this text element.Fields inherited from class xyz.gmitch215.socketmc.util.render.text.Text
dropShadow, FONT_HEIGHT
-
Constructor Summary
ConstructorDescriptionConstructs a new, empty text element.SpigotText
(@NotNull net.md_5.bungee.api.chat.BaseComponent component) Constructs a new text element.SpigotText
(@NotNull net.md_5.bungee.api.chat.BaseComponent component, int alpha) Constructs a new text element. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull SpigotText
Constructs a new text element with the given text content.int
getAlpha()
Gets the alpha value for the color in this text element.int
getColor()
Gets the color as an ARGB integer.@NotNull net.md_5.bungee.api.chat.BaseComponent
Gets the text content for this text element.void
setAlpha
(int alpha) Sets the alpha value for the color in this text element.void
setComponent
(@NotNull net.md_5.bungee.api.chat.BaseComponent component) 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
-
component
protected net.md_5.bungee.api.chat.BaseComponent componentThe text content for this text element. -
alpha
protected int alphaThe alpha value for the color in this text element.
-
-
Constructor Details
-
SpigotText
public SpigotText()Constructs a new, empty text element. -
SpigotText
Constructs a new text element.- Parameters:
component
- Component for Text
-
SpigotText
public SpigotText(@NotNull @NotNull net.md_5.bungee.api.chat.BaseComponent component, int alpha) throws IllegalArgumentException Constructs a new text element.- Parameters:
component
- Component for Textalpha
- Color Alpha Value- Throws:
IllegalArgumentException
- if component is null or the alpha value is not between 0 and 255
-
-
Method Details
-
getComponent
Gets the text content for this text element.- Returns:
- Text Content
-
setComponent
public void setComponent(@NotNull @NotNull net.md_5.bungee.api.chat.BaseComponent component) throws IllegalArgumentException Sets the text content for this text element.- Parameters:
component
- Text Component- Throws:
IllegalArgumentException
- if the text is null
-
getAlpha
public int getAlpha()Gets the alpha value for the color in this text element.- Returns:
- Alpha Value
-
setAlpha
Sets the alpha value for the color in this text element.- Parameters:
alpha
- Alpha Value- Throws:
IllegalArgumentException
- if the alpha value is not between 0 and 255
-
getColor
public int getColor()Description copied from class:Text
Gets the color as an ARGB integer. -
toJSON
Description copied from class:Text
Serializes this text element to a JSON string compatible with the Minecraft Component format. -
from
@NotNull public static @NotNull SpigotText from(@NotNull @NotNull net.md_5.bungee.api.chat.BaseComponent component) Constructs a new text element with the given text content.- Parameters:
component
- Text Component- Returns:
- Text Element
-