mColor
适用于 Paper、Purpur 和 Folia 的玩家名称颜色、多色阶渐变、预设及网络同步功能。
mColor 通过 Adventure 直接应用颜色,因此 PlaceholderAPI 为可选。H2 数据库和安全默认值可立即生效,而共享 SQL 存储、预设、临时事件颜色和公共复制功能可按需启用。
功能特性
- 严格的
#RRGGBB 输入格式,支持配置命名颜色、彩虹模式和最多包含十六个色阶的渐变。
- 提供本地化的库存页面,用于基础颜色、相邻渐变和服务器定义的预设。
- 在 Paper、Purpur 和 Folia 上直接渲染显示名称和玩家列表颜色。
- 支持永久或临时颜色,并为在线和离线玩家提供自动过期机制。
- 个人历史记录与原子性的
/color undo 操作,包括恢复为无颜色状态。
- 隐私优先的
/color copy:默认情况下复制功能是私有的,必须经目标玩家授权才能启用。
- 针对在线玩家的设置、临时设置、重置和检查命令的管理功能。
- 乐观的内存更新机制,配合序列化的 SQL 写入和基于修订号的回滚。
- 默认使用 H2,同时支持 SQLite、MySQL、MariaDB 和 PostgreSQL,并具备自动模式升级功能。
- 可选的共享数据库轮询功能,适用于服务器网络。
- 提供英文和俄文消息支持,集成 Java Services API、PlaceholderAPI、bStats 以及细粒度的权限控制。
快速开始
- 将
mColor-1.1.1.jar 放入服务器的 plugins 目录并重启服务器。
- 通过你的权限插件授予命名颜色或特殊效果的使用权限。
- 运行
/color gui 或 /color red。
- 如有需要,在
plugins/mColor/config.yml 中调整调色板、预设和限制。
默认的 H2 配置无需任何凭据或外部服务。如果显式配置的外部存储不可用,mColor 将以仅内存模式启动并记录原因。
玩家命令
| 命令 |
描述 |
/color gui |
打开本地化颜色菜单 |
/color <name> 或 /color #RRGGBB |
应用纯色 |
/color gradient <color1> <color2> [color3...] |
应用多色阶渐变 |
/color preset <name> |
应用已配置的渐变预设 |
/color rainbow |
应用彩虹配色方案 |
/color temporary <duration> <profile...> |
应用临时颜色;持续时间可使用 m(分)、h(时)、d(天)或 w(周)表示 |
/color preview [profile...] |
预览而不更改已保存的配置 |
/color history |
显示最近的设置和过期信息 |
/color undo |
原子性地恢复至上一个设置 |
/color privacy <public|private> |
允许或拒绝其他玩家复制当前配置 |
/color copy <online-player> |
复制公开的有效配置及其剩余过期时间 |
/color reset |
恢复默认名称颜色 |
管理员可以使用 /mcolor set <player> <profile...>、/mcolor temporary <player> <duration> <profile...>、/mcolor reset <player>、/mcolor info <player> 以及 /mcolor reload。
权限
| 权限 |
默认值 |
用途 |
mcolor.use |
所有人 |
使用 /color 命令及 GUI |
mcolor.color.<name> |
未设置 |
使用某个已配置的命名颜色 |
mcolor.color.* |
操作员 |
使用所有命名颜色 |
mcolor.hex |
操作员 |
使用任意严格的十六进制颜色 |
mcolor.gradient |
操作员 |
构建自定义渐变 |
mcolor.preset.<name> |
未设置 |
使用某个已配置的预设 |
mcolor.preset.* |
操作员 |
使用所有预设 |
mcolor.rainbow |
操作员 |
使用彩虹模式 |
mcolor.temporary |
操作员 |
应用临时配置 |
mcolor.copy |
所有人 |
复制公开配置 |
mcolor.copy.bypass |
操作员 |
忽略目标玩家的复制隐私设置 |
mcolor.history |
所有人 |
查看和恢复个人历史记录 |
mcolor.admin |
操作员 |
管理玩家并重新加载配置 |
GUI 强制执行与命令相同的命名颜色、预设、渐变和彩虹模式权限。
语言与配置
默认使用英语。设置 language.default: ru_RU 并运行 /mcolor reload 即可切换至俄语。仅在界面应跟随每位玩家的 Minecraft 语言环境时,才设置 language.per-player: true。
limits.maximum-temporary-days 用于限制临时配置的天数。历史记录的显示大小、保留策略和过期检查在 history 部分有详细文档说明。通过 privacy.copy-public-by-default: false 设置,复制功能默认处于私有状态。
PlaceholderAPI 与 Java API
%mcolor_name% — 传统颜色格式的玩家名称
%mcolor_name_mm% — 转义的 MiniMessage 渲染文本
%mcolor_name_stripped% — 纯文本玩家名称
%mcolor_color%, %mcolor_color2% — 第一个和第二个颜色
%mcolor_gradient% — 所有渲染颜色,以逗号分隔
%mcolor_has_color% — yes 或 no
%mcolor_of_PlayerName% — 其他在线玩家的彩色名称
所有占位符均使用内存缓存,不会在服务端线程上查询 SQL。其他插件可以通过 Bukkit 的服务管理器获取 MColorService。
存储与网络
该模式记录活跃配置、过期时间、隐私设置、有界历史记录以及跨服务器的失效通知。更改操作是事务性的。SQL 任务被序列化以保持命令顺序,而版本检查可防止旧的失败写入回滚较新的选择。
对于服务器网络,请在每个后端使用 MySQL、MariaDB 或 PostgreSQL,使用相同的数据库,分配唯一的 sync.server-id,并启用 sync.enabled。过期的失效行会自动清理。
遥测
当 metrics.enabled 为 true 时,mColor 会使用匿名的 bStats 指标。不收集任何 UUID、名称、颜色、历史记录、隐私设置或数据库凭据。可以在插件配置或全局 bStats 配置中禁用指标。
构建
./gradlew clean build
构建产物位于 build/libs/mColor-1.1.1.jar 和 api/build/libs/mColor-API-1.1.1.jar。
本软件基于 MIT 许可证授权。
mColor
Player-name colors, multi-stop gradients, presets, and network synchronization for Paper, Purpur, and Folia.
mColor applies colors directly through Adventure, so PlaceholderAPI is optional. H2 and safe defaults work immediately, while shared SQL storage, presets, temporary event colors and public copying can be enabled deliberately.
What it does
- Strict
#RRGGBB input, configurable named colors, rainbow mode and gradients with up to sixteen stops.
- Localized inventory pages for basic colors, adjacent gradients and server-defined presets.
- Direct display-name and player-list rendering on Paper, Purpur and Folia.
- Permanent or temporary colors with automatic expiry for online and offline players.
- Personal history with an atomic
/color undo operation, including restoration to no color.
- Privacy-first
/color copy: copying is private by default and must be enabled by the target player.
- Administrative set, temporary, reset and inspection commands for online players.
- Optimistic in-memory updates with serialized SQL writes and revision-aware rollback.
- H2 by default, plus SQLite, MySQL, MariaDB and PostgreSQL with automatic schema upgrades.
- Optional shared-database polling for server networks.
- English and Russian messages, Java Services API, PlaceholderAPI, bStats and granular permissions.
Quick start
- Put
mColor-1.1.1.jar in the server's plugins directory and restart.
- Grant named colors or special effects through your permissions plugin.
- Run
/color gui or /color red.
- Adjust palettes, presets and limits in
plugins/mColor/config.yml when needed.
The default H2 configuration requires no credentials or external services. If explicitly configured external storage is unavailable, mColor starts in memory-only mode and logs the cause.
Player commands
| Command |
Description |
/color gui |
Open the localized color menu |
/color <name> or /color #RRGGBB |
Apply a solid color |
/color gradient <color1> <color2> [color3...] |
Apply a multi-stop gradient |
/color preset <name> |
Apply a configured gradient preset |
/color rainbow |
Apply the rainbow profile |
/color temporary <duration> <profile...> |
Apply a temporary color; durations use m, h, d, or w |
/color preview [profile...] |
Preview without changing the saved profile |
/color history |
Show recent settings and expiry information |
/color undo |
Atomically restore the previous setting |
/color privacy <public|private> |
Allow or deny other players copying the active profile |
/color copy <online-player> |
Copy a public active profile and its remaining expiry |
/color reset |
Restore the normal name |
Administrators can use /mcolor set <player> <profile...>, /mcolor temporary <player> <duration> <profile...>, /mcolor reset <player>, /mcolor info <player>, and /mcolor reload.
Permissions
| Permission |
Default |
Purpose |
mcolor.use |
everyone |
Use /color and the GUI |
mcolor.color.<name> |
unset |
Use one configured named color |
mcolor.color.* |
operators |
Use every named color |
mcolor.hex |
operators |
Use arbitrary strict hex colors |
mcolor.gradient |
operators |
Build custom gradients |
mcolor.preset.<name> |
unset |
Use one configured preset |
mcolor.preset.* |
operators |
Use every preset |
mcolor.rainbow |
operators |
Use rainbow mode |
mcolor.temporary |
operators |
Apply temporary profiles |
mcolor.copy |
everyone |
Copy public profiles |
mcolor.copy.bypass |
operators |
Ignore target copy privacy |
mcolor.history |
everyone |
View and restore personal history |
mcolor.admin |
operators |
Manage players and reload configuration |
The GUI enforces the same named-color, preset, gradient and rainbow permissions as commands.
Language and configuration
English is used by default. Set language.default: ru_RU and run /mcolor reload to switch to Russian. Set language.per-player: true only when the interface should follow each player's Minecraft locale.
limits.maximum-temporary-days bounds temporary profiles. History display size, retention and expiry checks are documented under history. Copying is private by default through privacy.copy-public-by-default: false.
PlaceholderAPI and Java API
%mcolor_name% — legacy-colored player name
%mcolor_name_mm% — escaped MiniMessage rendering
%mcolor_name_stripped% — plain player name
%mcolor_color%, %mcolor_color2% — first and second colors
%mcolor_gradient% — all render colors separated by commas
%mcolor_has_color% — yes or no
%mcolor_of_PlayerName% — another online player's colored name
All placeholders use the in-memory cache and never query SQL on the server thread. Other plugins can obtain MColorService through Bukkit's services manager.
Storage and networks
The schema records active profiles, expiry, privacy, bounded history and cross-server invalidations. Changes are transactional. SQL tasks are serialized to preserve command order, while revision checks prevent an older failed write from rolling back a newer selection.
For a network, choose MySQL, MariaDB or PostgreSQL on every backend, use the same database, assign a unique sync.server-id, and enable sync.enabled. Old invalidation rows are cleaned automatically.
Telemetry
mColor uses anonymous bStats metrics when metrics.enabled is true. No UUIDs, names, colors, history, privacy settings or database credentials are collected. Disable metrics in the plugin configuration or the global bStats configuration.
Build
./gradlew clean build
Artifacts are written to build/libs/mColor-1.1.1.jar and api/build/libs/mColor-API-1.1.1.jar.
Licensed under the MIT License.
评论 0
登录后参与评分
还没有评论,来抢沙发吧