Solved Execute JSON Tellraw Commands

Discussion in 'Plugin Development' started by Lionhard, Dec 29, 2014.

Thread Status:
Not open for further replies.
  1. Hello everyone!

    I'm trying to do something with the new /title feature from MC 1.8.
    Everything is working, except that I get this error when executed:
    Code:
    [17:15:56 INFO]: Invalid json: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 10
    [17:15:56 INFO]: Invalid json: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 6
    I assume it is because I just executed the command as:
    Code:
    "title " + player.getName() + " title " + strTitle
    Does anyone know how I can convert that strTitle into a JSON Raw Message?

    Thanks in advance!
     
  2. In my title class I use
    "{'text': '" + title + "'}"
    to define the title
     
    Lionhard likes this.
  3. Offline

    HeyShibby

    could you give an example of what you're putting for "strTitle" and we can see where you're going wrong.
     
  4. @HeyShibby a simple string. "Welcome to the server."

    @WD_MUFFINFLUFFER Thanks, gonna try that!

    EDIT: Great! It worked! Thank you very much :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 31, 2016
  5. Offline

    HeyShibby

    Okay your problem here is that you have spaces in between each word which is throwing the errors.

    title {text:"Text here"} <- this is the correct way of executing the command.

    title (Text here) <- will throw an error because it's thinking there's multiple arguments.


    @Lionhard please mark as solved!
     
    Lionhard likes this.
Thread Status:
Not open for further replies.

Share This Page