🔨Message Builder
Create messages with hover events and other cool stuff
Overview
The MessageBuilder class provides utility methods to build clickable and hoverable text components using the BungeeCord API.
Methods
buildHoverText
buildHoverTextpublic static TextComponent buildHoverText(TextComponent baseComponent, String hoverText)Builds a hoverable text component with the specified base component and hover text.
Parameters
baseComponent: The base TextComponent to which the hover event will be added.hoverText: The text to be displayed when hovering over the base component.
Returns
TextComponent: The modified TextComponent with the added hover event.
buildCommandText
buildCommandTextpublic static TextComponent buildCommandText(String text, String clickCommand)Builds a clickable text component with the specified text and command to be executed when clicked.
Parameters
text: The text to be displayed.clickCommand: The command to be executed when the text is clicked.
Returns
TextComponent: The clickable TextComponent.
buildEntityText
buildEntityTextBuilds a hoverable text component displaying information about an entity type when hovered over.
Parameters
text: The text to be displayed.entityType: The EntityType to be displayed information about.
Returns
TextComponent: The hoverable TextComponent displaying entity information.
buildOpenUrlText
buildOpenUrlTextBuilds a clickable text component that opens a URL when clicked.
Parameters
text: The text to be displayed.url: The URL to be opened when the text is clicked.
Returns
TextComponent: The clickable TextComponent.
Usage
Use the static methods of the
MessageBuilderclass to create clickable and hoverable text components.Provide the necessary parameters to each method to customize the text behavior.
Use the returned
TextComponentobjects wherever you need to display formatted and interactive text in your plugin.
Example
Last updated