In bedrock / edu edition you are able to use the hasitem
selectorhasitem
selector to select entites / players based on their items. However, it is a bit limited as it cannot select specifically named items, only types of items and their integer data (and at the time of writing that is also bugged).
So, for those things that you want to happen if they have it equipped / in their hand, you'll need to rely on using a different item instead of detecting its name.
Sidenote: For things like this I would recommend making an add-on, as it allows you to make your own custom items, but that is a lot more work and a lot more complicated than doing it ingame.
Here are two examples:
- detecting someone wearing an iron helmet:
@a[hasitem={item=iron_helmet,location=slot.armor.head}]
- detecting someone holding an amethyst shard in their offhand:
@a[hasitem={item=amethyst_shard,location=slot.weapon.offhand}]
Now with that you can either tag (/tag @a[...] add resistance
) someone or even apply the desired effects immediately (/effect @a[...] night_vision
).