mojira.dev
MC-103171

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

Attachments

Comments 22

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-73054 describe 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?

12 more comments

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"}

 

Piyotato

[Mod] turbo

(Unassigned)

Confirmed

Platform

Important

Commands

Minecraft 1.9.4, Minecraft 1.10 Pre-Release 1, Minecraft 1.10 Pre-Release 2, Minecraft 1.10.2, Minecraft 1.11.2, ..., 1.16.5, 1.19, 1.20.6, 1.21, 1.21.1

Retrieved