Solved Send Player JSON Message

Discussion in 'Spigot Plugin Development' started by JoeyPlayzTV, Mar 4, 2020.

  1. Hey i want to make a plugin, that allows the user to use json messages inside the config file.

    Code (YAML):
    messages:
         test
    : '{"text":"Das ist ein Test","clickEvent":{"action":"open_url","value":"https://www.proxysocke.net"}}'

    Now my question. How i can send this message to the player.
    I will not use Text Components because the JSON must me Configurable
     
  2. You can use
    Code (Text):
    IChatBaseComponent.ChatSerializer.a(jsonString)
    to turn a json string into IChatBaseComponent

    and

    Code (Text):
    ComponentSerializer.parse(jsonString);
    to parse a json string to BaseComponent.
     
    • Like Like x 1
  3. Thanks i will try it.