|
|
玩家角色 (Player Roles)Github |相关wiki |源站链接支持: fabric用于Fabric服务器的角色和权限管理
这个简单的实现允许自定义权限通过Discord类似的\"角色\"分配给玩家。
角色及其权限在JSON文件中定义,可以在运行时轻松修改和重新加载以进行快速迭代。
角色的JSON文件位于配置目录(`/config/roles.json`)中。示例配置可能如下所示:json{\"admin\": {\"level\": 100,\"overrides\": {\"name_decoration\": {\"style\": [\"red\", \"bold\"],\"suffix\": {\"text\": \"*\"}},\"permission_level\": 4,\"command_feedback\": true,\"commands\": {\".*\": \"allow\"}}},\"spectator\": {\"level\": 10,\"overrides\": {\"commands\": {\"gamemode (spectator|adventure)\": \"allow\"}}},\"mute\": {\"level\": 1,\"overrides\": {\"mute\": true}},\"everyone\": {\"overrides\": {\"commands\": {\"help\": \"allow\",\".*\": \"deny\"}}}}
但这里发生了什么?这个JSON文件声明了三个角色:`admin`、`spectator`和`everyone`。
`everyone`是默认角色:每个玩家都将拥有此角色,并且无法删除。
其他指定的角色作为 `everyone` 角色的覆盖。
覆盖
在每个角色声明中,我们列出一组覆盖。覆盖是此模块用来根据角色更改游戏行为的一般系统。
当前,支持的覆盖类型包括 `commands`、`name_decoration`、`chat_type`、`mute`、`command_feedback`、`permission_level` 和 `entity_selectors`。
在多个角色针对相同事物时应考虑覆盖如何应用。冲突将总是由具有最高级别的角色解决。
所以,在这个示例中:虽然 `everyone` 声明除了 `help` 以外的每个命令都被禁止,因为 `admin` 和 `spectator` 拥有更高的权限级别,它们将覆盖此行为。
#### 命令
`commands` 覆盖用于操纵玩家能够使用的命令。
每个覆盖条目都指定要匹配的正则表达式模式,然后是 mod 遇到该模式时如何响应的策略。
例如,模式 `.*` 匹配每个可能的命令,而 `gamemode (spectator|adventure)` 仅匹配深思熟虑和冒险模式的游戏模式命令。
然后可以与这些模式一起使用的策略是 `allow` 和 `deny`:
`allow` 确保玩家可以使用此命令,而 `deny` 将阻止玩家使用此命令。
例如:
json
\"commands\": {
\"gamemode (spectator|adventure)\": \"allow\"
}
命令覆盖还可以额外使用 `hidden` 规则结果:这将允许使用该命令,同时隐藏它不出现在命令建议中。
#### 名称装饰
`name_decoration` 覆盖修改具有角色的玩家名称的显示方式。这可用于覆盖名称颜色以及在名字前后添加文本。
这比记分板团队颜色的优先级低。
名称装饰可以声明为:
json
\"name_decoration\": {
\"prefix\": {\"text\": \"[前缀] \", \"color\": \"green\"},
\"suffix\": {\"text\": \"-后缀\"},
\"style\": [\"#ff0000\", \"bold\", \"underline\"],
\"contexts\": [\"chat\", \"tab_list\"]
}
可以可选声明三个字段:
- `style`:接受文本格式化类型或十六进制颜色列表
- `prefix`:接受在名称前面添加的文本组件
- `suffix`:接受在名称后面添加的文本组件
- `contexts`:接受定义此装饰应用于的可能上下文的一组可能上下文
- 可接受:`chat` 和 `tab_list`
- 默认:适用于所有可能的上下文
#### 聊天类型
`chat_type` 覆盖允许替换具有角色的所有玩家的聊天消息装饰。
这与基于数据包可改变的普通 `minecraft:chat_type` 注册结合。
`chat_type` 覆盖简单声明应使用的 `chat_type`:
json
\"chat_type\": \"minecraft:say_command\"
此示例将更改具有给定角色的所有玩家的所有消息的显示方式为应用 `say_command` 样式。
需要注意的是,Vanilla聊天类型注册表在服务端启动时加载自数据包,无法像玩家角色配置一样进行热重载。
##### 声明自定义聊天类型
自定义聊天类型可以使用自定义数据包在 `data//chat_type/` 中声明。
例如,我们可能声明 `data/mydatapack/chat_type/admin.json`:
json
{
\"chat\": {
\"decoration\": {
\"parameters\": [\"sender\", \"content\"],
\"style\": {},
\"translation_key\": \"%s: %s <- 一个管理员说了这句话!\"
}
},
\"narration\": {
\"decoration\": {
\"parameters\": [\"sender\", \"content\"],
\"style\": {},
\"translation_key\": \"chat.type.text.narrate\"
},
\"priority\": \"chat\"
}
}
然后可以在覆盖中引用:
json
\"chat_type\": \"mydatapack:admin\"
#### 权限级别
`permission_level` 覆盖设置分配玩家的传统[权限级别](链接)。
这对与其他 mod 交互以及不受此 mod 支持的基本功能交互非常有用。
权限级别声明为:
json
\"permission_level\": 4
#### 静音
`mute` 覆盖通过简单地阻止分配给玩家在聊天中输入来运作。
表述如下:
json
\"mute\": true
#### 命令反馈
默认情况下,所有运营商在其他玩家运行命令时会收到全局反馈。
`command_feedback` 覆盖允许特定角色接收相同类型的反馈。
表述如下:
json
\"command_feedback\": true
#### 实体选择器
通常,只有具有权限级别为两或更高的命令源才能使用实体选择器。
`entity_selectors` 覆盖允许特定角色使用实体选择器。
可以允许实体选择器如下:
json
\"entity_selectors\": true
其他配置
角色还可以通过配置文件应用到命令方块或功能执行器。
例如:
json
{
\"commands\": {
\"apply\": {
\"command_block\": true,
\"function\": true
},
\"overrides\": {
}
}
}
角色还可以从另一个角色继承覆盖。
这可以通过 `includes` 声明来实现,引用较低级别的其他角色。
例如:
json
{
\"foo\": {
\"includes\": [\"bar\"],
\"overrides\": {
\"commands\": {
\".*\": \"allow\"
}
}
},
\"bar\": {
\"overrides\": {
\"name_decoration\": {
\"style\": \"red\"
}
}
}
}
通过此配置,`foo` 角色将继承红色的 `name_decoration`。
游戏中应用角色
一旦您对 `roles.json` 文件进行了修改,就可以通过使用 `/role reload` 来重新加载它。
所有角色管理都通过 `role` 命令通过各种子命令进行。例如:
- `role assign Gegy admin`:为 `Gegy` 分配 `admin` 角色
- `role remove Gegy admin`:从 `Gegy` 删除 `admin` 角色
- `role list Gegy`:列出被应用到 `Gegy` 的所有角色
- `role reload`:重新加载 `roles.json` 配置文件
来自Modrinth所有游戏版本1.21.61.21.71.21.51.21.11.21.21.21.31.21.41.211.20.61.20.41.20.21.201.20.11.19.41.19.31.19.3-rc11.19.11.191.18.11.181.17.11.171.16.41.16.5所有类型fabricv1.6.15+1.21.6player-roles-1.6.15.jar下载1.6.15+1.21.6#Releaseplayer-roles-1.6.15-sources.jar下载1.6.15+1.21.6#Release**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.14+1.21.6...v1.6.15+1.21.6展开版本: 1.6.15+1.21.6支持游戏: 1.21.6, 1.21.7类型:FabricRelease下载次数: 268v1.6.14+1.21.6player-roles-1.6.14.jar下载1.6.14+1.21.6#Releaseplayer-roles-1.6.14-sources.jar下载1.6.14+1.21.6#Release## What\'s Changed* Update mod to Minecraft 1.21.6 by @haykam821 in https://github.com/NucleoidMC/player-roles/pull/106**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.14+1.21.5...v1.6.14+1.21.6展开版本: 1.6.14+1.21.6支持游戏: 1.21.6类型:FabricRelease下载次数: 26v1.6.14+1.21.5player-roles-1.6.14.jar下载1.6.14+1.21.5#Releaseplayer-roles-1.6.14-sources.jar下载1.6.14+1.21.5#Release## What\'s Changed* Fix online player roles being cleared when reloading roles by @haykam821 in https://github.com/NucleoidMC/player-roles/pull/104**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.13+1.21.5...v1.6.14+1.21.5展开版本: 1.6.14+1.21.5支持游戏: 1.21.5类型:FabricRelease下载次数: 364v1.6.13+1.21.5player-roles-1.6.13.jar下载1.6.13+1.21.5#Releaseplayer-roles-1.6.13-sources.jar下载1.6.13+1.21.5#Release## What\'s Changed* Update mod to Minecraft 1.21.5 by @haykam821 in https://github.com/NucleoidMC/player-roles/pull/101**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.13+1.21.1...v1.6.13+1.21.5展开版本: 1.6.13+1.21.5支持游戏: 1.21.5类型:FabricRelease下载次数: 139v1.6.13+1.21.1player-roles-1.6.13.jar下载1.6.13+1.21.1#Releaseplayer-roles-1.6.13-sources.jar下载1.6.13+1.21.1#Release## What\'s Changed* Fix MessageFormat mixin error by @BlazingTwist in https://github.com/NucleoidMC/player-roles/pull/96## New Contributors* @BlazingTwist made their first contribution in https://github.com/NucleoidMC/player-roles/pull/96**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.12+1.21.1...v1.6.13+1.21.1展开版本: 1.6.13+1.21.1支持游戏: 1.21.1, 1.21.2, 1.21.3, 1.21.4类型:FabricRelease下载次数: 4,468v1.6.12+1.21.1player-roles-1.6.12.jar下载1.6.12+1.21.1#Releaseplayer-roles-1.6.12-sources.jar下载1.6.12+1.21.1#Release## What\'s Changed* Update to 1.21.1 by @ashhhleyyy in https://github.com/NucleoidMC/player-roles/pull/92**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.11+1.21...v1.6.12+1.21.1展开版本: 1.6.12+1.21.1支持游戏: 1.21.1类型:FabricRelease下载次数: 195v1.6.11+1.21player-roles-1.6.11.jar下载1.6.11+1.21#Releaseplayer-roles-1.6.11-sources.jar下载1.6.11+1.21#Release## What\'s Changed* Update mod to Minecraft 1.21 by @haykam821 in https://github.com/NucleoidMC/player-roles/pull/89**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.10+1.20.6...v1.6.11+1.21展开版本: 1.6.11+1.21支持游戏: 1.21类型:FabricRelease下载次数: 2,202v1.6.10+1.20.6player-roles-1.6.10.jar下载1.6.10+1.20.6#Releaseplayer-roles-1.6.10-sources.jar下载1.6.10+1.20.6#Release* Updated to Minecraft 1.20.6**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.9+1.20.4...v1.6.10+1.20.6展开版本: 1.6.10+1.20.6支持游戏: 1.20.6类型:FabricRelease下载次数: 178v1.6.9+1.20.4player-roles-1.6.9.jar下载1.6.9+1.20.4#Releaseplayer-roles-1.6.9-sources.jar下载1.6.9+1.20.4#Release## What\'s Changed* Fix permission level during login by @TheEpicBlock in https://github.com/NucleoidMC/player-roles/pull/81## New Contributors* @TheEpicBlock made their first contribution in https://github.com/NucleoidMC/player-roles/pull/81**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.8+1.20.4...v1.6.9+1.20.4展开版本: 1.6.9+1.20.4支持游戏: 1.20.4类型:FabricRelease下载次数: 325v1.6.8+1.20.4player-roles-1.6.8.jar下载v1.6.8+1.20.4#Releaseplayer-roles-1.6.8-sources.jar下载v1.6.8+1.20.4#Release## What\'s Changed* Updated to 1.20.4 by @jaskarth**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.7+1.20.2...v1.6.8+1.20.4展开版本: v1.6.8+1.20.4支持游戏: 1.20.4类型:FabricRelease下载次数: 993v1.6.7+1.20.2player-roles-1.6.7.jar下载v1.6.7+1.20.2#Releaseplayer-roles-1.6.7-sources.jar下载v1.6.7+1.20.2#Release## What\'s Changed* Update mod to Minecraft 1.20.2 by @haykam821 in https://github.com/NucleoidMC/player-roles/pull/77* feat: add hover support to name decoration override by @williambl in https://github.com/NucleoidMC/player-roles/pull/78**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.6+1.20...v1.6.7+1.20.2展开版本: v1.6.7+1.20.2支持游戏: 1.20.2类型:FabricRelease下载次数: 507v1.6.6+1.20player-roles-1.6.6.jar下载v1.6.6+1.20#Releaseplayer-roles-1.6.6-sources.jar下载v1.6.6+1.20#Release## What\'s Changed* Name decorations are now applied in the tab list* A new `contexts` list field is now included in the `name_decoration` override, which can be used to control where name decorations are applied* Accepted values are `chat` and `tab_list`* Fix POM dependencies by @kb-1000 in https://github.com/NucleoidMC/player-roles/pull/73* Fix #56: improve compatibility with some mods such as EssentialAddons by avoiding Mixin conflict* Fix #71: increase maximum command chain length to support all of Vanilla commands## New Contributors* @kb-1000 made their first contribution in https://github.com/NucleoidMC/player-roles/pull/73**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.5+1.20...v1.6.6+1.20展开版本: v1.6.6+1.20支持游戏: 1.20, 1.20.1类型:FabricRelease下载次数: 5,140v1.6.5+1.20player-roles-1.6.5.jar下载v1.6.5+1.20#Releaseplayer-roles-1.6.5-sources.jar下载v1.6.5+1.20#Release* Update to Minecraft 1.20**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.4+1.19.4...v1.6.5+1.20展开版本: v1.6.5+1.20支持游戏: 1.20类型:FabricRelease下载次数: 404v1.6.4+1.19.4player-roles-1.6.4.jar下载v1.6.4+1.19.4#Releaseplayer-roles-1.6.4-sources.jar下载v1.6.4+1.19.4#Release## What\'s Changed* Update to Minecraft 1.19.4**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.3+1.19.3...v1.6.4+1.19.4展开版本: v1.6.4+1.19.4支持游戏: 1.19.4类型:FabricRelease下载次数: 365player-roles-1.6.3+1.19.3player-roles-1.6.3.jar下载v1.6.3+1.19.3#Releaseplayer-roles-1.6.3-sources.jar下载v1.6.3+1.19.3#Release## What\'s Changed* Add a `bypass_player_limit` role override by @williambl in https://github.com/NucleoidMC/player-roles/pull/66**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.6.2...v1.6.3+1.19.3展开版本: v1.6.3+1.19.3支持游戏: 1.19.3类型:FabricRelease下载次数: 459player-roles-1.6.2player-roles-1.6.2.jar下载1.6.2#Beta* Update to Minecraft 1.19.3-rc1展开版本: 1.6.2支持游戏: 1.19.3-rc1类型:FabricBeta下载次数: 107player-roles-1.6.1player-roles-1.6.1.jar下载1.6.1#Release* Update to Minecraft 1.19.1展开版本: 1.6.1支持游戏: 1.19.1类型:FabricRelease下载次数: 669player-roles-1.6.0player-roles-1.6.0.jar下载1.6.0#Release* Update to 1.19 (thanks @Foxite!)* Replace `chat_format` override with `chat_type` that references the Vanilla chat type registry* Replace `name_style` override with `name_decoration` that can support applying prefixes & suffixes to namesThese are **breaking** changes to these overrides that are required to update to support 1.19\'s new chat features. Details on how to use these overrides can be found in the [README](https://github.com/NucleoidMC/player-roles/blob/1.19/README.md).**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.5.2...v1.6.0展开版本: 1.6.0支持游戏: 1.19类型:FabricRelease下载次数: 342player-roles-1.5.2player-roles-1.5.2.jar下载1.5.2#Release- Fix role autocompletion giving only higher roles (#50, thanks @EnnuiL!)- Fix `chat_format` override not applying for other players (#51)- Fix incompatibility with Drogtor causing crashes (#52)展开版本: 1.5.2支持游戏: 1.18.1类型:FabricRelease下载次数: 501player-roles-1.5.1player-roles-1.5.1.jar下载1.5.1#Release* Propagate errors from override definitions that failed to parse: previously these would silently fail (incorrectly), causing confusion* Fix `permission_keys` override type not working until `/role reload` was run (#45)* Fix `/role reload` not sending up-to-date permissions to players, causing command suggestions to be incorrect until the next `/role reload` or relog展开版本: 1.5.1支持游戏: 1.18, 1.18.1类型:FabricRelease下载次数: 146player-roles-1.5.0player-roles-1.5.0.jar下载1.5.0#ReleaseHuge thank you to all contributors for this update!## What\'s Changed* Add the entity selectors override by @haykam821* Implement a VirtualServerCommandSource for specifying a custom set of roles by @ashhhleyyy* Update to 1.18 by @fluse1367**Full Changelog**: https://github.com/NucleoidMC/player-roles/compare/v1.4.3...v1.5.0展开版本: 1.5.0支持游戏: 1.18类型:FabricRelease下载次数: 133player-roles-1.4.3player-roles-1.4.3.jar下载1.4.3#Release* Fix incorrect permission level checking for the `/role` command (#41)展开版本: 1.4.3支持游戏: 1.17.1类型:FabricRelease下载次数: 162player-roles-1.4.2player-roles-1.4.2.jar下载1.4.2#Release* Fix chat format override not applying due to an improperly upgraded mixin* Fix published API jar not containing `fabric.mod.json` and consequently not being remapped as a dependency展开版本: 1.4.2支持游戏: 1.17类型:FabricRelease下载次数: 149player-roles-1.4.1player-roles-1.4.1.jar下载1.4.1#Release* Fix a critical issue where the game would throw an error when players attempted to respawn (#32)展开版本: 1.4.1支持游戏: 1.17类型:FabricRelease下载次数: 116player-roles-1.4.0player-roles-1.4.0.jar下载1.4.0#Release* Update to 1.17!* Fix wrong order of inheritance for overrides (#29)* Fix command blocks and functions having the `everyone` role applied (#28)* Separate out a simple includable API for interacting with Player Roles展开版本: 1.4.0支持游戏: 1.17类型:FabricRelease下载次数: 114player-roles-1.3.1player-roles-1.3.1.jar下载1.3.1#Release* Ensure all roles are assigned unique levels instead of silently \"masking\" other roles with the same level* Send feedback to the player when they are muted and support muting through /msg and /teammsg command* Allow for roles to inherit overrides from other roles (#22)```json\"foo\": {\"includes\": [\"bar\"]},\"bar\": {}```* Support applying roles to command blocks and functions```json\"foo\": {\"apply\": {\"command_block\": true,\"function\": true}}```* Report parsing errors to the player when running /role reload展开版本: 1.3.1支持游戏: 1.16.4, 1.16.5类型:FabricRelease下载次数: 170player-roles-1.3.0player-roles-1.3.0.jar下载1.3.0#Release- Store roles in an independent database instead of on player data- This means that roles can now be edited for offline players- Fix overrides not being properly applied to players who joined for the first time without any roles- Allow permission key overrides with LuckPermissionsFor example:```json\"overrides\": {\"permission_keys\": {\"foo.*\": \"allow\",\"foo.bar\": \"deny\",\"foo.*.baz\": \"allow\",\"*.baz\": \"deny\"}}```- Change parsing of `chat_format` override to properly handle styling of the player\'s message.For example, `\"chat_format\": \"§8<%s§8> §7%s\"` would not style the player\'s message, whereas it now will be correctly styled grey.展开版本: 1.3.0支持游戏: 1.16.4类型:FabricRelease下载次数: 108player-roles-1.2.1player-roles-1.2.1.jar下载1.2.1#Release* Fix command permission hooks failing after datapack reload* Add support for custom name style colors through `#ffffff` format- e.g. `\"name_style\": [\"#ff0000\"]`展开版本: 1.2.1支持游戏: 1.16.4类型:FabricRelease下载次数: 104player-roles-1.2.0player-roles-1.2.0.jar下载1.2.0#Release展开版本: 1.2.0支持游戏: 1.16.4类型:FabricRelease下载次数: 96全部版本
markdown_parsed
文章类型:收录
layui.use([\'form\'], function(){
var form = layui.form;
});
玩家角色 |
|