Jump to content

Recommended Posts

Posted

I there a way to get the raw sent json from the chat event?

I want to end with the result of something like

{"text":"this is just a text!","color":"red"}

And I belive it'll tell me how to get the commands executed by some clickable text that - lets say - the tellraw command makes..

Doing stuff n' things

Posted

You really don't want the raw JSON, you want to interact with ITextComponent instead of strings. ITextComponent has a method getStyle which gives you a Style object which allows you to set a ClickEvent for the whole component.

 

no no, i want to use it one time to get it to the console so i could read what the server put in the clickable command.... im not planning to use this on the code after i get this....

 

how can i get the json or just get the commands that clickable chat does?

Doing stuff n' things

Posted

Do the reverse of what I said then, you can get the click event from the ITextComponent. You can get the components from GuiNewChat which has a field chatLines. The ChatLine class then has a reference to the ITextComponent.

ok you made it a bit too complicated than it should be...

all i asked from the start is get the raw json of a text message....

 

thanks to you i looked a bit more into

ITextComponent

and found

ITextComponent.Serializer.componentToJson(ITextComponent)

which returns the raw json of the component object and that's exactly what i needed as you get the component from the

ClientChatReceivedEvent

and it works perfectly! thanks alot!

 

{TOPIC CLOSED}

Doing stuff n' things

Posted

You should not be using the raw json...

Why do you want it?

again, this is not something that i would use after in my mod...

its being logged and i know to decipher what i need from it manually......

 

i used it now to test on hypixel soccer game when it says "want to play again? click me!" and took its raw json...

then i got that "/play arcade_soccer" makes you play a game of soccer... there are more commands i can figure with that and such.....

Doing stuff n' things

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.