player_enter.mcfunction 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # 对单个玩家的处理(如果玩家中途加入就会执行此函数)
  2. function lib:sounds/music/hub
  3. title @s clear
  4. title @s actionbar ""
  5. # 重置玩家血量上限
  6. attribute @s generic.max_health base set 20
  7. # 重置经验值
  8. xp set @s 0 points
  9. xp set @s 0 levels
  10. # 开启触发器
  11. scoreboard players enable @s buy_trigger
  12. # 状态效果
  13. effect clear @s
  14. effect give @s saturation 1000000 0 true
  15. gamerule naturalRegeneration true
  16. effect give @s resistance 1000000 4 true
  17. # 冒险模式
  18. gamemode adventure @s[tag=!debug]
  19. # 传送玩家
  20. tp @s[tag=!debug] -10 8 -42 68 -20
  21. # 返还金粒
  22. scoreboard players operation @s[tag=!gold_return] gold = @s gold_total
  23. tellraw @s[tag=!gold_return] ["",{"text":">> ","color":"aqua","bold": true},{"text":"由于商店更新, 你的已有购买已重置, 花费的金粒已返还!","color":"aqua"}]
  24. tellraw @s[tag=!gold_return] ["",{"text":">> ","color":"aqua","bold": true},{"text":"由于商店更新, 你的已有购买已重置, 花费的金粒已返还!","color":"aqua"}]
  25. tellraw @s[tag=!gold_return] ["",{"text":">> ","color":"aqua","bold": true},{"text":"由于商店更新, 你的已有购买已重置, 花费的金粒已返还!","color":"aqua"}]
  26. tag @s add gold_return
  27. # 刷新物品
  28. clear @s[tag=!debug]
  29. function item:shop/refresh_gold