Replace texts from strings with colors!

Hello,

I tryng to work with text but its a quick diferent to string. I only need to replace a variable in a text form string and i didnt find one way.

player.sendMessage(Text.of(RPLang.get("cmdmanager.page").toString().replace("{page}", ""+(page+1))));

RPlang get this string: &bUse &6/rp ? {page} &bfor next page.

RPLang.get(“cmdmanager.page”) returns Texts with already colors converted using

TextSerializers.FORMATTING_CODE.deserialize(str)

with colors, but when i convert to string(to replace) the color show as rgb and json codes on chat.

How can i replace using texts with colors?

Change .toString() to .toPlain()

Still showing the same:

player.sendMessage(TextSerializers.FORMATTING_CODE.deserialize(TextSerializers.FORMATTING_CODE.serialize(RPLang.get("cmdmanager.page")).replace("{page}", ""+(page+1))));

P.S. Look like you want this for localization. Any reason why you aren’t using java.text.MessageFormat (or com.ibm.icu.text.MessageFormat)?

Solved! Thanks ^^

You really should be using TextTemplates for this kind of thing.