SHsuperCM Posted August 9, 2016 Share Posted August 9, 2016 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.. Quote Doing stuff n' things Link to comment Share on other sites More sharing options...
SHsuperCM Posted August 9, 2016 Author Share Posted August 9, 2016 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? Quote Doing stuff n' things Link to comment Share on other sites More sharing options...
SHsuperCM Posted August 10, 2016 Author Share Posted August 10, 2016 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} Quote Doing stuff n' things Link to comment Share on other sites More sharing options...
SHsuperCM Posted August 10, 2016 Author Share Posted August 10, 2016 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..... Quote Doing stuff n' things Link to comment Share on other sites More sharing options...
SHsuperCM Posted August 10, 2016 Author Share Posted August 10, 2016 {TOPIC CLOSED} unsubbing from topic... Quote Doing stuff n' things Link to comment Share on other sites More sharing options...
Recommended Posts
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.