#built using mc-build (https://mcbuild.dev/)

function main:clearschedule
summon armor_stand 4 35 -8 {CustomNameVisible:1b,NoGravity:1b,Silent:1b,Invulnerable:1b,Marker:1b,Invisible:1b,CustomName:'{"text":"Set Difficulty","color":"black","bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}',Tags:["holo"]}
summon armor_stand -4 35 -8 {CustomNameVisible:1b,NoGravity:1b,Silent:1b,Invulnerable:1b,Marker:1b,Invisible:1b,CustomName:'{"text":"Set Points","color":"black","bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}',Tags:["holo"]}
tag @a remove processed
scoreboard objectives remove queue
scoreboard objectives add queue
scoreboard players set $order queue 0
scoreboard players set $constant queue 0
scoreboard players set $constant PlayerCount 0
scoreboard objectives remove points
scoreboard players set $round round 0
scoreboard players set @a played 0
scoreboard objectives add points dummy
setblock 8 0 8 minecraft:structure_block
data modify block 8 0 8 mode set value "LOAD"
data modify block 8 0 8 name set value "minecraft:empty2"
data modify block 8 0 8 posX set value -14
data modify block 8 0 8 posY set value 3
data modify block 8 0 8 posZ set value -10
setblock 9 0 8 minecraft:redstone_block
setblock 9 0 8 minecraft:stone
setblock 8 4 2 minecraft:structure_block
data modify block 8 4 2 mode set value "LOAD"
data modify block 8 4 2 name set value "minecraft:clear"
data modify block 8 4 2 posX set value -5
data modify block 8 4 2 posY set value 2
data modify block 8 4 2 posZ set value -3
fill 3 6 17 13 11 11 air
setblock 8 3 2 minecraft:redstone_block
setblock 8 16 14 minecraft:structure_block
data modify block 8 16 14 mode set value "LOAD"
data modify block 8 16 14 name set value "minecraft:build1"
data modify block 8 16 14 posX set value -5
data modify block 8 16 14 posY set value 2
data modify block 8 16 14 posZ set value -3
data modify block 8 16 14 mirror set value "LEFT_RIGHT"
setblock 8 17 14 minecraft:redstone_block
schedule function main:redstone 1s
clear @a
scoreboard players reset @a wins
scoreboard objectives remove wins
scoreboard objectives add wins dummy {"text":"Points!","color":"gold"}
scoreboard objectives setdisplay sidebar
scoreboard players set $round round 0
bossbar set minecraft:time value 10
tag @a remove ingame
tag @a remove inround
tag @a remove win
tag @a remove sep
scoreboard players set $max points 5
scoreboard objectives remove jtimer
scoreboard objectives remove jump
scoreboard objectives remove sneak
scoreboard objectives add jump minecraft.custom:minecraft.jump
scoreboard objectives add sneak minecraft.custom:minecraft.sneak_time
scoreboard objectives add jtimer dummy
scoreboard players set $difficulty ip 2
scoreboard players set $progress ip 0
scoreboard players set $confirm ip 0
scoreboard players set random build 0
scoreboard objectives remove id
scoreboard objectives add id dummy
scoreboard players set #ready ready 0
tag @a remove ready
data merge block -4 34 -8 {Text1:'{"text":""}',Text2:'{"text":"Points To Win","bold":true,"color":"#FEFFB6"}',Text3:'{"score":{"name":"$max","objective":"points"},"bold":true,"color":"#ACF8F5"}'}