称号与计时
Lightweight Titles & Playtime Tracking for Modded Servers
📖About 称号与计时
这是一个轻量化的称号和计时模组,弥补了模组服不能装称号和计时插件的痛!仅装服务端即可,目前只支持1.20.1fabric版本。支持称号通过指令自定义给玩家,支持彩字中文。在TAB列表做了融合显示,计时和称号互不冲突。以下是食用教程,
设置显示位置:
/time position <after|above|below>
after:同一行显示在玩家名后面(推荐;TAB 也生效)
above / below:用隐形盔甲架在玩家名上方/下方显示第二行
/time afkTimeout <秒>
AFK 判定秒数(默认 60)。60 秒无“自主操作”就暂停计时。
/time monthBy30Days <true|false>
是否按 30 天 = 1 月 进位(默认 true)。
/time show <true|false>
全局开关在线时长显示(默认 true)。
判定“自主操作”示例:视角转动、使用/放置/攻击、物品交互、丢弃物品、热键换槽、背包点击等。
不计入:聊天发言、命令、被动移动(例如水流/推挤)。
- 称号(与你之前一致的语法)
/chtitle set <玩家> <称号…>
将称号显示为 <称号>,作为队伍前缀应用(聊天/头顶/TAB 均可见)。
若该玩家已保存颜色/调色板,则按其上色;否则用默认色 defaultColor。
/chtitle color <玩家> <颜色名 …>
一个颜色名 → 单色;多个颜色名 → 按字符轮换(非渐变)。
分隔符支持:中文/英文逗号、空格(含全角)、加号(+/+)。
颜色名可用 中文/英文/别名;也可直接写 #RRGGBB、0xRRGGBB、十进制。
/chtitle clear <玩家>
清除称号(只清前缀,不影响在线时长的后缀)。
/chtitle reload-config
重载 config/ch-mod.json(不会清玩家称号/颜色数据)。
权限:默认仅 OP 等级 ≥ 3 可用(可在 config/ch-mod.json 的 requiredOpLevel 修改)。
<玩家> 支持玩家名和能解析为单一目标的选择器(如 @s/最近的 @p),不支持多目标(如 @a)。
显示规则(避免冲突的关键点)
同一支队伍:
前缀 prefix = 称号 <…>(带颜色/轮换);
后缀 suffix = 在线时长(分→时→天→月自动进位)。
因为前后缀都落在同一个队伍,所以玩家名与 TAB 列表会同时显示称号+时长,不会互相顶掉。
above/below 仅在名牌二层显示,不影响 TAB。
配置与数据文件
第一次启动会自动生成;手改后可用 /chtitle reload-config 或重启生效(仅 ch-mod.json 需重载)。
配置文件
config/ch-mod.json(主配置,JSON)
requiredOpLevel(int)—— /chtitle 所需 OP 等级(默认 3)
useScoreboard(bool)—— 是否启用队伍前缀(默认 true,一般保持开启)
defaultColor(int)—— 未保存颜色时的默认色(十进制,默认白色 16777215)
namedColors(map<string,int>)—— 颜色名映射,可扩展中文/英文/别名
内置示例:红/紅、金、橙、黄/黃、绿/綠、青、蓝/藍、紫、白、灰/grey、黑、粉;red、gold、orange、yellow、green、aqua、blue、purple、white、gray、black、pink
config/ch-mod-time.json(时长显示/逻辑;若未见也会按默认值运行)
position:"after"|"above"|"below"(默认 "after")
afkTimeout:AFK 秒数(默认 60)
monthBy30Days:是否 30 天进 1 月(默认 true)
show:是否显示时长(默认 true)
strongRefreshSeconds:进服/改称号/进位后 TAB “增压刷新”秒数(默认 5)
以上时长项也都能用 /time … 动态修改(保存并实时生效)。
希望各位服主用的满意~(我也是个小服主)
Translate the following content without altering the layout. Provide a correctly formatted version that can be directly copied for use on a Modrinth mod release page.
This is a lightweight titles and playtime tracking mod, addressing the pain point of not being able to use title and timing plugins on modded servers! Only needs to be installed on the server side. Currently only supports 1.20.1 Fabric. Supports customizing titles for players via commands, including colored text and Chinese characters. Integrates seamlessly into the TAB list, with titles and playtime tracking not conflicting with each other.
Here's the usage tutorial:
- Setting Display Position:
/time position <after|above|below>
after: Displays on the same line after the player's name (Recommended; also works in TAB).
above / below: Uses invisible armor stands to display a second line above/below the player's name.
/time afkTimeout
Sets the AFK detection timeout in seconds (default 60). Timers pause after 60 seconds of no "voluntary actions".
/time monthBy30Days <true|false>
Whether to use 30 days = 1 month for progression (default true).
/time show <true|false>
Global toggle for displaying online playtime (default true).
Examples of "Voluntary Actions": Camera movement, using/placing/attacking blocks, item interaction, dropping items, hotbar slot switching, inventory clicks, etc.
Not Counted: Chat messages, commands, passive movement (e.g., water flow, pushing).
- Titles (Syntax consistent with before)
/chtitle set <title...>
Sets the title displayed as , applied as a team prefix (visible in chat, above head, and TAB).</p> <p>If the player has a saved color/palette, it is used; otherwise, the defaultColor is applied.</p> <p>/chtitle color <player> <color name ...></p> <p>One color name → solid color; Multiple color names → cycles colors per character (not gradient).</p> <p>Supported separators: Chinese/English commas, spaces (including full-width), plus signs (+/+).</p> <p>Color names can be in Chinese/English/aliases; Direct hex (#RRGGBB), 0xRRGGBB, or decimal values are also supported.</p> <p>/chtitle clear <player></p> <p>Clears the title (only clears the prefix, does not affect the online playtime suffix).</p> <p>/chtitle reload-config</p> <p>Reloads config/ch-mod.json (does not clear player title/color data).</p> <p>Permissions: Default requires OP level ≥ 3 (configurable via requiredOpLevel in config/ch-mod.json).<br><player> supports player names and selectors resolving to a single target (e.g., @s, nearest @p), not multiple targets (e.g., @a).</p> <p>Display Rules (Key points to avoid conflicts)</p> <p>Within the same team:</p> <p>Prefix = Title <...> (with colors/cycling).</p> <p>Suffix = Online playtime (auto-converts minutes → hours → days → months).</p> <p>Because both prefix and suffix belong to the same team, the player's name in the TAB list displays both the title and playtime simultaneously without overriding each other.</p> <p>above/below display only on the nameplate's second line and do not affect TAB.</p> <p>Configuration & Data Files</p> <p>Generated automatically on first run. Use /chtitle reload-config or restart after manual edits (only ch-mod.json requires reloading).</p> <p>Configuration Files:</p> <p>config/ch-mod.json (Main config, JSON)</p> <p>requiredOpLevel (int) – Required OP level for /chtitle commands (default 3).</p> <p>useScoreboard (bool) – Whether to enable team prefix (default true, generally keep enabled).</p> <p>defaultColor (int) – Default color if no saved color exists (decimal, default white 16777215).</p> <p>namedColors (map<string,int>) – Color name mappings, extensible with Chinese/English/aliases.</p> <p>Built-in examples: 红/紅, 金, 橙, 黄/黃, 绿/綠, 青, 蓝/藍, 紫, 白, 灰/grey, 黑, 粉; red, gold, orange, yellow, green, aqua, blue, purple, white, gray, black, pink.</p> <p>config/ch-mod-time.json (Playtime display/logic; runs with defaults if not found)</p> <p>position: "after"|"above"|"below" (default "after").</p> <p>afkTimeout: AFK timeout in seconds (default 60).</p> <p>monthBy30Days: Whether 30 days = 1 month (default true).</p> <p>show: Whether to display playtime (default true).</p> <p>strongRefreshSeconds: TAB "boosted refresh" duration after joining/changing title/unit progression (default 5).</p> <p>All these playtime settings can also be modified dynamically using /time ... (saved and applied immediately).</p> <p>Hope all server owners find it satisfactory~ (I'm a server owner myself too).</p>