execute as @a[predicate=survivalplus:tomes/grave] run tag @s add gravetome
#execute as @a[tag=gravetome,scores={usetome=1..},tag=usedgrave] run tellraw @s {"text": "Can only be used ONCE per death!","color": "red"}
#execute as @a[tag=gravetome,scores={usetome=1..},tag=usedgrave] run tellraw @s {"text": "Tome refunded","color": "gray","italic": true}
#execute as @a[tag=gravetome,scores={usetome=1..},tag=usedgrave] run give @s knowledge_book{gravetome:tag,Recipes:[stick],display:{Name:'[{"text":"Grave Tome","italic":false}]',Lore:['[{"text":"Teleport to your last death point","italic":false,"color":"gray"}]','[{"text":"Can only be used once per death","italic":false,"color":"red"}]']},Enchantments:[{}]}
execute as @a[tag=gravetome,tag=!usedgrave] if data entity @s {LastDeathLocation:{dimension:"minecraft:overworld"}} run title @s actionbar {"text": "You last died in: Overworld"}
execute as @a[tag=gravetome,tag=!usedgrave] if data entity @s {LastDeathLocation:{dimension:"minecraft:the_nether"}} run title @s actionbar {"text": "You last died in: The Nether"}
execute as @a[tag=gravetome,tag=!usedgrave] if data entity @s {LastDeathLocation:{dimension:"minecraft:the_end"}} run title @s actionbar {"text": "You last died in: The End"}
execute as @a[tag=gravetome,tag=!usedgrave] if data entity @s {LastDeathLocation:{dimension:"survivalplus:final_destination"}} run title @s actionbar [{"text": "You last died in: "},{"text":"Uknown Dimension"}]
execute as @a[tag=gravetome,tag=!usedgrave] if data entity @s {LastDeathLocation:{dimension:"survivalplus:backrooms"}} run title @s actionbar ["You last died in: ",{"text":"Backrooms","obfuscated":true}]
execute as @a[tag=gravetome,tag=usedgrave] run title @s actionbar {"text": "You've used a Grave Tome recently!","color": "red"}
execute as @a[tag=gravetome,scores={usetome=1..},tag=!usedgrave] at @s run function survivalplus:tools/tomes/grave
execute as @a[scores={usetome=1..}] run scoreboard players reset @s usetome