#Send JSON message without building TextComponent

1 messages · Page 1 of 1 (latest)

pliant meadow
#

Is it possible not to use the TexComponent API and send a JSON message?
I'm attempting to optimize some chat stuff in a plugin and building TextComponents (that are not actually used) takes up a lot of time.

lunar perch
#

Honestly I think that's a premature optimization. You might need to look into nms for this though. Also make sure you aren't using paper. Spigot doesn't require you to use text components you can use legacy text with most of the api

pliant meadow
#

I'm optimizing because I need to send many messages to many players with slightly modified content per message

#

Also I need to use hover- & click-events and legacy text doesn't support them iirc

lusty musk
#

They do, you just need to include the proper tags.

#

Here's an example with tellraw:
/tellraw @a ["",{"text":"Welcome to "},{"text":"Minecraft Tools","clickEvent":{"action":"open_url","value":"https://google.com"}}]

pliant meadow
#

Isn't that the newer JSON format?

lusty musk
#

It is

pliant meadow
#

Does spigot accept that as legacy text?

lusty musk
#

AFAIK, it should.

pliant meadow
#

Oh I thought it only supports Text §clike §rthis

#

ok lemme check

#

Ok I can't check until tomorrow but in case it doesn't work i'll try looking into NMS