@NotThreadSafe public final class MessageBuilder extends Object
Constructor and Description |
---|
MessageBuilder(String message)
Starts off with the text of the message
|
Modifier and Type | Method and Description |
---|---|
String |
asJson()
The String format of the JSON to be sent as the formatted text
|
MessageBuilder |
build()
Completes the building of the message, after this call no change should be made.
|
MessageBuilder |
color(ChatColor color)
Sets the text color of the message
|
MessageBuilder |
file(String file)
Makes the message a clickable link that opens a file on the player's client
|
MessageBuilder |
hover(String message)
Causes a popup to open when the the message is hovered over
|
boolean |
isBuilt()
Returns if the
build() method has been called or not |
MessageBuilder |
link(String url)
Makes the message a clickable link
|
MessageBuilder |
sendTo(Player... players)
Sends the formatted text to the specified players
|
MessageBuilder |
then(Message message)
Appends extra text to the end of this message
|
MessageBuilder |
then(String message)
Appends extra text to the end of this message
|
String |
toString() |
public MessageBuilder(String message)
message
- the text to sendpublic MessageBuilder color(ChatColor color)
color
- the color the message should bepublic MessageBuilder link(String url)
url
- the URL to lead the player to when the message is clickedpublic MessageBuilder file(String file)
file
- the file to open, must be available on the clientpublic MessageBuilder hover(String message)
message
- the message in the popuppublic MessageBuilder then(String message)
message
- the message to be appended after the current textpublic MessageBuilder then(Message message)
message
- the message to be appended after the current textpublic MessageBuilder build()
asJson()
and
sendTo(net.tridentsdk.entity.living.Player...)
may be called on the returned objectpublic String asJson()
public boolean isBuilt()
build()
method has been called or notpublic MessageBuilder sendTo(Player... players)
players
- the players to send the formatted textCopyright © 2016. All rights reserved.