JSon Chat message to normal String

Discussion in 'Plugin Development' started by rickydaan, Feb 27, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    rickydaan

    Hello,

    Here's the problem. I need to convert a JSon Chat message (Example: {"extra":[{"color":"yellow","
    text":"rickydaan joined the game"}],"text":""}) to a String (Example: &erickydaan joined the game)

    I believe (Not sure) that there's a simple solution to do this, but I am not sure, and I am in need of this function soon! Did some researching, couldn't find it on google. Sorry if it is solved somewhere else!

    Kind regards,
    Rickydaan.
     
  2. Offline

    tomudding

    Why does it need to be converted. Why not use a JSON free message instead of one with JSON?! And more information is needed to help in a perfect way
     
  3. Offline

    rickydaan

    @tomudding I am working on a filter using ProtocolLib. The outgoing chat is already encoded in JSon. I believe I can also iterate over the strings and filter the "text" fields only, that'd save performance rather than encoding and decoding the whole string
     
    tomudding likes this.
Thread Status:
Not open for further replies.

Share This Page