player_enter.mcfunction 823 B

12345678910111213141516
  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 UUID1 run data get entity @s UUID[0]
  7. execute store result score @s UUID2 run data get entity @s UUID[1]
  8. execute store result score @s UUID3 run data get entity @s UUID[2]
  9. execute store result score @s UUID4 run data get entity @s UUID[3]
  10. # 如果是旁观者或局号不对头:开始旁观
  11. execute if entity @s[tag=watcher] run function ltw:main/player_enter_watcher
  12. execute if entity @s[tag=!watcher] unless score @s game_id = $ game_id run function ltw:main/player_enter_watcher
  13. # 如果不是旁观且局号正确:游戏中掉线
  14. execute if entity @s[tag=!watcher] if score @s game_id = $ game_id run function ltw:main/player_enter_rejoin