public class TextComponentBuilder
extends java.lang.Object
| Constructor and Description |
|---|
TextComponentBuilder() |
| Modifier and Type | Method and Description |
|---|---|
static TextComponent |
build(java.lang.Object... parts)
Build a new text component from the given parts.
Special types: - null: End the current component and start a new one- TextFormatting: Add a new formatting to the current style- Color: Add a new rgb color to the current style- ClickEvent: Add a new click event to the current style- HoverEvent: Add a new hover event to the current style- Style: Set the current styleAll other objects will be converted to a string and added to the current component. The order of the parts is important: First you have to add the text and then the formattings and events. Example: build("Hello", Formatting.RED, " World", Formatting.GREEN)This results in a component with "Hello" in red and " World" in green. |
public static TextComponent build(java.lang.Object... parts)
null: End the current component and start a new oneTextFormatting: Add a new formatting to the current styleColor: Add a new rgb color to the current styleClickEvent: Add a new click event to the current styleHoverEvent: Add a new hover event to the current styleStyle: Set the current stylebuild("Hello", Formatting.RED, " World", Formatting.GREEN)parts - The parts of the text component