player_enter.mcfunction 621 B

12345678910111213
  1. # 当玩家加入游戏时触发
  2. team join ltw @s
  3. advancement revoke @s everything
  4. execute as @a at @s run function lib:sounds/error
  5. # 存储UUID
  6. execute store result score @s UUID run data get entity @s UUID[0]
  7. # 如果是旁观者或局号不对头:开始旁观
  8. execute if entity @s[tag=watcher] run function ltw:main/player_enter_watcher
  9. execute if entity @s[tag=!watcher] unless score @s game_id = $ game_id run function ltw:main/player_enter_watcher
  10. # 如果不是旁观且局号正确:游戏中掉线
  11. execute if entity @s[tag=!watcher] if score @s game_id = $ game_id run function ltw:main/player_enter_rejoin