Get started
This is a guide to learn how to create TextComponent by using the EasyComponent library.
Create an EasyComponent
The EasyComponent
class can be used to create your TextComponent
. Here are all the available methods you can use:
Text editing methods
Method
Description
setText(String text)
Add a text to a TextComponent
.
setColor(ChatColor color)
Set a text color to a TextComponent
.
setBold(boolean bold)
Set true
to put the text of a TextComponent
in bold.
setItalic(boolean italic)
Set true
to put the text of a TextComponent
in italic.
setObfuscated(boolean obfuscated)
Set true
to obsfucate the text of a TextComponent
.
setStrikethrough(boolean strikethrough)
Set true
to put the text of a TextComponent
in strikethrough.
Chat clicking actions
Method
Description
showText(String text)
Display a text when hovering over the TextComponent
in the chat.
openUrl(String url)
Open an URL by clicking on the TextComponent
in the chat.
runCommand(String command)
Run a command by clicking on the TextComponent
in the chat.
suggestCommand(String command)
Suggest a command by clicking on the TextComponent
in the chat.
The content of the command
parameter should not start with a slash.
Replace methods
Method
Description
replace(String toReplace, EasyComponent replaceWith)
Replace each substring of the text of the component that matches with the toReplace
sequence with the specified EasyComponent
.
replace(String toReplace, TextComponent replaceWith)
Replace each substring of the text of the component that matches with the toReplace
sequence with the specified TextComponent
.
General methods
Method
Description
addExtra(EasyComponent component)
Add an EasyComponent
as extra to the current one.
addExtra(TextComponent component)
Add a TextComponent
as extra to the current one.
setExtra(List<BaseComponent extra)
Set a list of extra components which will replace the preceding one. The list will not be set if the it is empty or null.
getAsTextComponent()
Get the current EasyComponent
as a TextComponent
.
Last updated
Was this helpful?