As of 14w10c, this is possible using scoreboard values.
First, you need to set up a dummy scoreboard variable. I used "sneaky" as my variable, but you can really use whatever you want (as long as you change the commands as appropriate). To set this up, you just need to use the command /scoreboard objectives add sneaky dummy
. You only need to do this once.
I had to set up the command blocks in a very specific pattern for them to work, as shown:
I think this has something to do with how command blocks handle firing off "simultaneously". The comparator in this setup is in subtraction mode, creating a "comparator clock" which pulses very quickly.
The command blocks on the left are your scoreboard related commands. The one on the bottom left sets "sneaky" to 0 for all players:
/scoreboard players set @a sneaky 0
The command block on the top left sets "sneaky" to 1 for all players with the stealth boots equipped:
/scoreboard players set @a sneaky 1 {Inventory:[{Slot:100b,tag:{display:{Name:"Stealth Boots"}}}]}
The command blocks on the right are your effect commands. They give players the invisibility effect, or take it away, as appropriate. The one on the bottom clears the invisibility effect from all players without the stealth boots:
/effect @a[score_sneaky=0] 14 0 0
The top one gives the invisibility effect to all players with the stealth boots:
/effect @a[score_sneaky_min=1] 14 30000
What you are looking for looks something like this:
{Inventory:[{id:minecraft:written_book,tag:{pages:[0:"\"Test\""]}}]}
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.
Best Answer
We're going to use the fact that you are checking for boots to our advantage, since boots are not stackable and there can normally only be 0 or 1 item in that slot.
Set up a dummy scoreboard objective called
boots
and run the following two Commands on a setblock/fill clock.For example, you can use a setup like this one.
This will set the
boots
score to 1 for everyone having exactly one item in their foot inventory slots. From there, you can use@a[score_boots=0]
to detect barefoot players.A general answer for every inventory slot is more difficult, because checking for
Count:0b
does not work, since for the game, "no item" is different from "0 items of any kind".