玩家自主圈地系统

Ganxiaozhe
2019/01/29

未经作者授权,禁止转载

介绍

本系统用于服务器或多人游戏中的玩家自主领地的情况,默认是16*16*16的领地范围(除去玩家最远可接触距离应为10*10*10)。使用金币圈地成功后,其他玩家无法进入你的领地范围,可通过好友系统实现领地共享。

此外,该领地支持删除,删除后退还37.5%的金币。



此外,为了防止玩家在服务器主城等建筑附近圈地,该系统提供了一定范围的禁圈区(1000格半径内),只需要在中心执行:

  1. summon minecraft:area_effect_cloud ~ ~1 ~ {PersistenceRequired:1b,Tags:["g-e-forever","g-land-mark-not-1000"],Duration:2147483647}

下列给出的指令已添加了好友系统的代码,只需配套好友系统即可实现领地权限共享。

内置的领地好友邀请我只做了 1.13+ 版本,如有需要可联系我。



关联

唯一UID分配[必需]
  1. icb:scoreboard objectives add uid dummy
  2. rcb:scoreboard players add @a uid 0
  3. ccb:execute @p[score_uid_min=0,score_uid=0] ~ ~ ~ scoreboard players add UIDStats uid 1
  4. ccb:execute @p[score_uid_min=0,score_uid=0] ~ ~ ~ scoreboard players operation @s uid = UIDStats uid
好友系统[非必需]

代码

初始化

  1. scoreboard objectives add getland trigger
  2. scoreboard objectives add land_confirm trigger
  3. scoreboard objectives add land_state dummy
  4. scoreboard objectives add landid dummy
  5. scoreboard objectives add taxLand dummy
  6. scoreboard objectives add land_temp dummy
  7. scoreboard objectives add land_pro dummy
  8. scoreboard objectives add money dummy

