Vanilla Permissions

模组

· 作者 DrexHD

在原版中加入权限检查,以实现完整的权限自定义功能。

0 本站下载 0 关注 更新于 6 个月前

最新 0.3.6+26.1.2 · 26.3 · Fabric / Quilt

一键开服(送7天)

Vanilla Permissions

本模组将权限检查功能加入原版游戏,以实现完整的权限自定义。

权限

权限 描述
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 选择自身

元数据 (Meta)

有时也被称为“选项”或“变量”。

不正确的类型被视为未定义值。

元数据 类型 描述
minecraft.selector.limit.<selector> Integer 限制使用 selector 可以选择的最大实体数量
minecraft.selector.weight.<selector> Integer 选择器权重,更多信息请参见选择权重

指令

本模组使用 Brigadier's 基于节点的权限系统。每个指令由多个节点组成,且每个节点都有各自的权限。

例如 /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 上命令“Arguments”部分中的参数名称
  • <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 不支持元数据(metadata)的通配符。你可以安装 这个模组以启用该功能。

范围控制

使用这些权限来定义选择器的范围:

  • 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 # 所有选择器
  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> 控制。

没有设置权重的实体始终可以选择任何目标并被任何选择器选择。当两个实体都有权重值时,选择器只能选择权重小于或等于其自身权重的目标。

示例

你需要先安装 此模组。

# 全局权限
Allow:
  minecraft.command.gamemode
  minecraft.selector
# 玩家专属元数据
Player1: minecraft.selector.weight.gamemode.* = 7
Player2: minecraft.selector.weight.gamemode.* = -1
Player3: minecraft.selector.weight.gamemode.* = 7
Player4: (未设置权重)
玩家 可修改的游戏模式对象 原因
Player1 所有玩家 权重 ($7$) ≥ 其他所有玩家的权重
Player2 仅 Player2 和 Player4 权重 ($-1$) < Player1/Player3 ($7$)
对 Player4 无权重限制
Player3 所有玩家 权重 ($7$) ≥ 其他所有玩家的权重
Player4 所有玩家 无权重限制 → 不受限访问

状态

以下列表显示了哪些选择器可以使用细粒度权限:

生活质量改进

服务端

如果模组在服务端安装,它将使客户端认为自己是 OP(管理员)。这允许拥有 适当权限 的玩家放置管理员方块并访问游戏模式切换菜单。

执行命令

  • 包含另一个条件:/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 级别而不是实际命令执行者来检查如 rtp.bypass 之类的权限)

客户端

如果模组安装在客户端上,只要玩家有权访问该命令但不是 OP(适用于基于 Spigot 的服务器!),也可以访问游戏模式切换菜单。

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源