Solved JSON chat clicking

Discussion in 'Plugin Development' started by Pixelatorx2, Oct 7, 2016.

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

    Pixelatorx2

    To be clear - I do not need assistance creating any sort of JSON messages, I can do that fine.

    I was just wondering if there was a way to check when a player clicks the message in chat (ie. to open a link, run a command, suggest a command, etc.) or if there was a way to force a player to click one, intercept the packets, or simulate a player clicking one. I believe they are client sided, but I could always be wrong.

    Thanks in advance!
     
  2. @Pixelatorx2
    Yes, just add a
    Code:json
    1. "clickEvent":{"action":"run_command","value":"/mycommand"}
    to the chat component. It'll run "/mycommand" when it gets clicked. You can also put in these values instead of "run_command" (I think it's self-explanatory what they do):
    • open_url
    • open_file (cannot be sent from the server)
    • suggest_command
    • change_page

    If you want an example how you can react to when a player clicks in chat, you might want to have a look at my in-game chat snake game here:
    https://github.com/Alvin-LB/BukkitSnake

    And on the topic of minecraft chat components, this page provides excellent documentation on them:
    http://www.minecraftforum.net/forum...9-json-text-component-for-tellraw-title-books
     
    Last edited: Oct 7, 2016
  3. Offline

    Pixelatorx2

    Sorry, I should have clarified. The end result of what I want to do is force a player to open their chat box. This can be done with /tellraw (using suggest command) but only when the client clicks something in chat. I don't want to run a command when they click, because I'm trying to simulate the player clicking the chat without them actually clicking anything. I don't think this can be done, because it is most likely server sided.
    @AlvinB
     
  4. Offline

    Pixelatorx2

    @AlvinB
    Figured as much. Thanks for your help!
     
Thread Status:
Not open for further replies.

Share This Page