4

I need to have a commandblock output a clickable url to the chat with the playername inside of it and some scoreboard variables.
Example:

http://example.com/?player=<INSERT PLAYERNAME HERE>&variable1=<INSERT SCOREBOARD VARIABLE Here>

is there any way to do this?

3

As far as I know, this is impossible. The "value" field of a "clickEvent" object can only be a simple string, not another JSON object itself. There seems to also be no other way of piecing together e.g. something to be copied to the player's clipboard.

The best you can do is to just output the link to chat as text:

/tellraw @p [{"text":"https://gaming.stackexchange.com/users/"},{"score":{"name":"@p","objective":"number"}}]

When this is executed, a line similar to this one appears in the targeted player's game log:

[03:32:08] [Render thread/INFO]: [CHAT] https://gaming.stackexchange.com/users/171580

In some text editors the player can then e.g. double-click on the link, in others the link needs to be copied and pasted into a browser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.