I am trying to test if the player is holding a piece of paper named "Ticket" with a lorestring saying that the ticket is not punched. I have the following:
/testfor @p[r=10] {SelectedItemSlot:0,Inventory:[{Slot:0b,tag:{display:{Name:"Ticket",Lore:[This is a punched ticket.]}}]}
I can get it to work with just the Name but I can't get it to work with both the name and lore. How do I fix this?
Best Answer
You are missing a closing curly bracket for the item data:
However, I recommend using the
SelectedItem
compound tag instead of checking for each individual hotbar slot.SelectedItem
will contain a copy of the player's currently-held item (minus theSlot
tag), such that you do not need to have multiple command blocks for each slot: