Solved JSON Chat

Discussion in 'Spigot Plugin Development' started by Goofan, Jun 17, 2016.

  1. So I am following this:
    https://www.spigotmc.org/wiki/the-chat-component-api/
    Trying to create events for chat however I'm getting an error on p.sendMessage(message);

    Following the Events paragraf...

    Error:
    The method sendMessage(String) in the type CommandSender is not applicable for the arguments (TextComponent)
    Suggestions it points out does not work either:
    sendRawMessage();
    Change type of message to String...

    Now since I'm following the official tutorial by spigot on this I don't know where I went wrong :/

    Thanks in Advance,
    Thomas
     
  2. Try this. I haven't tested it:
    Code (Text):
    new TextComponent( "Hello world" ).getText()
     
  3. Choco

    Moderator

    player.spigot().sendMessage()
     
    • Winner Winner x 3
  4. That would return the text without formatting, the method the OP wants is toLegacyText()
     
    • Optimistic Optimistic x 1
    • Like Like x 1
  5. Thank you that worked :)
    I think they should update the tuturial I followed to add this
     
    • Agree Agree x 1
  6. It's a wiki, anyone can change it, just done a small addition to demo you can do it with spigot.
     
    • Like Like x 1
  7. Alright well I just changed the wiki then I hope noone minds :) If so feel free to revert my changes and add an explination to why it shouldn't be .spigot() there :)