What does this command do?

So I found this command:

execute at [@a] [nbt={SelectedItem:{tag:{kill:3}}}] run kill [@e] [distance=..3, nbt=!{SelectedItem:{tag:{kill:3}}}] 

But I don't know what it will do. What does it do?


Solution 1:

For everyone... (players only)

execute at [@a]

... who are holding (SelectedItem) an item with {tag:{kill:3}}

[nbt={SelectedItem:{tag:{kill:3}}}]

do...

run

/kill

kill

all entities

[@e]

that are within 3 blocks

[distance=..3

and not have an item in their hand with {tag:{kill:3}} in its data.

, nbt=!{SelectedItem:{tag:{kill:3}}}]