I'm Korean, so I don't know English very well, but I'm asking because I think you guys know best about skript yaml.
The text of the script has some Korean. But I think it's understandable because everything important is in English. I'm sorry.
# /setstats 명령어: 타수와 안타를 설정하고 타율을 계산하여 저장
command /setstats <player> <number> <number>: # 예시: /setstats Andrew_OwO 10 3
trigger:
# 플레이어 통계 저장
set {player.%arg-1%.at_bats} to arg-2
set {player.%arg-1%.hits} to arg-3
set {player.%arg-1%.batting_avg} to (arg-3 / arg-2)
send "&a%arg-1%'s stats set! 타수: %{arg-2}%, 안타: %{arg-3}%, 타율: %{player.%arg-1%.batting_avg}%"
command /savestats <player>:
trigger:
set {_at_bats} to {player.%arg-1%.at_bats}
set {_hits} to {player.%arg-1%.hits}
set {_batting_avg} to {player.%arg-1%.batting_avg}
# 저장할 경로와 키 확인
set yaml value "players.%arg-1%.at_bats" in "plugins/YamlAPI/player_stats.yml" to {_at_bats}
set yaml value "players.%arg-1%.hits" in "plugins/YamlAPI/player_stats.yml" to {_hits}
set yaml value "players.%arg-1%.batting_avg" in "plugins/YamlAPI/player_stats.yml" to {_batting_avg}
save yaml "plugins/YamlAPI/player_stats.yml"
send "&a%arg-1%'s stats have been saved to player_stats.yml!"
# /loadstats 명령어: player_stats.yml에서 통계 불러오기
command /loadstats <player>:
trigger:
# 플레이어 통계 로드
set {_player} to arg-1
# YAML 파일에서 데이터 로드
set {_at_bats} to yaml value "players.%arg-1%.at_bats" from "plugins/YamlAPI/player_stats.yml"
set {_hits} to yaml value "players.%arg-1%.hits" from "plugins/YamlAPI/player_stats.yml"
set {_batting_avg} to yaml value "players.%arg-1%.batting_avg" from "plugins/YamlAPI/player_stats.yml"
send "&a%arg-1%'s stats loaded: 타수: %{_at_bats}%, 안타: %{_hits}%, 타율: %{_batting_avg}%"