ForgeEssentials

ForgeEssentials

339k Downloads

Making a command that outputs a tellraw link

Cyahnide opened this issue ยท 6 comments

commented

Hello,

So I decided to take a crack at it and make myself a simple command.
I was following the the example of the god script.

This is my script.

{
  "name": "site",
  "usage": "/site",
  "extraPermissions": {},
   "patterns": {
    "": [
      "$/tellraw @p Visit ["",{"text":"mysite","underlined":true,"clickEvent":{"action":"open_url","value":"http://mysite.net"}}] for more info!"
    ]
  },
  "aliases": []
}

This works when I put it in a command block, but when I put it in in a command, it doesn't work.

commented

Doing that outputs this
Invalid json: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 8

commented

You probably just didn't escape the json properly.
It should be

"$/tellraw @p Visit [\"\",{\"text\":\"mysite\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http://mysite.net\"}}] for more info!"
    ]

Check server console for errors when starting the server.
If it could not parse the json correctly, the command will not be registered and you will get a message telling you that if you try to use it.

commented

It says it's valid. But I still get that error.

commented

Does this happens when the command is ran or when it is loaded with fereload?

commented

Use http://jsonlint.com/ for example to make sure your json is correct.

commented

When the command is ran.