循环组

  1. scoreboard players add @a getland 0
  2. scoreboard players enable @a[score_getland_min=0,score_getland=0] getland
  3. tellraw @a[score_getland_min=1,score_getland=1] ["\u00a79\u00a7l[领地] \u00a7e您将花费 \u00a76\u00a7l2000金币 \u00a7e以当前位置为中心创建一个 \u00a76\u00a7l16*16*16 \u00a7e的领地,由于玩家最远可操作距离,实际保护大小为 \u00a76\u00a7l10*10*10\u00a7e。点击",{"text":" [确定] ","color":"green","bold":"true","clickEvent":{"action":"run_command","value":"/trigger land_confirm set 1"}},"\u00a7e以继续。"]
  4. scoreboard players set @a[score_getland_min=1,score_getland=1] land_state 1
  5. tellraw @a[score_getland_min=2,score_getland=2] ["\u00a79\u00a7l[领地] \u00a7e您将 \u00a7c\u00a7l删除 \u00a7e该位置的领地,获赔 \u00a76\u00a7l750金币 \u00a7e。点击",{"text":" [确定] ","color":"red","bold":"true","clickEvent":{"action":"run_command","value":"/trigger land_confirm set 1"}},"\u00a7e以继续。"]
  6. scoreboard players set @a[score_getland_min=2,score_getland=2] land_state 2
  7. scoreboard players enable @a[score_getland_min=1,score_getland=2] land_confirm
  8. scoreboard players set @a[score_getland_min=1] getland 0

  1. scoreboard players tag @a[score_land_state_min=1,score_land_state=1,score_land_confirm_min=1] add g-land-creating
  2. scoreboard players set @a[tag=g-land-creating] land_state 0
  3. scoreboard players set @a[tag=g-land-creating] land_confirm 0
  4. execute @e[type=area_effect_cloud,tag=g-land-mark-not-1000] ~ ~ ~ tellraw @a[tag=g-land-creating,r=1000] ["\u00a79\u00a7l[领地] \u00a7c\u00a7l创建中断,\u00a7c该位置附近不允许创建领地哦!"]
  5. execute @e[type=area_effect_cloud,tag=g-land-mark-not-1000] ~ ~ ~ scoreboard players tag @a[tag=g-land-creating,r=1000] remove g-land-creating
  6. execute @e[type=area_effect_cloud,tag=g-land-mark] ~ ~ ~ tellraw @a[tag=g-land-creating,r=32] ["\u00a79\u00a7l[领地] \u00a7c\u00a7l创建中断,\u00a7c该位置已经被别人占有了噢!"]
  7. execute @e[type=area_effect_cloud,tag=g-land-mark] ~ ~ ~ scoreboard players tag @a[tag=g-land-creating,r=32] remove g-land-creating
  8. scoreboard players add @a money 0
  9. execute @a[score_money=1999,tag=g-land-creating] ~ ~ ~ tellraw @s ["\u00a79\u00a7l[领地] \u00a7c\u00a7l创建中断,\u00a7c您的金币不足噢!"]
  10. scoreboard players tag @a[score_money=1999,tag=g-land-creating] remove g-land-creating
  11. scoreboard players remove @a[tag=g-land-creating] money 2000
  12. execute @a[tag=g-land-creating] ~ ~ ~ summon minecraft:area_effect_cloud ~ ~0.62 ~ {PersistenceRequired:1b,Tags:["g-e-forever","g-land-mark"],Duration:2147483647}
  13. scoreboard players add @e[type=area_effect_cloud,tag=g-land-mark] landid 0
  14. execute @e[type=area_effect_cloud,tag=g-land-mark,score_landid=0] ~ ~ ~ execute @p[tag=g-land-creating,r=6] ~ ~ ~ scoreboard players operation @e[type=area_effect_cloud,tag=g-land-mark,r=6,c=1] landid = @s uid
  15. tellraw @a[tag=g-land-creating] ["\u00a79\u00a7l[领地] \u00a7a\u00a7l创建成功!"]
  16. scoreboard players add @a[tag=g-land-creating] taxLand 1
  17. scoreboard players tag @a[tag=g-land-creating] remove g-land-creating
  18. scoreboard players set @a[score_land_state_min=2,score_land_state=2,score_land_confirm_min=1] land_pro 2
  19. scoreboard players set @a[score_land_pro_min=2,score_land_pro=2] land_state 0
  20. scoreboard players set @a[score_land_pro_min=2,score_land_pro=2] land_confirm 0
  21. scoreboard players tag @a[tag=status_inland] remove status_inland
  22. execute @e[type=area_effect_cloud,tag=g-land-mark] ~ ~ ~ scoreboard players tag @a[r=16] add status_inland
  23. tellraw @a[tag=!status_inland,score_land_pro_min=2,score_land_pro=2] ["\u00a79\u00a7l[领地] \u00a7c\u00a7l移除中断,\u00a7c该位置附近没有领地噢!"]
  24. scoreboard players set @a[tag=!status_inland,score_land_pro_min=2,score_land_pro=2] land_pro 0
  25. execute @a[score_land_pro_min=2,score_land_pro=2] ~ ~ ~ scoreboard players operation @s land_temp = @s uid
  26. execute @a[score_land_pro_min=2,score_land_pro=2] ~ ~ ~ scoreboard players operation @s land_temp -= @e[type=area_effect_cloud,tag=g-land-mark,r=16,c=1] landid
  27. scoreboard players tag @a[score_land_pro_min=2,score_land_pro=2] add landVer
  28. scoreboard players tag @a[score_land_pro_min=2,score_land_pro=2,score_land_temp_min=0,score_land_temp=0] remove landVer
  29. tellraw @a[tag=landVer,score_land_pro_min=2,score_land_pro=2] ["\u00a79\u00a7l[领地] \u00a7c\u00a7l移除中断,\u00a7c你不是该领地的拥有者!"]
  30. scoreboard players set @a[tag=landVer,score_land_pro_min=2,score_land_pro=2] land_pro 0
  31. execute @a[score_land_pro_min=2,score_land_pro=2] ~ ~ ~ kill @e[type=area_effect_cloud,tag=g-land-mark,r=16,c=1]
  32. scoreboard players add @a[score_land_pro_min=2,score_land_pro=2] money 750
  33. tellraw @a[score_land_pro_min=2,score_land_pro=2] ["\u00a79\u00a7l[领地] \u00a7a\u00a7l删除成功!"]
  34. scoreboard players remove @a[score_land_pro_min=2,score_land_pro=2] taxLand 1
  35. scoreboard players set @a[score_land_pro_min=2,score_land_pro=2] land_pro 0

下面的系统未加好友补丁,如需与好友系统连用请用后者。

  1. execute @e[type=area_effect_cloud,tag=g-land-mark] ~ ~ ~ particle instantSpell ~ ~ ~ 0.2 0.4 0.2 0.1 5 normal @a[r=20]
  2. scoreboard players tag @a[tag=g-land-ver-1] remove g-land-ver-1
  3. execute @e[type=area_effect_cloud,tag=g-land-mark,score_landid_min=1] ~ ~ ~ execute @a[r=16] ~ ~ ~ scoreboard players operation @s land_temp = @s uid
  4. execute @e[type=area_effect_cloud,tag=g-land-mark,score_landid_min=1] ~ ~ ~ execute @a[r=16] ~ ~ ~ scoreboard players operation @s land_temp -= @e[type=area_effect_cloud,tag=g-land-mark,r=16,c=1] landid
  5. scoreboard players tag @a[score_land_temp_min=0,score_land_temp=0] add g-land-ver-1
  6. execute @e[type=area_effect_cloud,tag=g-land-mark,score_landid_min=1] ~ ~ ~ title @a[tag=!g-land-ver-1,r=16] title ["\u00a79\u00a7l[ 领地保护 ]"]
  7. execute @e[type=area_effect_cloud,tag=g-land-mark,score_landid_min=1] ~ ~ ~ tp @a[tag=!g-land-ver-1,r=16] ~1 ~1 ~

