op: 데이터팩 출력을 실제 music_quiz zip 으로 교체

가이드 (mc_datapack/launcher_datapack_연동_가이드.txt) 에 따라:
- file/datapacks/music_quiz_template/ 에 mc_datapack 의 music_quiz/ 정적
  파일을 미리 동봉 (data/mq/function/init/songs.mcfunction 제외).
- src/server/datapack.ts: list.music → SNBT (`{title, author, alias}`)
  songs.mcfunction 빌더와 archiver 기반 zip 스트리머 추가.
- /op/datapack/:packName/generate 가 텍스트 placeholder 대신
  music_quiz_<key>.zip 을 Content-Disposition attachment 로 내려준다.
- datapack.ejs 의 코드블록·복사 UI 제거, 곡 수는 서버 렌더 시점에 표시.
- 더 이상 쓰이지 않는 locales 의 datapackOutput.* 키 제거, datapack
  버튼 라벨/상태 문구를 zip 다운로드용으로 정리.
This commit is contained in:
2026-05-13 16:34:34 +09:00
parent 2344c4b8d2
commit af884706d4
66 changed files with 871 additions and 72 deletions

View File

@@ -0,0 +1,7 @@
scoreboard objectives add func.temp dummy
$execute store result score n1 func.temp run data get storage func:temp $(n1)
$execute store result score n2 func.temp run data get storage func:temp $(n2)
execute if score n1 func.temp = n2 func.temp run return 1
return 0

View File

@@ -0,0 +1,15 @@
scoreboard players set two func.temp 2
$data modify storage func:temp half.result set from storage func:temp $(list)
execute store result score length func.temp run data get storage func:temp half.result
scoreboard players operation half func.temp = length func.temp
scoreboard players operation half func.temp /= two func.temp
scoreboard players operation odd func.temp = length func.temp
scoreboard players operation odd func.temp %= two func.temp
scoreboard players operation half func.temp += odd func.temp
function func:half/f1

View File

@@ -0,0 +1 @@
execute if score half func.temp < length func.temp run function func:half/f2

View File

@@ -0,0 +1,5 @@
data remove storage func:temp half.result[-1]
scoreboard players remove length func.temp 1
function func:half/f1

View File

@@ -0,0 +1,18 @@
$function func:length {text:"$(text)"}
# return length
function func:num_list with storage func:temp
# return num_list
function func:shuffle {list:"num_list"}
# return shuffle.result
function func:half {list:"shuffle.result"}
# return half.result
$function func:length {text:"$(text)"}
# return length
function func:text_list with storage func:temp
# return text_list
function func:join {list:"text_list"}
# return join.text
# tellraw @a {"storage":"func:temp","nbt":"join.text"}

View File

@@ -0,0 +1,2 @@
$execute if data storage func:temp {$(l1):{$(l2):[$(index)]}} run return 1
return 0

View File

@@ -0,0 +1,2 @@
$execute if data storage func:temp {space:{text:"$(space)"}} run return 1
return 0

View File

@@ -0,0 +1,4 @@
data modify storage func:temp join.text set value ""
$data modify storage func:temp join.list set from storage func:temp $(list)
function func:join/f1

View File

@@ -0,0 +1,8 @@
execute store result score length func.temp run data get storage func:temp join.list
execute if score length func.temp matches 0 run return 1
data modify storage func:temp join.now set from storage func:temp join.text
data modify storage func:temp join.next set from storage func:temp join.list[0]
function func:join/f2 with storage func:temp join

View File

@@ -0,0 +1,5 @@
$data modify storage func:temp join.text set value "$(now)$(next)"
data remove storage func:temp join.list[0]
function func:join/f1

View File

@@ -0,0 +1,5 @@
$data modify storage func:temp text set value "$(text)"
execute store result storage func:temp length int 1 run data get storage func:temp text
return run data get storage func:temp length

View File

