
$execute store result score @s sgrave run data get storage sgrave:graves _$(pid)

execute store result score #graveLimit sgrave run data get storage sgrave:settings graveLimit

execute if score @s sgrave = #graveLimit sgrave run return run function snapgrave:grave_count/exceed

scoreboard players operation #graveLimit sgrave -= #constant.1 sgrave

execute if score @s sgrave = #graveLimit sgrave run tellraw @s {text:"You have reached the Grave limit. Please loot or delete at least one grave before your next death; otherwise, the oldest grave will be overwritten.",color:"red"}

execute at @s run playsound block.note_block.pling master @s ~ ~ ~ 0.2 1