JSON tellraw Click Event?

Discussion in 'Plugin Development' started by MCMatters, Dec 25, 2014.

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

    MCMatters

    I was making a plugin and i was thinking of adding the chat clicking thing.
    I want it so it sends like
    "Click Here" and then when its clicked, execute a method in my class called onClick().
     
  2. Offline

    MCMatters

    @Assist
     
  3. @MCMatters
    Not possible without some trickery. Here is a click event example from the thread
    Code:
    extra.setClickEvent(JSONChatClickEventType.RUN_COMMAND, "/example-command");
    Make that execute a command of yours. That command would then run the onClick() method.

    Edit: At least this is what I assume. I've never used this feature before.
     
  4. Offline

    MCMatters

    So i need it to run a command. Ok then i need to make a command for my item

    But i dont want ppl to randomly execute the command so..

    EDIT by Timtower: merged posts
     
    Last edited by a moderator: Dec 25, 2014
  5. Offline

    teej107

    @MCMatters I don't know if the ChatColor character can be used for commands, but you can't type in the chatcolor char in the MC chat.
     
  6. Offline

    Xtreme727

    You can create and execute a tellraw/json message with a packet. But you could also have some ArrayList when the command is executed, to add them or something similar. How ever, I don't think you can actually interact a tellraw message with Bukkit/Java.
    Something like
    Code:
    {text:"Click Me!",color:"somecolorhere",clickEvent:{action:run_command,value:'/thecommandhere'}}
     
Thread Status:
Not open for further replies.

Share This Page