Selectors in written books require player to be operator to work
The bug
Usage of selectors in books don't work, unless the player being given the book is an operator. Basically, let's say you have such a command:
/give @a written_book[written_book_content={title:"Example",author:"someone",pages:['{"selector":"@s"}']}] 1
When the command block is powered, a player who is an operator will receive a book, which on its first page will have their IGN printed. A player who is NOT an operator will receive a book with an empty first page.
Linked Issues
is duplicated by5
Created Issue:
Selectors in written books requite player to be operator to work
Usage of selectors in books don't work, unless the player being given the book is an operator. Basically, let's say you have such a command (placed in a command block):
{{/give @a written_book 1 0 {pages:["[\"\",
{\"selector\":\"@p\"}]"],title:Book,author:Me}}}
When the command block is powered, a player who is an operator will receive a book, which on its first page will have his IGN printed.
A player who is NOT an operator will receive a book with an empty first page.
Selectors in written books requite player to be operator to workSelectors in written books require player to be operator to work
Usage of selectors in books don't work, unless the player being given the book is an operator. Basically, let's say you have such a command (placed in a command block):
{\"selector\":\"@p\"}
{{/give @a written_book 1 0 {pages:["[\"\",]"],title:Book,author:Me}
}}When the command block is powered, a player who is an operator will receive a book, which on its first page will have his IGN printed.
A player who is NOT an operator will receive a book with an empty first page.
Usage of selectors in books don't work, unless the player being given the book is an operator. Basically, let's say you have such a command (placed in a command block):
/give @a written_book 1 0 {pages:["[\"\",
{\"selector\":\"@p\"}]"],title:Book,author:Me}
When the command block is powered, a player who is an operator will receive a book, which on its first page will have his IGN printed.
A player who is NOT an operator will receive a book with an empty first page.
Usage of selectors in books don't work, unless the player being given the book is an operator. Basically, let's say you have such a command (placed in a command block):
/give @a written_book 1 0 {pages:["[\"\",{\"selector\":\"@p\"}]"],title:Book,author:Me}When the command block is powered, a player who is an operator will receive a book, which on its first page will have his IGN printed.
A player who is NOT an operator will receive a book with an empty first page.
relates to
relates to
relates to
Usage of selectors in books don't work, unless the player being given the book is an operator. Basically, let's say you have such a command
(placed in a command block):/give @a written_book1 0 {pages:["[\"\",{\"selector\":\"@p\"}]"],title:Book,author:Me}When the command block is powered, a player who is an operator will receive a book, which on its first page will have his IGN printed.
A player who is NOT an operator will receive a book with an empty first page.
The bug
Usage of selectors in books don't work, unless the player being given the book is an operator. Basically, let's say you have such a command:
/give @a minecraft:written_book{title:"Example",author:"someone",pages:["{\"selector\":\"@s\"}"]}When the command block is powered, a player who is an operator will receive a book, which on its first page will have their IGN printed. A player who is NOT an operator will receive a book with an empty first page.
is duplicated by
is duplicated by
is duplicated by
is duplicated by
relates to
is duplicated by
relates to
is duplicated by
is duplicated by
The bug
Usage of selectors in books don't work, unless the player being given the book is an operator. Basically, let's say you have such a command:
/give @aminecraft:written_book{title:"Example",author:"someone",pages:["{\"selector\":\"@s\"}"]}When the command block is powered, a player who is an operator will receive a book, which on its first page will have their IGN printed. A player who is NOT an operator will receive a book with an empty first page.
The bug
Usage of selectors in books don't work, unless the player being given the book is an operator. Basically, let's say you have such a command:
/give @a written_book[written_book_content={title:"Example",author:"someone",pages:['{"selector":"@s"}']}] 1When the command block is powered, a player who is an operator will receive a book, which on its first page will have their IGN printed. A player who is NOT an operator will receive a book with an empty first page.
Seems like we already have an older ticket about this, see MC-103171. Resolved as a duplicate.
(Older comment), so this is just selectors not working, right? Then I'm convinced this and MC-103171 are the same issue (non-OPs cannot resolve selectors in written books).Both score and selector tags do not work in books. However, with the score tag, If you use a UUID for the name it will work for non-ops as well.
Duplicate of MC-103171.

Yes. The player executes the command.
Can you please clarify what you mean by that?
What I'm saying is, in a situation where a non-operator player is given a book that makes use of selectors, they don't work. I don't believe this is an invalid report, would you kindly review it again?
The player executes the command. If the player does not have permissions to use selectors the command will not be executed properly. This is working by design. You can use /trigger to work around this limitation.
Having not read the description until now (sorry!), does
MC-73054describe your issue?No, the player does NOT execute the command. The command is executed by the command block. It is also not possible to use /trigger to work around this limitation. I want to display the player's NAME in the book.
In the case of a command
/give @r written_book 1 0 {pages:["[\"\",{\"selector\":\"@p\"}]"],title:Book,author:Me}, if the player randomly selected by @r is an OPERATOR, then it will display his name correctly on the first page. If the player randomly selected by @r is NOT an operator, then the first page will be blank.
No commands are run by any non-operator, this behaviour is just inconsistent and does not work. How does this work as intended?
Yes, I guess it does. Maybe you can merge the two threads? There are many ways this issue can be described and although both bug reports are reporting the same bug, the behaviour observed is different.
Does this affect 1.9.4?
Yes.
Still in 1.11, 1.11.1 and 1.11.2
Still affect all versions up to 18w03b, which is the latest snapshot as of this message.
This continues to be an issue with 1.13.1 official release, noted on Realm server.
Issue persists in 1.13 & 1.13.1 full releases.
Both in singleplayer without cheats enabled and on a server where the player is non-OP.
Book is resolved with raw JSON rather than being rendered correctly.
This is particularly frustrating because it worked correctly for me between 17w45a and 1.13-pre3 inclusive, during which time I was working on some datapacks for a server I was setting up. I never went live with that server at the time, and having come back to it now to discover it doesn't work even in 1.14.2-pre2 is a real downer.
Still an issue in 1.14.4; First page in a written book has a selector for player, and outputs the raw jsonstring on page 1 when resolved by a non-opped player. Other pages are unaffected, as long as they do not have the selector text in them.
Still an Issue
on my recent ticket about this same issue, i was informed by a Mod that it might be intended to do this.lol
As a datapack developer, this is a huge issue for me. For example, when a player joined a server for the first time, I wanted to provide a personalised book which was addressed to them (using @s). Instead, they were presented with a page of text. Similar I maintain a UHC datapack which (which is reasonably well used by the community), I tried to make use named armor stands to provide toggleable controls in a book. Awesome features were added in 1.14 to allow for selecting NBT from entities and using them in JSON text but I can't make use of them because of this bug.
Still in 1.15.2
Still in 1.16.5 :
typing :
/give @a minecraft:written_book{title:"Example",author:"someone",pages:["{\"selector\":\"@s\"}"]}The op user get a book with his name but non-op user get a bookt with text : {"selector":"@s"}
Still in 1.19
Still in 1.20.1
still in 1.21.1