Minecraft Command is not working properly?

Ar
2

Execute at @a if block ~ ~ ~ minecraft: dropper {Items: [{Slot: 4b, id: "minecraft: stone", Count: 1b}]} if block ~ ~ ~ -1 minecraft: diamond_block if block ~ -1 ~ ~ minecraft: diamond_block if block ~ 1 ~ ~ minecraft: diamond_block if block ~ ~ ~ 1 minecraft: diamond_block run gamemode spectator @a

I wrote this command.

I wanted to use it in a datapack, but somehow it does not work.

Nothing happens.

un

Look at the command syntax of / execute…

Ar

But if I just execute at @a if block ~~~ minecraft: dropper {Items: [{Slot: 4b, id: "minecraft: stone", Count: 1b}]} run gamemode spectator @a

do, then it works