@@ -0,0 +1,13 @@
data modify storage func:temp space.space set value " "
data modify storage func:temp zero set value 0
$data modify storage func:temp length set value $(length)
execute store result score result func.temp run function func:comp_num {n1:"zero",n2:"length"}
execute if score result func.temp matches 1 run tellraw @s {"text":"length는 1이상 이어야 합니다.","color":"red"}
execute if score result func.temp matches 1 run return 0
data modify storage func:temp num_list set value []
data modify storage func:temp index set value 0
data modify storage func:temp index_next set value 1
function func:num_list/f1 with storage func:temp

View File

@@ -0,0 +1,12 @@
$data modify storage func:temp space.text set string storage func:temp text $(index) $(index_next)
execute store result score result func.temp run function func:is_space with storage func:temp space
$execute if score result func.temp matches 0 run data modify storage func:temp num_list append value $(index)
function func:plus {name:"index",plus:1}
function func:plus {name:"index_next",plus:1}
execute store result score result func.temp run function func:comp_num {n1:"index",n2:"length"}
execute if score result func.temp matches 1 run return 1
function func:num_list/f1 with storage func:temp

View File

@@ -0,0 +1,7 @@
scoreboard objectives add func.temp dummy
$execute store result score temp func.temp run data get storage func:temp $(name)
$scoreboard players add temp func.temp $(plus)
$execute store result storage func:temp $(name) int 1 run scoreboard players get temp func.temp

View File

@@ -0,0 +1,9 @@
scoreboard objectives add func.temp dummy
data modify storage func:temp shuffle.result set value []
$data modify storage func:temp shuffle.list set from storage func:temp $(list)
execute store result score length func.temp run data get storage func:temp shuffle.list
function func:shuffle/f1

View File

@@ -0,0 +1,11 @@
execute store result score length func.temp run data get storage func:temp shuffle.list
execute if score length func.temp matches 0 run return 1
execute store result score random func.temp run random value 0..2147483646
scoreboard players operation random func.temp %= length func.temp
execute run function func:shuffle/f2 with storage func:temp {index:0}
execute store result storage func:temp shuffle.index int 1 run scoreboard players get random func.temp
function func:shuffle/f2 with storage func:temp shuffle

View File

@@ -0,0 +1,4 @@
$data modify storage func:temp shuffle.result append from storage func:temp shuffle.list[$(index)]
$data remove storage func:temp shuffle.list[$(index)]
function func:shuffle/f1

View File

@@ -0,0 +1,13 @@
data modify storage func:temp space.space set value " "
data modify storage func:temp zero set value 0
$data modify storage func:temp length set value $(length)
execute store result score result func.temp run function func:comp_num {n1:"zero",n2:"length"}
execute if score result func.temp matches 1 run tellraw @s {"text":"length는 1이상 이어야 합니다.","color":"red"}
execute if score result func.temp matches 1 run return 0
data modify storage func:temp text_list set value []
data modify storage func:temp index set value 0
data modify storage func:temp index_next set value 1
function func:text_list/f1 with storage func:temp

View File

@@ -0,0 +1,16 @@
$data modify storage func:temp space.text set string storage func:temp text $(index) $(index_next)
execute store result score result func.temp run function func:is_space with storage func:temp space
$execute store result score result2 func.temp run function func:is_index {l1:"half",l2:"result",index:$(index)}
execute if score result2 func.temp matches 0 if score result func.temp matches 0 run data modify storage func:temp text_list append value ""
execute if score result2 func.temp matches 0 if score result func.temp matches 1 run data modify storage func:temp text_list append from storage func:temp space.text
execute if score result2 func.temp matches 1 run data modify storage func:temp text_list append from storage func:temp space.text
function func:plus {name:"index",plus:1}
function func:plus {name:"index_next",plus:1}
execute store result score result func.temp run function func:comp_num {n1:"index",n2:"length"}
execute if score result func.temp matches 1 run return 1
function func:text_list/f1 with storage func:temp