advancement revoke @s only snapgrave:is_claiming

execute as @n[type=interaction,tag=sgrave,tag=sgrave.interaction,nbt={attack:{}}] at @s if data entity @s attack store result score #grave.pid sgrave run data get entity @n[type=marker,tag=sgrave,tag=sgrave.marker] data.pid
execute as @n[type=interaction,tag=sgrave,tag=sgrave.interaction,nbt={interaction:{}}] at @s if data entity @s interaction store result score #grave.pid sgrave run data get entity @n[type=marker,tag=sgrave,tag=sgrave.marker] data.pid

execute as @n[type=interaction,tag=sgrave,tag=sgrave.interaction,nbt={attack:{}}] at @s if data entity @s attack store result storage sgrave:temp gid int 1 run scoreboard players get @s sgrave
execute as @n[type=interaction,tag=sgrave,tag=sgrave.interaction,nbt={interaction:{}}] at @s if data entity @s interaction store result storage sgrave:temp gid int 1 run scoreboard players get @s sgrave

execute at @s unless score #grave.pid sgrave = @s playerID run playsound entity.villager.no master @s ~ ~ ~ 0.2 1

advancement revoke @s only snapgrave:is_claiming
execute unless score #grave.pid sgrave = @s playerID run return run function snapgrave:response/not_owner

execute as @n[type=marker,tag=sgrave,tag=sgrave.marker] at @s run playsound minecraft:particle.soul_escape master @p[distance=..5] ~ ~ ~ 1 1
execute as @n[type=marker,tag=sgrave,tag=sgrave.marker] at @s run particle minecraft:soul ~ ~0.2 ~ 0.2 0.2 0.2 0.1 10 normal

function snapgrave:response/run with storage sgrave:temp
#execute if score #grave.pid sgrave = @s playerID as @n[type=marker,tag=sgrave,tag=sgrave.marker] at @s run function snapgrave:response/retrieve/run