How can I detect an item with a specific name in a player's hand (Minecraft 1.14.4)?

el
2

I would like that if you pick up a certain item with a custom name, something happens (to be precise, that it can move faster (even in the air)), so that I can get an "admin advantage".

I've tried so far but it doesn't want to work… -> execute as @a [nbt = {SelectedItem: {id: "minecraft: barrier"}, nbt = {display: {name: "{\" text \ ": \" Speedo \ "}"}}}] run [The command to be executed]

How can I do it differently or have I misspelled / done something?

Be

You made a few small mistakes. This is how the command works:

/ execute as @a [nbt = {SelectedItem: {id: "minecraft: barrier", Count: 1b, tag: {display: {Name: '{"text": "Speedo"}'}}}}] run

The easiest way to do this is with the https://mcstacker.net/ online editor. There then with execute if entity

el

Thank you very much.

You really helped me.