player_enter.mcfunction 1.0 KB

123456789101112131415161718192021222324252627282930
  1. # 当玩家加入游戏时触发
  2. # 存储 UUID
  3. execute store result score @s UUID run data get entity @s UUID[0]
  4. # 初始化重生点
  5. spawnpoint @s -29 39 -78
  6. # 如果在主大厅
  7. execute if score $state mem matches 0 run function ltw:state/0/player_enter
  8. # TODO: 未完成的重构
  9. ## 如果是旁观者或局号不对头:开始旁观
  10. #execute if entity @s[team=!playing] run function ltw:main/player_enter_watcher
  11. #execute if entity @s[team=playing] unless score @s game_id = $ game_id run function ltw:main/player_enter_watcher
  12. ## 如果不是旁观且局号正确:游戏中掉线
  13. #execute if entity @s[team=playing] if score @s game_id = $ game_id run function ltw:main/player_enter_rejoin
  14. #execute as @a at @s run function lib:sounds/hit
  15. # 更新 Bossbar
  16. #bossbar set ltw:notice players @a
  17. #function lib:bossbar/show
  18. # 处理进度
  19. #advancement revoke @s only lib:damage_dealt
  20. #advancement revoke @s only lib:damage_taken
  21. #advancement revoke @s only item:special/consume_enchanted_apple
  22. #advancement revoke @s only item:special/consume_golden_apple