添加了好友补丁的:

  1. execute @e[type=area_effect_cloud,tag=g-land-mark] ~ ~ ~ particle instantSpell ~ ~ ~ 0.2 0.4 0.2 0.1 5 normal @a[r=20]
  2. scoreboard players tag @a[tag=g-land-ver-1] remove g-land-ver-1
  3. execute @e[type=area_effect_cloud,tag=g-land-mark,score_landid_min=1] ~ ~ ~ execute @a[r=16] ~ ~ ~ scoreboard players operation @s land_temp = @s uid
  4. execute @e[type=area_effect_cloud,tag=g-land-mark,score_landid_min=1] ~ ~ ~ execute @a[r=16] ~ ~ ~ scoreboard players operation @s land_temp -= @e[type=area_effect_cloud,tag=g-land-mark,r=16,c=1] landid
  5. scoreboard players tag @a[score_land_temp_min=0,score_land_temp=0] add g-land-ver-1
  6. execute @e[type=area_effect_cloud,tag=g-land-mark] ~ ~ ~ scoreboard players operation @a[r=16] land_temp = @s landid
  7. execute @a[score_land_temp_min=1] ~ ~ ~ scoreboard players operation @s land_temp -= @s friLS1
  8. scoreboard players tag @a[score_land_temp_min=0,score_land_temp=0] add g-land-ver-1
  9. execute @e[type=area_effect_cloud,tag=g-land-mark] ~ ~ ~ scoreboard players operation @a[r=16] land_temp = @s landid
  10. execute @a[score_land_temp_min=1] ~ ~ ~ scoreboard players operation @s land_temp -= @s friLS2
  11. scoreboard players tag @a[score_land_temp_min=0,score_land_temp=0] add g-land-ver-1
  12. execute @e[type=area_effect_cloud,tag=g-land-mark] ~ ~ ~ scoreboard players operation @a[r=16] land_temp = @s landid
  13. execute @a[score_land_temp_min=1] ~ ~ ~ scoreboard players operation @s land_temp -= @s friLS3
  14. scoreboard players tag @a[score_land_temp_min=0,score_land_temp=0] add g-land-ver-1
  15. execute @e[type=area_effect_cloud,tag=g-land-mark] ~ ~ ~ scoreboard players operation @a[r=16] land_temp = @s landid
  16. execute @a[score_land_temp_min=1] ~ ~ ~ scoreboard players operation @s land_temp -= @s friLS4
  17. scoreboard players tag @a[score_land_temp_min=0,score_land_temp=0] add g-land-ver-1
  18. execute @e[type=area_effect_cloud,tag=g-land-mark] ~ ~ ~ scoreboard players operation @a[r=16] land_temp = @s landid
  19. execute @a[score_land_temp_min=1] ~ ~ ~ scoreboard players operation @s land_temp -= @s friLS5
  20. scoreboard players tag @a[score_land_temp_min=0,score_land_temp=0] add g-land-ver-1
  21. execute @e[type=area_effect_cloud,tag=g-land-mark] ~ ~ ~ scoreboard players operation @a[r=16] land_temp = @s landid
  22. execute @a[score_land_temp_min=1] ~ ~ ~ scoreboard players operation @s land_temp -= @s friLS6
  23. scoreboard players tag @a[score_land_temp_min=0,score_land_temp=0] add g-land-ver-1
  24. execute @e[type=area_effect_cloud,tag=g-land-mark,score_landid_min=1] ~ ~ ~ title @a[tag=!g-land-ver-1,r=16] title ["\u00a79\u00a7l[ 领地保护 ]"]
  25. execute @e[type=area_effect_cloud,tag=g-land-mark,score_landid_min=1] ~ ~ ~ tp @a[tag=!g-land-ver-1,r=16] ~1 ~1 ~

下载 territory.mcfunction


请在使用时尽量保留系统出处,算是对我成果的支持,谢谢!

未经作者授权,禁止转载





LOADING | 此框架正在加载中
QQ群:771363745