Hello all,
I’ve been trying at this for a little while now. My aim is to send a json message via /tellraw to my server on a fixed interval using the Scheduling tab. Here is an example message:
/tellraw @a ["",{"text":"[Server] ","color":"dark_red","bold":true,"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"This is a scheduled server message.","color":"gray"}]}}},{"text":"Please put all community items back in a chest before logging off!","color":"aqua","bold":false}]
Digging through the forums, I found that not only did I have to escape each ", I also had to escape each \ as well. So, I ended up with this:
/tellraw @a [\\"\\",{\\"text\\":\\"[Server] \\",\\"color\\":\\"dark_red\\",\\"bold\\":true,\\"hoverEvent\\":{\\"action\\":\\"show_text\\",\\"value\\":{\\"text\\":\\"\\",\\"extra\\":[{\\"text\\":\\"This is a scheduled server message.\\",\\"color\\":\\"gray\\"}]}}},{\\"text\\":\\"Please put all community items back in a chest before logging off!\\",\\"color\\":\\"aqua\\",\\"bold\\":false}]/tellraw @a [\\"\\",{\\"text\\":\\"[Server] \\",\\"color\\":\\"dark_red\\",\\"bold\\":true,\\"hoverEvent\\":{\\"action\\":\\"show_text\\",\\"value\\":{\\"text\\":\\"\\",\\"extra\\":[{\\"text\\":\\"This is a scheduled server message.\\",\\"color\\":\\"gray\\"}]}}},{\\"text\\":\\"Please put all community items back in a chest before logging off!\\",\\"color\\":\\"aqua\\",\\"bold\\":false}]
This works fine if I manually send it via the console. However, whenever I attempt to put this into a cron expression, like this:
[hash]
command=stuff
source=* * * * *
msg=tellraw @a [\"\",{\"text\":\"[Server] \",\"color\":\"dark_red\",\"bold\":true,\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"This is a scheduled server message.\",\"color\":\"gray\"}]}}},{\"text\":\"Please remember to put all community items in a chest before logging off!\",\"color\":\"aqua\",\"bold\":false}]
enabled=true
no matter how many \s I put, it always boils down to one . I figured I need 4 \s (to boil down to 2 for the command). Then, since the "s are not properly escaped, the message never sends (nor do I get an error). I have tried creating these cron expressions via the web UI and directly editing cron.config. In both cases, once the cron job is started or another one is edited, I always end up with one \s.
Is there a workaround to have whatever interprets the cron expressions and command literally or to somehow not treat the \ as an escape character? I have tried quotes, and this did fix the escape character issue. But, Minecraft then did not recognize '/tellraw as a command.
My final goal is to put this:
/tellraw @a [\\"\\",{\\"text\\":\\"[Server] \\",\\"color\\":\\"dark_red\\",\\"bold\\":true,\\"hoverEvent\\":{\\"action\\":\\"show_text\\",\\"value\\":{\\"text\\":\\"\\",\\"extra\\":[{\\"text\\":\\"This is a scheduled server message.\\",\\"color\\":\\"gray\\"}]}}},{\\"text\\":\\"Please put all community items back in a chest before logging off!\\",\\"color\\":\\"aqua\\",\\"bold\\":false}]/tellraw @a [\\"\\",{\\"text\\":\\"[Server] \\",\\"color\\":\\"dark_red\\",\\"bold\\":true,\\"hoverEvent\\":{\\"action\\":\\"show_text\\",\\"value\\":{\\"text\\":\\"\\",\\"extra\\":[{\\"text\\":\\"This is a scheduled server message.\\",\\"color\\":\\"gray\\"}]}}},{\\"text\\":\\"Please put all community items back in a chest before logging off!\\",\\"color\\":\\"aqua\\",\\"bold\\":false}]
into a scheduled task.