The repeating command block gives me a new bow when I try to shoot. How to fix that?

Solution 1:

The problem is that the bow is being replaced every tick.

Instead of constantly replacing their first hotbar slot, simply give them a bow if they are missing one.

Instead of the nearest player, we're going to run this as all players for multiplayer support.

/execute as @a...

First, we need to check if the player has the bow in their inventory:

...unless entity @p[nbt={Inventory:[{id:"minecraft:bow", tag:{INSERT NBT}}]}]...

Then give them the bow.

...run give @p minecraft:bow{INSERT NBT} 1

Combine the three lines like this:

/execute as @a unless entity @s[nbt={Inventory:[{id:"minecraft:bow", tag:{INSERT NBT}}]}] run give @s minecraft:bow{INSERT NBT}]} 1

This will give every player a Bow of Shadows, if they do not already have a matching bow in their inventory. (replace "INSERT NBT" with the bow's display and enchantment data.)

Hope it helps!