Server.broadCastMessage() Error

I am writing because I have a problem with Server.broadcastMessage() function
I tried to send message like this broadcastMessage(“STRING”); But it says that it need Text property and not accept
Strings, I dont know how to Make a text property because MessageBuilder is not working. How did Sponge is sending Messages.

Error message please. SpongeDocs and the JavaDocs will help you.

The Text API was recently revamped and there is not much documentation of it yet.
You need to build the Text instance using an appropriate TextBuilder, e.g.

Text myText = new TextBuilder.Literal("Some string").build();

Thanks simon816, It’s working.

1 Like

If you want, you can check out my fork of the SpongeDocs with the mostly updated Text documentation here. The way simon816 showed you will work, but I feel that it would be more advantageous to use the TextBuilder interface so that you can easily chain together messages with colors, actions, etc.

EDIT: Just wanted to warn you that I have not yet updated the Text with Selectors section of the Docs, but it seems that for what you want, you won’t need to use Selectors anyway


Zirconium THANKS