Hello folks there's a command in Minecraft 1.15.2
where can you find out if a player has an item in his hand?
who yes please write to me.
/ execute if entity @p [nbt = {SelectedItem: {id: "minecraft: diamond_sword"}}]
That checks e.g. Whether the next player holds a diamond sword and then issues a redstone signal.