Dropper, test for diamond [duplicate]
Solution 1:
Assume they don't have diamond at first by adding a tag by default:
/scoreboard players tag @a add d
If they do have a diamond, remove the tag:
/scoreboard players tag @a remove d {Inventory:[{id:minecraft:diamond}]}
Give players that have the "d" tag a diamond:
/give @a[tag=d] diamond
Solution 2:
This can be done in just one command in Minecraft 1.13
/give @a[nbt=!{Inventory:[{id:"minecraft:diamond"}]}] diamond
Solution 3:
You can run a clear command and then give them the diamond
/clear @p minecraft:diamond 1 0
Then.../give @p minecraft:diamond 1 0 {display:{Name:"Optional Name"}}