Files
mc_datapack/music_quiz/data/mq/function/repeat/triggers/handler.mcfunction

40 lines
2.1 KiB
MCFunction

execute if score init main matches 0..1 run scoreboard players enable @a ready
execute if score init main matches 0..1 as @a if score @s ready matches 1 run function mq:tellraw {"text":"","color":"black",msg:[{"selector":"@s","color": "yellow","bold": true},{"text":" : ","color":"gray"},{"text":"준비완료","color":"white"}]}
execute if score init main matches 0..1 as @a if score @s ready matches 1 run scoreboard players set @s ready 2
execute if score init main matches 0..1 as @a if score @s ready matches 3 run function mq:tellraw {"text":"","color":"black",msg:[{"selector":"@s","color": "yellow","bold": true},{"text":" : ","color":"gray"},{"text":"이미 준비완료 상태입니다.","color": "red"}]}
execute if score init main matches 0..1 as @a if score @s ready matches 3 run scoreboard players set @s ready 2
execute if score init main matches 0..1 run scoreboard players enable @a cancel
execute if score init main matches 0..1 as @a if score @s cancel matches 1 run function mq:tellraw {"text":"","color":"black",msg:[{"selector":"@s","color": "yellow","bold": true},{"text":" : ","color":"gray"},{"text":"취소를 선택하셨습니다.","color": "red"}]}
execute if score init main matches 0..1 as @a if score @s cancel matches 1 run function mq:commands/stop with storage mq:main
execute if score init main matches 0..1 store result score max_player ready if entity @a
execute if score init main matches 0..1 store result score ready_player ready if entity @a[scores={ready=2..}]
execute if score init main matches 0..1 \
unless score max_player ready matches 0 \
if score max_player ready = ready_player ready \
run function mq:quiz/start with storage mq:main
function mq:repeat/triggers/trigger { \
n:"stop", \
n2:"", \
c:"function mq:commands/stop with storage mq:main" \
}
function mq:repeat/triggers/trigger { \
n:"skip", \
n2:"", \
c:"function mq:commands/skip" \
}
function mq:repeat/triggers/trigger { \
n:"hint", \
n2:"", \
c:"function mq:commands/hint" \
}
function mq:repeat/triggers/trigger { \
n:"replay", \
n2:"", \
c:"function mq:commands/replay" \
}