介绍
原版权限
此模组在原版中加入了权限检查,以实现完全的权限自定义。
- 你需要安装一个权限模组。(例如 LuckPerms)
(任何支持 fabric-permissions-api 的权限提供模组也同样支持。)
权限
| 权限 | 描述 |
|---|---|
minecraft.adminbroadcast.receive |
接收命令反馈 |
minecraft.bypass.spawn-protection |
在出生点保护范围内建造 |
minecraft.bypass.force-gamemode |
绕过强制游戏模式 |
minecraft.bypass.move-speed.player |
绕过“玩家移动过快” |
minecraft.bypass.move-speed.vehicle.<entity> |
骑乘 entity(例如 minecraft.boat)时绕过“玩家移动过快” |
minecraft.bypass.chat-speed |
过快发送消息/命令时绕过聊天踢出 |
minecraft.bypass.whitelist |
绕过服务器白名单 |
minecraft.bypass.player-limit |
绕过服务器玩家上限 |
minecraft.command.<command> |
命令权限,更多信息请参见命令 |
minecraft.debug_stick.use.<block> |
对 block(例如 minecraft.oak_trapdoor)使用调试棒 |
minecraft.debug_chart |
查看调试图表 |
minecraft.<query/load>.<entity/block> |
放置带有 nbt 数据的方块并使用调试命令 |
minecraft.operator_block.<command_block/jigsaw/structure_block>.<place/view/edit/break> |
放置、查看、编辑和破坏管理员方块。 |
minecraft.selector |
在命令中使用实体选择器 |
minecraft.selector.entity.<selector> |
允许使用 selector 选择非玩家实体 |
minecraft.selector.player.<selector> |
允许使用 selector 选择非自身玩家 |
minecraft.selector.self.<selector> |
允许使用 selector 选择自身 |
元数据
有时也被称为“选项”或“变量”。
类型不正确将被视为未定义值。
| 元数据 | 类型 | 描述 |
|---|---|---|
minecraft.selector.limit.<selector> |
Integer |
限制使用 selector 可选择的实体最大数量 |
minecraft.selector.weight.<selector> |
Integer |
选择器权重,更多信息请参见选择权重 |
命令
此模组使用 Brigadier 基于节点的权限系统。每条命令由多个节点组成,每个节点都有自己的权限。
例如,/gamemode 命令:
- 根命令节点(
/gamemode)需要 minecraft.command.gamemode 权限。 survival、creative等子节点使用minecraft.command.gamemode.survival、minecraft.command.gamemode.creative等权限。
在原版 Minecraft 中,只有根节点会进行权限检查(例如,OP 等级 2)。玩家一旦获得访问该根节点的权限,默认即可使用所有子节点。
如果你需要更精细的控制,可以手动拒绝特定子节点的权限。
示例
Allow:
minecraft.command.gamemode
Deny:
minecraft.command.gamemode.creative
minecraft.command.gamemode.spectator
这样玩家可以使用 /gamemode,但只能使用获准的子选项(例如,生存模式和冒险模式)。
其他命令的用法,请参阅 Minecraft Wiki 对应命令页面中的语法部分。
选择器
命令方块和数据包会绕过所有选择器权限检查。
默认情况下,授予 minecraft.selector 权限后,玩家可以在自己有权使用的命令中使用任意选择器。
精细权限控制的工作方式如下。请注意,此模组根据选择结果进行限制,而不是根据选择器的原始语法。玩家名称、UUID 或 @e 等选择器,只要产生的结果相同,就视为等效。
<selector> 的值
<selector> 字符串遵循以下格式:<command_name>.<selector_name>.<subsequent_arguments>,其中:
<command_name>是根命令名称<selector_name>与 Minecraft Wiki 命令页面“参数”部分中的参数名称一致<subsequent_arguments>表示选择器之后的命令参数层级路径
例如,在 /teleport 命令中:
<targets>和<destination>是有效的选择器名称(它们是entity选择器)- 后续参数构成路径的剩余部分
大多数选择器都是受支持的 entity 选择器。完整的支持列表请参阅下文。
示例
| 命令 | 语法(参见 Minecraft Wiki) | 要控制的选择器 | <selector> 的构成 |
|---|---|---|---|
/teleport @e @s |
teleport <targets> <destination> |
@e |
teleport.targets.targets.destination |
/teleport @e @s |
teleport <targets> <destination> |
@s |
teleport.destination.targets.destination |
/teleport @e ~ ~ ~ |
teleport <targets> <location> |
@e |
teleport.targets.targets.location |
通配符支持
选择器权限可能很长。好在你可以使用通配符,例如 teleport.*,以涵盖所有传送命令的选择器。
不过,Luckperms 不支持元数据通配符。你可以安装
[this mod](https://modrinth.com/mod/metadatawildcard4fabric-permissions-api
‘Metadata Wildcard for fabric-permissions-api’) 来启用此功能。
作用范围控制
使用以下权限定义选择器的作用范围:
minecraft.selector.entity.<selector>minecraft.selector.player.<selector>minecraft.selector.self.<selector>
如果玩家尝试选择未经授权的实体,命令将会失败。默认情况下,所有三个作用范围(即 minecraft.selector.*)均已允许。
简单示例
Allow:
minecraft.command.waypoint
minecraft.selector
Deny:
minecraft.selector.player.waypoint.*
minecraft.selector.entity.waypoint.*
玩家只能修改自己的路径点。
复杂示例
Allow:
minecraft.command.teleport # /teleport
minecraft.selector # All selectors
minecraft.selector.player.teleport.destination.destination #1
minecraft.selector.entity.teleport.destination.destination #2
minecraft.selector.entity.teleport.targets.targets.destination #3
minecraft.selector.player.teleport.facingEntity.* #4
Deny:
minecraft.selector.player.teleport.* #6
minecraft.selector.entity.* #5
minecraft.selector.self.teleport.facingEntity.* #7
命令行为:
| 命令 | 自身 | 其他玩家 | 非玩家实体 | 最终行为 |
|---|---|---|---|---|
/teleport <destination> |
<destination>默认允许 |
<destination>由 #𝟏 允许 |
<destination>由 #𝟐 允许 |
传送到任意实体 |
/teleport <targets> <destination> |
<targets>默认允许<destination>默认允许 |
<targets>由 #𝟓 拒绝<destination>由 #𝟓 拒绝 |
<targets>由 #𝟑 允许<destination>由 #𝟔 拒绝 |
只将非玩家实体传送到自身 |
/teleport <location> |
(无选择器) | – | – | 不受限制地传送到指定位置 |
/teleport <targets> <location> |
<targets>默认允许 |
<targets>由 #𝟓 拒绝 |
<targets>由 #𝟔 拒绝 |
只将自身传送到指定位置 |
/teleport <targets> <location> facing entity <facingEntity> |
<targets>默认允许<facingEntity>由 #𝟕 拒绝 |
<targets>由 #𝟓 拒绝<facingEntity>由 #𝟒 允许 |
<targets>由 #𝟔 拒绝<facingEntity>由 #𝟔 拒绝 |
将自身传送到指定位置,并面向其他玩家 |
实体数量上限
设置元数据 minecraft.selector.limit.<selector>,以限制使用指定选择器可选中的实体数量上限。
如果未设置此元数据,则不设数量上限。
选择权重
由元数据 minecraft.selector.weight.<selector> 控制。
没有权重设置的实体总是可以选择任何目标,也可以被任何选择器选中。当两个实体都有权重值时,选择器只能选择权重小于或等于自身的目标。
示例
你需要先安装[这个模组](https://modrinth.com/mod/metadatawildcard4fabric-permissions-api
‘Metadata Wildcard for fabric-permissions-api’)。
# Global permissions
Allow:
minecraft.command.gamemode
minecraft.selector
# Player-specific metadata
Player1: minecraft.selector.weight.gamemode.* = 7
Player2: minecraft.selector.weight.gamemode.* = -1
Player3: minecraft.selector.weight.gamemode.* = 7
Player4: (no weight set)
| 玩家 | 可修改以下玩家的游戏模式 | 原因 |
|---|---|---|
| Player1 | 所有玩家 | 权重($7$)≥ 其他所有玩家的权重 |
| Player2 | 仅 Player2 和 Player4 | 权重($-1$)< Player1/Player3($7$) Player4 无权重限制 |
| Player3 | 所有玩家 | 权重($7$)≥ 其他所有玩家的权重 |
| Player4 | 所有玩家 | 无权重限制 → 不受限制的访问 |
状态
以下列表显示了哪些选择器可以使用细粒度权限:
-
/ban-ip:不支持 -
entity:完全支持 -
game_profile:
在 Minecraft < 1.21.6 中不支持离线玩家的选择权重。其他情况完全支持 -
message:不支持 -
score_holder:
仅支持实体限制
生活质量
服务端
如果模组安装在服务端,它会让客户端认为自己拥有 OP 权限。这允许拥有相应权限的玩家放置管理员方块并访问游戏模式切换菜单。
Execute 命令
- 包含另一个条件:
/execute if permission <entity> <permission>,允许数据包检查权限(例如/execute if permission @s group.admin run say I am an admin) - #### 修饰符
feedback修饰符/execute feedback [silent | console]或/execute feedback entity <entity>用于静默或重定向命令反馈(例如/execute feedback silent run gamemode creative)oplevel修饰符/execute oplevel <level>或/execute oplevel <targets>可用于降低命令来源上下文的 OP 权限等级,如果你想以某个用户的身份运行命令(从函数或控制台),但又希望绕过权限能够生效,这会很有用(例如/execute as DrexHD oplevel entity @s run rtp,这将使用玩家DrexHD的 OP 等级,而不是实际命令执行者的 OP 等级来检查像rtp.bypass这样的权限)
客户端
如果模组安装在客户端,并且玩家有权限访问该命令但不是 OP(对基于 Spigot 的服务器很有用),也可以访问游戏模式切换器!
常见问题
Essential Permissions 支持哪些 Minecraft 版本?
Essential Permissions 支持 Minecraft Java 版 1.14–26.3,共 47 个版本,可用的加载器:Fabric / Quilt。下载时注意选择和你游戏版本一致的文件。
Essential Permissions 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric / Quilt,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。
DrexHD 的其他作品
查看全部 →CrashExploitFixer
这个模组修复了在Minecraft中发现的许多崩溃漏洞。
VillagerConfig
基于数据驱动交易的高级村民配置
quick pack
优化数据包/资源包 zip 文件的加载时间
Ledger
一款服务端日志记录模组
评论
登录后评论和评分