I have a question about Minecraft. How does the command work, which automatically "kills" all arrows, ie disappears after they have been in the air for "x" seconds.
The following two commands must be executed every tick.
/ execute as @e [type = arrow] run scoreboard players add @s killarrow 1
/ execute as @e [type = arrow, scores = {killarrow = 100.}] run kill @s
This command only needs to be executed once at the beginning:
/ scoreboard objectives add killarrow dummy
The 100 in the second command represents the time in ticks (1 second = 20 ticks).