I want to have a testfor command that only teleports a player with a specific team and writable_book in their inventory, and in that book on the first page it reads: "Test".
I've tried dozens of commands but couldn't figure it out. Is this even possible?


What you are looking for looks something like this:


But the teleport command does not support NBT tags. However, there is a workaround using scoreboards.

First add a scoreboard objective:

/scoreboard objectives add HoldingBook dummy HoldingBook

Then run these 2 commands on a fast clock:

/scoreboard players set @a HoldingBook 2 {Inventory:[{id:minecraft:written_book,tag:{pages:[0:"\"Test\""]}}]}
/scoreboard players remove @a HoldingBook 1

Now, you can teleport the players holing a written book with the word "Test" on the first page, and for example on team blue;

/tp @a[score_holdingbook_min=1,team=blue] <your-coords>

Hope this helps.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.