Leukocyte
Leukocyte 是一个用于 Fabric 的简易世界保护模组,可选集成 player-roles。
Leukocyte 的世界保护基础是“权限组”(authority)。权限组负责对其范围内的玩家应用特定规则。每个权限组拥有唯一的名称、优先级(即“层级”,level)以及一组被排除的玩家列表。
创建权限组
要创建一个空的权限组,请运行:/protect add <name>。
或者,也可以在一个特定区域内创建权限组,例如:
/protect add <name> with universe(在全局范围内生效)/protect add <name> with <dimension>(在指定维度内生效)/protect add <name> with <min> <max>(在两个方块坐标之间的立方体范围内生效)
之后可以使用 /protect remove <name> 删除权限组。
设置规则
Leukocyte 提供了多种可在权限组内应用的规则。这些规则包括:
break控制玩家是否可以破坏方块place控制玩家是否可以放置方块block_drops控制破坏方块时是否掉落物品interact_blocks控制玩家是否可以与方块进行交互interact_entities控制玩家是否可以与实体进行交互interact控制对方块和实体的全局交互attack控制玩家是否可以攻击其他实体pvp控制玩家是否可以攻击其他玩家portals控制玩家是否可以建造传送门crafting控制玩家是否可以合成物品fall_damage控制玩家是否会受到坠落伤害hunger控制玩家是否会感到饥饿throw_items控制玩家是否可以从背包中投掷物品pickup_items控制玩家或其他实体是否可以拾取物品unstable_tnt控制 TNT 放置后是否自动点燃ignite_tnt控制是否可以点燃 TNTspawn_withers控制是否可以召唤凋灵fire_tick控制权限组内是否启用火焰蔓延(未设置时遵循游戏内规则 gamerule)fluid_flow控制液体是否会流动ice_melt控制冰和浮冰是否会融化
要在权限组上将某条规则设置为 allow(允许)或 deny(禁止),请使用 /protect set rule <authority> <rule> <result>。
例如:/protect set example place deny 将禁止在名为 example 的权限组内放置方块。
构建形状
通常,你可能希望保护一个形状不规则的区域,而不仅仅是一个简单的立方体。 为此,可以将多个简单形状组合成一个更复杂的形状,用于应用规则。
首先,运行:/protect shape start。这将开始构建形状。
接下来,要向此形状添加基本几何体,请运行:
/protect shape add universe将全宇宙范围加入此形状/protect shape add <dimension>将某个维度加入此形状/protect shape add <min> <max>将两个方块坐标之间的立方体加入此形状
可以多次运行这些命令以组合出你的目标形状。
完成形状组合后,你可以运行:/protect shape finish <name> to <authority>。
这会将具有给定名称的形状添加到指定的权限组中。
之后可以使用 /protect shape remove <name> from <authority> 移除该形状。
设置层级
当涉及多个权限组时,你可能希望其中一个拥有更高的优先级。 例如,你可能希望一个全局权限组禁止在所有地方进行破坏,除了特定的建造区域。
这时就需要用到层级(levels):层级只是一个数字,数值越高表示优先级越高,数值越低表示优先级越低。 假设有一个层级为 -1 的权限组,那么与其重叠且层级为 10 的另一个权限组将覆盖前者的规则。
可以通过以下命令设置权限组的层级:/protect set level <authority> <level>。
添加排除项
可能并不希望权限组的规则适用于所有人。 在这种情况下,可以排除特定的玩家或整个 角色,使其不受给定权限组的影响。
这可以通过运行以下命令实现:/protect exclusion add <authority> player <name> 或 /protect exclusion add <authority> role <name>。
之后还可以使用 /protect exclusion remove 移除这些排除项。
综合示例
上面讲了很多内容!让我们在一个简单的例子中把这些知识结合起来。
我们的示例服务器希望拥有全局的反破坏保护,但在生存维度和自由建造区域除外。 此外,我们还希望通过角色来排除某些玩家在自由建造区域的建造行为。
我们考虑两个维度:minecraft:overworld 和 example:survival,以及角色 builders。
首先,让我们创建一个名为 global 的权限组。由于我们主要希望在全局范围内获得保护,因此先全局应用保护,然后在特定区域具体覆盖它是合理的。
/protect add global with universe
接下来,我们可以在此权限组上设置规则:
/protect set rule global place deny/protect set rule global break deny
好了!现在,让我们在生存维度中覆盖这一行为。
/protect add survival with example:survival/protect set rule survival place allow/protect set rule survival break allow
但是等等……既然 global 也应用于生存维度,模组如何知道应用 global 还是 survival 的规则呢?
这里可以利用层级:权限组的默认层级为 0,值越大优先级越高。
因此,让我们将 global 权限组的层级设置为 -1,这样未来添加的任何内容默认都会覆盖它。
/protect set level global -1
现在我们可以类似地将我们的自由建造区域也添加为排除项了!假设我们有两个自由建造区域,分别创意地命名为 free_build_1 和 free_build_2。
首先,我们应该创建一个适用于这两个区域的空权限组(authority),因为它们遵循相同的规则:
/protect add free_build/protect set rule free_build place allow/protect set rule free_build break allow
接下来,让我们为 free_build_1 构建形状:
/protect shape start/protect shape add -10 0 -10 10 255 10
... 并将其添加到我们的权限组中/protect shape finish free_build_1 to free_build
然后对 free_build_2 重复相同操作:
/protect shape start/protect shape add -100 0 -10 90 255 10
... 并将其添加到我们的权限组中/protect shape finish free_build_2 to free_build
完成!现在这些自由建造区域应该允许任何玩家编辑——不过,我们希望创建排除项,以便我们可以将某些玩家“禁止”进入这些区域。
让我们通过一个名为 free_build_banned 的角色来实现这一点:
/protect exclusion add free_build role free_build_banned
这样一来,所有的保护设置就都配置好了!:)
测试!查询与检查规则
好的,我们已经设置了权限组,但如何轻松查看哪些规则已设置以及由谁设置的?
以下命令可能会派上用场:
/protect test: 测试指定位置适用的所有规则,并显示它们源自哪个权限组/protect list: 列出世界中的所有权限组/protect display <authority>: 显示给定权限组的规则和形状
Leukocyte
Leukocyte is a simple world protection mod for Fabric providing optional integration with player-roles.
The basis of world protection with leukocyte is an "authority". An authority is responsible for applying specific rules to players within it. An authority has a unique name, as well as a priority ("level"), and set of player exclusions.
creating authorities
To create an empty authority, run: /protect add <name>.
Alternatively, an authority can be created to apply within a specific area like:
/protect add <name> with universe(applies universally)/protect add <name> with <dimension>(applies within a specific dimension)/protect add <name> with <min> <max>(applies within a cuboid between two block coordinates)
An authority can be later removed with /protect remove <name>.
setting rules
Leukocyte provides various rules that can be applied within authorities. These rules are:
breakcontrols whether players can break blocksplacecontrols whether players can place blocksblock_dropscontrols whether blocks drop items when brokeninteract_blockscontrols whether players can interact with blocksinteract_entitiescontrols whether players can interact with entitiesinteractcontrols global interaction over blocks and entitiesattackcontrols whether players can attack other entitiespvpcontrols whether players can attack other playersportalscontrols whether players can construct portalscraftingcontrols whether players can craft itemsfall_damagecontrols whether players should receive fall damagehungercontrols whether players will become hungrythrow_itemscontrols whether players can throw items from their inventorypickup_itemscontrols whether items can be picked up by players or other entitiesunstable_tntcontrols tnt automatically igniting when placedignite_tntcontrols whether tnt can be ignitedspawn_witherscontrols whether withers can be summonedfire_tickcontrols whether fire tick is enabled within the authority. Defaults to gamerule if not setfluid_flowcontrols whether fluids flowice_meltcontrols whether ice and frosted ice melt
To set a rule as allow or deny on an authority, use /protect set rule <authority> <rule> <result>.
For example: /protect set example place deny will disallow block placement within the authority named example.
making shapes
Often, you may want to protect an area with a weird shape that is not just a simple box. To achieve this, it is possible to combine multiple simple shapes into a more complex one which will be used to apply rules.
To start, run: /protect shape start. This will begin the construction of a shape.
Next, to add primitives to this shape, run:
/protect shape add universeto add the universe into this shape/protect shape add <dimension>to add a dimension into this shape/protect shape add <min> <max>to add a cuboid between two block coordinates into this shape
These commands can be run multiple times to compose your shape.
Once you have finished composing a shape, you can run: /protect shape finish <name> to <authority>.
This will add a shape with the given name to the given authority.
This shape can be removed in the future with /protect shape remove <name> from <authority>.
setting levels
When dealing with multiple authorities, you may want one to take priority over another. For example, you may want a global authority to disallow griefing everywhere except specific areas for building.
This is where levels come in: a level is just any number, where a higher level indicates higher priority, and a lower level indicates lower priority. Given an authority with a level of -1, an overlapping authority with a level of 10 will override the rules of the first.
Levels can be set on an authority with: /protect set level <authority> <level>.
adding exclusions
It may not be desirable for the rules of an authority to apply to everyone. In this case, it is possible to exclude specific players, or entire roles from being affected by a given authority.
This is achieved through running: /protect exclusion add <authority> player <name> or /protect exclusion add <authority> role <name>.
These exclusions can additionally be later removed with /protect exclusion remove.
putting it together: an example
That was a lot of things! Let's put this knowledge together on a simple example.
Our example server will want to have global grief protection, except in our survival dimension and free-build areas. We additionally want to be able to exclude certain players from building in the free-build areas by use of a role.
Let's consider the two dimensions: minecraft:overworld and example:survival, as well as the role builders.
First, let's create an authority named global. Since we will mostly want protection everywhere, it makes sense to
globally apply protection and then specifically override this in specific areas.
/protect add global with universe
Next, we can set the rules on this authority:
/protect set rule global place deny/protect set rule global break deny
Done! Now, let's override this behavior in our survival dimension.
/protect add survival with example:survival/protect set rule survival place allow/protect set rule survival break allow
But wait..! How will the mod know to apply the rules of global or survival, since global also applies in the survival dimension?
Here, we can make use of levels: the default level for an authority is 0, and a larger value means higher priority.
So: let's set the level of our global authority to -1 such that anything we add in the future overrides it by default.
/protect set level global -1
Now we can similarly add our free build areas as exclusions too! Let's say we have two free build areas, creatively named free_build_1 and free_build_2.
First, we should create an empty authority that applies to both of them, since they both have the same rules.
/protect add free_build/protect set rule free_build place allow/protect set rule free_build break allow
Next, let's compose the shape for free_build_1:
/protect shape start/protect shape add -10 0 -10 10 255 10
... and add it to our authority/protect shape finish free_build_1 to free_build
And repeat the same for free_build_2:
/protect shape start/protect shape add -100 0 -10 90 255 10
... and add it to our authority/protect shape finish free_build_2 to free_build
Done! Now the free-build areas should be editable by any player- except, we want to create exclusions such that we can 'ban' players from the areas.
Let's do that with a free_build_banned role:
/protect exclusion add free_build role free_build_banned
With that, all our protection should be set up nicely! :)
testing! querying and checking rules
Okay, we've set up authorities, but how can we easily check which rules are set and by what?
A few commands may come in handy:
/protect test: tests all the rules that apply at a given location, and shows from which authority they originate/protect list: lists all authorities in the world/protect display <authority>: displays the rules and shape of the given authority
下载 Leukocyte
下载 Leukocyte
下载 Leukocyte
下载 Leukocyte
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Leukocyte
下载 Leukocyte
下载 Leukocyte
下载 Leukocyte
下载 Leukocyte
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Leukocyte
完整更新日志:
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
查看物品与配方
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
AE2:一款流行的自动化与存储模组
模组
那是什么?一个 Waila/Hwyla 的分支。
评论 0
登录后参与评分
还没有评论,来抢沙发吧