Package net.minestom.server.chat
Class JsonMessage
java.lang.Object
net.minestom.server.chat.JsonMessage
- Direct Known Subclasses:
ColoredText
,JsonMessage.RawJsonMessage
,RichMessage
public abstract class JsonMessage
extends java.lang.Object
Represents a json message which can be send to a player.
Examples are ColoredText
and RichMessage
.
- See Also:
- Chat Format
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JsonMessage.RawJsonMessage
-
Constructor Summary
Constructors Constructor Description JsonMessage()
-
Method Summary
Modifier and Type Method Description abstract com.google.gson.JsonObject
getJsonObject()
Gets the json representation of this message.protected void
refreshUpdate()
Signals that the final json string changed and that it will need to be updated.java.lang.String
toString()
Gets the Json representation.
-
Constructor Details
-
JsonMessage
public JsonMessage()
-
-
Method Details
-
getJsonObject
@NotNull public abstract com.google.gson.JsonObject getJsonObject()Gets the json representation of this message.Sent directly to the client.
- Returns:
- the json representation of the message
- See Also:
toString()
-
refreshUpdate
protected void refreshUpdate()Signals that the final json string changed and that it will need to be updated. -
toString
@NotNull public java.lang.String toString()Gets the Json representation.Will check of the current cached compiled json is up-to-date in order to prevent re-parsing the message every time.
- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string json representation
- See Also:
getJsonObject()
,refreshUpdate()
-