execute at @s unless block ~ ~ ~ air align xz positioned ~0.5 ~0.5 ~0.5 run spawnpoint @s ~ ~ ~
execute at @s if block ~ ~ ~ air align xz positioned ~0.5 ~ ~0.5 run spawnpoint @s ~ ~ ~

execute store result score @s checkpointlevel run data get block ~ 255 ~ Items[0].tag.CheckpointNumber

execute unless score @s level = @s checkpointlevel if score @s checkpointlevel matches 100 run tellraw @a [{"selector":"@s","color":"gold","bold":"true"},{"text":" finished the map","color":"yellow"}]
execute unless score @s level = @s checkpointlevel if score @s checkpointlevel matches 100 run title @s title [{"text":"Congratulations","color":"yellow","bold":"true"}]
execute unless score @s level = @s checkpointlevel if score @s checkpointlevel matches 100 run title @s subtitle [{"text":"You finished the map!","color":"yellow","bold":"true"}]

execute unless score @s level = @s checkpointlevel if score @s checkpointlevel matches 100 run tellraw @s {"text":"Please rate the map: ","italic":"true","bold":"true"} 


execute unless score @s level = @s checkpointlevel if score @s checkpointlevel matches 100 run tellraw @s ["",{"text":"S ","color":"blue","clickEvent":{"action":"run_command","value":"/tellraw @a {\"text\":\"We are glad that you liked this map very much!\",\"color\":\"gold\"}"}},{"text":"A ","color":"blue","clickEvent":{"action":"run_command","value":"/tellraw @a {\"text\":\"We are glad that you liked this map!\",\"color\":\"gold\"}"}},{"text":"B ","color":"blue","clickEvent":{"action":"run_command","value":"/tellraw @a {\"text\":\"Thanks for your feedback!\",\"color\":\"gold\"}"}},{"text":"C ","color":"blue","clickEvent":{"action":"run_command","value":"/tellraw @a {\"text\":\"Thanks for your feedback!\",\"color\":\"gold\"}"}},{"text":"D ","color":"blue","clickEvent":{"action":"run_command","value":"/tellraw @a {\"text\":\"Thanks for your feedback!\",\"color\":\"gold\"}"}}]

execute unless score @s level = @s checkpointlevel if score @s checkpointlevel matches 100 run tellraw @s {"text":"Your Time:","color":"aqua","bold":"true"}
execute unless score @s level = @s checkpointlevel if score @s checkpointlevel matches 100 run function ps:print_player_time



execute store result score @s level run data get block ~ 255 ~ Items[0].tag.CheckpointNumber



