#no comments for now, this is just a buncha command blocks copied here for easier access

data merge block ~ ~ ~ {auto:0b}
execute at @e[name=DayQ] run summon minecraft:armor_stand ~ 240 ~ {CustomName:"\"SaveInvKyu\"",NoGravity:1,Invisible:1,Invulnerable:1}
function zzzzdonotuse:fix/saveinvandcoordsstart
effect give @a[tag=PlayerAddKyu] minecraft:instant_health 5 5
effect give @a[tag=PlayerAddKyu] minecraft:saturation 5 50
give @a[tag=PlayerAddKyu] minecraft:carrot
team join P @a[tag=PlayerAddKyu]
tag @a[tag=PlayerAddKyu] add K
tp @a[tag=PlayerAddKyu] @e[sort=random,type=player,limit=1,tag=PlayerAddKyu]
effect give @a[tag=PlayerAddKyu] minecraft:resistance 15 5
execute if entity @e[name=DayQ,scores={TPKyu=0..1}] run execute at @a[tag=PlayerAddKyu,sort=random,limit=1] run spreadplayers ~ ~ 1000 5000 false @a[tag=PlayerAddKyu]
tag @a[tag=PlayerAddKyu] add JoinedKyu
function zzzzdonotuse:spell/startbook
execute if entity @e[name=DayQ,scores={TPKyu=2}] run tp @a[tag=PlayerAddKyu] @a[sort=random,limit=1,tag=TPNewPlayerToMe]
execute unless entity @e[name=DayQ,scores={TPKyu=2..3}] run tp @a[tag=PlayerAddKyu] @e[sort=random,type=player,limit=1,tag=PlayerAddKyu]
tag @a remove PlayerAddKyu
execute at @e[name=DayQ,type=minecraft:armor_stand] run fill ~-10 ~-10 ~-10 ~10 ~10 ~10 minecraft:daylight_detector replace barrier