Check if player clicks "--->" in chat?

Discussion in 'Plugin Development' started by BurnerDiamond, Mar 18, 2015.

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

    BurnerDiamond

    When I send a message to a player I want them to click the string "--->" to view the second message. Is there an event to check if they're clicking something in chat or anything of the sort?
     
  2. Online

    timtower Administrator Administrator Moderator

    @BurnerDiamond Only client side as far as I know, part of tellraw
     
  3. Offline

    BurnerDiamond

    Possible link is possible?

    I understand the client side problem but it seems weird since command Blocks are able to register when this happens.
     
  4. Online

    timtower Administrator Administrator Moderator

    Are the command blocks able or the client?
     
  5. Offline

    Monkey_Swag

    You could use JSON
     
  6. Offline

    BurnerDiamond

    How would I use JSON

    I'm not even sure at this point
     
  7. Offline

    BurnerDiamond

    I'm failing to understand on how to implement this in a clickEvent and having difficulty understand the concept of the JSON and the code you game me.

    Could you possibly explain in more detail?
     
  8. The clickEvent is built in in the message.
    I make the json text more readable:
    Sometimes you need to write " in a message. But that would mess up the String.
    Use the escaped char for it: \"
    Heres the json(seperated in different lines to make it better readable):
    Code:java
    1. {
    2. text:"example text.",
    3. extra:[
    4. {
    5. text:"after example text",
    6. clickEvent:
    7. {
    8. action:"run_command",
    9. value:"This will be executed as a command when the player clicks the message"
    10. }
    11. }
    12. ]
    13. }
     
    Last edited: Mar 19, 2015
  9. Offline

    BurnerDiamond

    So for the value would I put p.sendMessage("Something");
     
  10. Value is the command/message the player writes in chat
    For a more detailed informations search on Google for a tellraw tutorial
     
  11. @BurnerDiamond
    I think this resource could help you
    Json is another lenguage different from java. Anyways you can implement it on bukkit ussing packets.
    You can learn it the hard way or just let that resource do the work for you
     
  12. JSON is not hard to learn. Theres no need for so much methods and stuff because its a very simple task he wants.
    This site can generate the JSON for you easily with a user friendly gui: http://minecraftjson.com/
     
  13. Offline

    1Rogue

    You would put an actual command, such as "msg SomePlayer ", which is where "suggest_command" comes in handy when you need additional input from the player as it will only insert the command into their chat (but not execute)
     
  14. @BurnerDiamond
    Well, I think is best to use run_command instead of suggest_command, so the player doesn`t knows what the command is.


    @1Rogue what does φ do?
    EDIT: ohh, it`s the name of your variable xD
     
  15. Offline

    1Rogue

    Yes, I was referring to the specific case of needing input from the player.
     
  16. He wants something to happen when the player clicks the text. The only input he wants is a clickEvent.
     
Thread Status:
Not open for further replies.

Share This Page