mojira.dev
MC-97302

Parsing failed in Books with run_command tag

There are an error in the book with the run_command tag when text command is more than 100 chars length:

1/ If the text in run_command is too long, it is troncated:

Exemple with this book:

/give @p written_book 1 0 {pages:["{\"text\":\"Hello World\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/say Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft\"} }"],title:"",author:""}

The give command is valid, but when I click in the book, the text is truncated

(see screenshot 1)

The command outside the book work with no problem:

/say Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft




2/ If I use a formatted text, there are an error. I try with the same example as 1/, but with yellow color displayed with a tellraw command:

/give @p written_book 1 0 {pages:["{\"text\":\"Hello World\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @a {\\\"text\\\":\\\"Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft\\\",\\\"color\\\":\\\"yellow\\\"}\"} }"],title:"",author:""}

When I click on the link, the following error occured:

Invalid json: Unterminated string at line 1 column 89

(see screenshot 2)

The command outside the book work with no problem:

/tellraw @a {"text":"Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft","color":"yellow"}

(see screenshot 3)


3/ The real problem with this bug is for tools book, it's impossible to make a custom tools book with complex command. For exemple, this book can spawn a zombie with a Full P4 diamond armor:

/give @p written_book 1 0 {pages:["{\"text\":\"Super Zombie\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/summon Zombie ~ ~1 ~ {ArmorItems:[{tag:{ench:[{id:0,lvl:4}]},id:\\\"minecraft:diamond_boots\\\"},{tag:{ench:[{id:0,lvl:4}]},id:\\\"minecraft:diamond_leggings\\\"},{tag:{ench:[{id:0,lvl:4}]},id:\\\"minecraft:diamond_chestplate\\\"},{id:\\\"minecraft:diamond_helmet\\\",tag:{ench:[{id:0,lvl:4}]} }]}\"} }"],title:"",author:""}

When I click on the link, the following error occured:

Data tag parsing failed: Unbalanced brackets: {ArmorItems:.....{tag:{en

(see screenshot 4)

The command outside the book work with no problem:

/summon Zombie ~ ~1 ~ {ArmorItems:[{tag:{ench:[{id:0,lvl:4}]},id:"minecraft:diamond_boots"},{tag:{ench:[{id:0,lvl:4}]},id:"minecraft:diamond_leggings"},{tag:{ench:[{id:0,lvl:4}]},id:"minecraft:diamond_chestplate"},{id:"minecraft:diamond_helmet",tag:{ench:[{id:0,lvl:4}]} }]}

(see screenshot 5)


The displayed error is always different, for a unique bug.
I report this bug because many users of my book generator report to me this problem, but I can't help them, it's a bug with Minecraft.

Attachments

Comments 4

This is working as intended because the player is running the command as if they have typed it themselves in the chat. See MC-30955:

The run_command tag in tellraw is used to define commands that are sent through the games chat system when a player clicks that component in the chat window. This command has the same limitations as any command typed into the chat directly.

One solution to make the example work is using the /trigger command.

These limits include 100-character limit, OP status for running OP-only commands (/trigger is not an OP command), required forward slash (/) for running commands, and inability to use illegal characters such as the section symbol (\u00A7) and the DEL control character (\u007F).

Skylinerw : In MC-30955 Searge spoke about the tellraw command, tellraw is a chat command, so that make a sense that a chat command have chat limitation. But here I speak about books, there is no reason to limit book feature by chat limitation. And if it's a chat system limitation like you say, that means it's a bug in Minecraft and mojang should solve it, that don't means it work as intented 😉
"Work as intented" means it's a feature that developper want, that don't means they are too lazy to solve it 😉

About the trigger solution, yes it's a solution for tellraw command because most of time tellraw command is part of a command blocks system, but that make a non sense to need a command blocks system to be able to use a book.

It's the JSON text component you're using. /tellraw and books use the same thing. The "run_command" function is for the text component, not the /tellraw command specifically. There really is no difference here. It doesn't matter if a book itself is not the /tellraw command, because the clickEvents are the same: the clicking player is running a specified command themselves, and thus they enter the command into the chat.

The solution is /trigger for all cases; whatever the origin of the clickEvent doesn't matter.

Yes I understood that technicaly it's the same system, that's why it's the same errors messages 😉
But maybe the bug is here: a book is NOT the same think that the chat.

I remember some week ago when tomas (Minecraft PE developper) say that in Minecraft PE the item frame is a block, not an entity: because it's not normal that an entity is displayed like a block.

Here it's the same think, the bug is that a book is not a chat, so it's not normal that chat limitation limit book command. (And honestly I don't understand why there are this 100 char limitation for chat...). The server know the book, it know the player, Minecraft don't need client send the command to server through the chat system, it's a design problem that need a solution, it's a bug to fix.

And why the same command work in a command block and not in a book ? It's not consistent, technicaly it's possible. Maybe the solution is that book should work like a command block and not like the chat.

I already receive tens emails of users that have this problem (and I'm sure many other also have this problem without say it), so there are a real problem here that impact many peoples.

And if really your are right, if it's is a desire of mojang, if it's not the lazyness to solve the bug, so it's not normal to display a random error message:
"Invalid json" ??? what ? the json is valid !!!
"Data tag parsing failed: Unbalanced brackets" ??? There is no error with brackets !

A normal way should be to refuse the /give command because of the command too long (here the /give work, but the book is corrupted), or to display an error message like "Command too long", but any way, there are a bug with the book and run_command and I hope developers will not close this bug report without to solve a problem that affect so many users (and spam my mail box with messages like "your generator is bugged, there are bracket error" or "your generator create invalid json" :-/).

Tronics

(Unassigned)

Unconfirmed

Minecraft 1.8.9, Minecraft 16w05b, Minecraft 16w06a, Minecraft 16w07a, Minecraft 16w07b

Retrieved