SmartMOTD - 完整使用指南
===========================
功能介绍
SmartMOTD 是一个动态的服务器列表 MOTD(Message of the Day,每日提示)系统。它根据以下条件渲染两行 MOTD(以及可选的服务器图标):
- 模式优先级(普通/维护中/活动/故障转移/满载/忙碌/空载/季节性/自定义)
- 内置标志(maintenance/event/failover)及可选条件
- 占位符(在线人数/最大人数/TPS/心情/倒计时等)
- 可选格式化(旧版颜色、十六进制颜色、渐变)
- 可选的网页编辑器用于配置普通模式条目
安装步骤
- 将插件 jar 文件放入 /plugins 目录。
- 启动服务器一次以生成 config.yml 配置文件。
- 编辑 plugins/SmartMOTD/config.yml。
- 执行以下命令重载:/motd reload
命令说明
/motd reload
重载配置并重新渲染 MOTD。
权限要求:smartmotd.reload
/motd maintenance [on|off|toggle]
切换 flags.maintenance 标志(可触发维护模式)。
权限要求:smartmotd.toggle
/motd event [on|off|toggle]
切换 flags.event 标志(根据配置的目标时间在 event 和 event-live 之间切换)。
权限要求:smartmotd.toggle
/motd failover [on|off|toggle]
切换 flags.failover 标志(可触发故障转移模式)。
权限要求:smartmotd.toggle
/motd mode set <mode>
强制指定特定模式(在清除之前忽略优先级)。
权限要求:smartmotd.toggle
/motd mode clear
清除强制指定的模式。
权限要求:smartmotd.toggle
/motd mode status
显示当前强制指定的模式值。
权限要求:smartmotd.toggle
/motd preset list
列出内置的预设配置包。
权限要求:smartmotd.preset
/motd preset apply <name>
将内置预设应用到 plugins/SmartMOTD/config.yml(首先备份现有配置)。
然后重载 SmartMOTD。
权限要求:smartmotd.preset
/motd preview [mode]
在聊天栏中打印指定模式的渲染 MOTD 预览。
如果未提供 mode 参数,则使用当前强制指定的模式值(如果有)。
权限要求:smartmotd.preview
/motd debug [on|off|toggle]
切换配置中的调试标志。
权限要求:smartmotd.debug
/motd web
创建 Web 编辑器的一次性访问链接(如果已启用)。
仅限游戏内使用。
权限要求:smartmotd.web
权限节点
smartmotd.admin - 完全访问权限(plugin.yml 中的命令根权限)
smartmotd.reload - 使用 /motd reload
smartmotd.toggle - 使用 /motd maintenance|event|failover|mode
smartmotd.preset - 使用 /motd preset
smartmotd.preview - 使用 /motd preview
smartmotd.debug - 使用 /motd debug
smartmotd.web - 使用 /motd web
模式选择的工作原理
- 如果设置了
state.forced-mode(通过 /motd mode set 命令),则使用该模式。
- 否则,SmartMOTD 会按顺序检查 "priority:" 列表中的模式。
- 第一个匹配的模式将被使用。
- 如果没有其他模式匹配,则始终使用普通模式作为回退方案。
内置匹配项:
- maintenance(维护):当
flags.maintenance 为 true 时
- failover(故障转移):当
flags.failover 为 true 时
- event / event-live(活动 / 活动中):当
flags.event 为 true 时
- event-live 在活动目标时间已到达时使用
- event 在目标时间之前使用
- empty(空):当
online == 0 时
- full(满):当
online >= max 时
- busy(繁忙):当
online >= busy.threshold 时
还可以使用自定义模式条件(参见下方的“模式条件”)。
模式条件
在一种模式下,你可以添加:
modes.<mode>.conditions:
min-online: <数字> 或 "%max%"
max-online: <数字>
months: [1..12]
mood: <平静|活跃|过载> (或 moods: [..])
time-of-day: <早晨|下午|傍晚|夜晚> (或 times: [..])
day-of-week: <周一..周日> (或 days: [..])
geo: <国家代码> (或 geos: [..])
注意:
- min-online: “%max%” 表示“仅在服务器满员时匹配”。
- geo 匹配使用大写国家代码,如“US”、“DE”、“FR”(需要启用 geo.enabled)。
每种模式可配置多个条目(轮换 + 权重)
每种模式包含以下条目:
modes.<mode>.entries:
- line1: "..."
line2: "..."
icon: "icons/default.png"
weight: 1
chance: 1.0
轮换配置:
modes.<mode>.rotation:
type: sticky | random | sequential | weighted
interval-seconds: 30
random-seed: "smartmotd"
行为说明:
- sequential:按顺序遍历符合条件的条目
- random/sticky:每次间隔时进行确定性随机选择,并切换结果
- weighted:根据条目的权重进行确定性加权选择
- chance (0.0..1.0):使条目仅在部分时间内符合条件
动画帧(可选)
您可以通过添加 frames 来为条目设置动画:
modes.<mode>.entries:
- line1: "Base"
line2: "Base"
frames:
- line1: "Frame 1"
line2: "Frame 1"
- line1: "Frame 2"
line2: "Frame 2"
frame-interval-seconds: 1
此外,还可以为每种模式单独配置动画部分:
modes.<mode>.animation:
enabled: true
interval-seconds: 1
frames:
- line1: "..."
line2: "..."
如果性能保护机制切换到安全模式,动画将自动禁用。
格式化(颜色 + 渐变)
传统颜色代码:
&0..&f
格式化:
&l 粗体
&o 斜体
&n 下划线
&m 删除线
&r 重置
十六进制颜色:
&#RRGGBB
渐变:
gradient:#RRGGBB:#RRGGBB文本</gradient>
配置开关:
format.legacy-ampersand: true/false
format.hex: true/false
format.gradients: true/false
如果性能保护切换至安全模式,十六进制颜色和渐变将自动禁用。
内置占位符
- %online% 在线玩家数
- %max% 最大玩家数
- %mode% 当前模式名称
- %date% 服务器日期 (yyyy-MM-dd)
- %time% 服务器时间 (HH:mm:ss)
- %uptime% 插件运行时长(近似值)
- %tps% 服务器 TPS(尽力获取)
- %mspt% 服务器 MSPT(尽力获取,不可用时显示 "N/A")
- %perf_mode% "normal" 或 "safe"
- %mood% "calm" | "active" | "overloaded"
- %countdown% 距离事件目标的倒计时 (dd hh mm)
- %promo% 当前推广字符串(来自推广池)
- %tip% 当前提示字符串(来自提示池)
- %time_of_day% 时间段名称(与 %tod% 相同)
- %day_of_week% 星期几名称(与 %dow% 相同)
- %tod% 时间段名称
- %dow% 星期几名称
- %weather% 当前天气字符串(来自天气服务)
- %geo% 国家代码(仅在启用 geo 时可用;用于图标路径及 MOTD 文本中)
PlaceholderAPI:
- 如果已安装 PlaceholderAPI,SmartMOTD 也将应用 PlaceholderAPI 占位符。
网页编辑器
网页编辑器仅编辑正常模式条目 0:
modes.normal.entries.0.line1
modes.normal.entries.0.line2
modes.normal.entries.0.icon
在 config.yml 中启用:
web-editor:
enabled: true
bind: "0.0.0.0"
port: 8765
public-host: "YOUR_SERVER_IP_OR_DOMAIN"
重要提示:
- bind 是 HTTP 服务器的监听地址(设置为 0.0.0.0 以允许其他设备访问)。
- public-host 用于生成可点击的链接。
请勿将 public-host 设置为 0.0.0.0。
打开方式:
- 运行命令:/motd web
- 点击链接(其中包含令牌 token)。

预设配置
内置预设:
- survival
- smp
- lifesteal
- minigames
应用方法:
/motd preset apply <name>
它将覆盖 plugins/SmartMOTD/config.yml,并在以下位置创建备份:
plugins/SmartMOTD/config-backups/
可选服务
Performance Guard:
- 监控每秒 ping 次数 + TPS + MSPT。
- 在高负载下切换至 "safe" 模式(禁用动画、十六进制颜色/渐变,并使天气/地理信息返回备用默认值)。
Event(事件):
- event.target:ISO-8601 时间戳(示例:2026-01-01T00:00:00Z)
- event.live-mode:活动状态时使用的模式名称(默认:event-live)
- 在事件模式中使用 %countdown% 占位符。
Promotions / Tips 池(推广/提示池):
- promotions.enabled / tips.enabled
- mode:daily(每日)或 rotating(轮换)
- pool:字符串列表
- 使用 %promo% 和 %tip% 占位符。
彩蛋(Easter eggs):
- easter-eggs.enabled
- easter-eggs.chance
- easter-eggs.entries:临时 MOTD 覆盖内容(可包含占位符)
Weather(天气):
- weather.enabled
- weather.url 和 weather.extract-regex(提取第一个捕获组)
- %weather% 占位符
Geo(地理位置):
- geo.enabled
- geo.url 和 geo.extract-regex(提取第一个捕获组,例如 countryCode)
- 用于 MOTD 中的 %geo% 占位符、图标路径以及基于地理位置的条件判断
- 包含缓存、速率限制和失败退避机制
Failover TCP 检查(故障转移 TCP 检测):
- failover.tcp-check.enabled: true
- 定期检查 host:port 的连接状态
- 如果 auto-enable 为 true,它可以根据可达性自动设置 flags.failover
SmartMOTD - Full Usage Guide
===========================
What it does
SmartMOTD is a dynamic server-list MOTD system. It renders a 2-line MOTD (plus optional server icon)
based on:
- Mode priority (normal/maintenance/event/failover/full/busy/empty/seasonal/custom)
- Built-in flags (maintenance/event/failover) and optional conditions
- Placeholders (online/max/tps/mood/countdown/etc.)
- Optional formatting (legacy colors, hex colors, gradients)
- Optional web editor for normal mode entry 0
Installation
- Put the plugin jar into /plugins.
- Start the server once to generate config.yml.
- Edit plugins/SmartMOTD/config.yml.
- Reload with: /motd reload
Commands
/motd reload
Reloads config and restarts MOTD rendering.
Permission: smartmotd.reload
/motd maintenance [on|off|toggle]
Toggles flags.maintenance (can trigger the maintenance mode).
Permission: smartmotd.toggle
/motd event [on|off|toggle]
Toggles flags.event (switches between event and event-live based on the configured target time).
Permission: smartmotd.toggle
/motd failover [on|off|toggle]
Toggles flags.failover (can trigger the failover mode).
Permission: smartmotd.toggle
/motd mode set <mode>
Forces a specific mode (ignores priority until cleared).
Permission: smartmotd.toggle
/motd mode clear
Clears forced mode.
Permission: smartmotd.toggle
/motd mode status
Shows current forced mode value.
Permission: smartmotd.toggle
/motd preset list
Lists built-in preset config packs.
Permission: smartmotd.preset
/motd preset apply <name>
Applies a built-in preset to plugins/SmartMOTD/config.yml (backs up existing config first).
Then reloads SmartMOTD.
Permission: smartmotd.preset
/motd preview [mode]
Prints a preview of the rendered MOTD for a mode in chat.
If no mode is provided, it uses the currently forced mode value (if any).
Permission: smartmotd.preview
/motd debug [on|off|toggle]
Toggles config debug flag.
Permission: smartmotd.debug
/motd web
Creates a one-time access link to the Web Editor (if enabled).
In-game only.
Permission: smartmotd.web
Permissions
smartmotd.admin - Full access (command root permission in plugin.yml)
smartmotd.reload - /motd reload
smartmotd.toggle - /motd maintenance|event|failover|mode
smartmotd.preset - /motd preset
smartmotd.preview - /motd preview
smartmotd.debug - /motd debug
smartmotd.web - /motd web
How mode selection works
- If state.forced-mode is set (via /motd mode set), that mode is used.
- Otherwise SmartMOTD checks modes in the "priority:" list in order.
- The first matching mode is used.
- The normal mode is always used as the fallback if nothing else matches.
Built-in matches:
- maintenance: when flags.maintenance is true
- failover: when flags.failover is true
- event / event-live: when flags.event is true
- event-live is used when the event target time has been reached
- event is used before the target time
- empty: when online == 0
- full: when online >= max
- busy: when online >= busy.threshold
Custom mode conditions can also be used (see "Mode conditions" below).
Mode conditions
Under a mode, you can add:
modes.<mode>.conditions:
min-online: <number> or "%max%"
max-online: <number>
months: [1..12]
mood: <calm|active|overloaded> (or moods: [..])
time-of-day: <morning|afternoon|evening|night> (or times: [..])
day-of-week: <monday..sunday> (or days: [..])
geo: <countryCode> (or geos: [..])
Notes:
- min-online: "%max%" means "only match when server is full".
- geo matching uses upper-case country codes like "US", "DE", "FR" (requires geo.enabled).
Multiple entries per mode (rotation + weights)
Each mode has entries:
modes.<mode>.entries:
- line1: "..."
line2: "..."
icon: "icons/default.png"
weight: 1
chance: 1.0
Rotation config:
modes.<mode>.rotation:
type: sticky | random | sequential | weighted
interval-seconds: 30
random-seed: "smartmotd"
How it behaves:
- sequential: goes through eligible entries in order
- random/sticky: deterministic random selection that changes each interval
- weighted: deterministic weighted selection using the entry weights
- chance (0.0..1.0): makes an entry eligible only some of the time
Animation frames (optional)
You can animate an entry by adding frames:
modes.<mode>.entries:
- line1: "Base"
line2: "Base"
frames:
- line1: "Frame 1"
line2: "Frame 1"
- line1: "Frame 2"
line2: "Frame 2"
frame-interval-seconds: 1
There is also a per-mode animation section:
modes.<mode>.animation:
enabled: true
interval-seconds: 1
frames:
- line1: "..."
line2: "..."
If performance-guard switches to safe mode, animations are disabled automatically.
Formatting (colors + gradients)
Legacy colors:
&0..&f
Formatting:
&l bold
&o italic
&n underline
&m strikethrough
&r reset
Hex colors:
&#RRGGBB
Gradients:
gradient:#RRGGBB:#RRGGBBText</gradient>
Config switches:
format.legacy-ampersand: true/false
format.hex: true/false
format.gradients: true/false
If performance-guard switches to safe mode, hex and gradients are disabled automatically.
Built-in placeholders
- %online% Online players
- %max% Max players
- %mode% Current mode name
- %date% Server date (yyyy-MM-dd)
- %time% Server time (HH:mm:ss)
- %uptime% Plugin uptime (rough)
- %tps% Server TPS (best effort)
- %mspt% Server MSPT (best effort, "N/A" if unavailable)
- %perf_mode% "normal" or "safe"
- %mood% "calm" | "active" | "overloaded"
- %countdown% Countdown to event target (dd hh mm)
- %promo% Current promo string (from promotions pool)
- %tip% Current tip string (from tips pool)
- %time_of_day% Time of day name (same as %tod%)
- %day_of_week% Day of week name (same as %dow%)
- %tod% Time of day name
- %dow% Day of week name
- %weather% Current weather string (from weather service)
- %geo% Country code (only when geo is enabled; used in icon paths and can be used in MOTD text)
PlaceholderAPI:
- If PlaceholderAPI is installed, SmartMOTD will also apply PlaceholderAPI placeholders.
Web Editor
The Web Editor edits ONLY the normal mode entry 0:
modes.normal.entries.0.line1
modes.normal.entries.0.line2
modes.normal.entries.0.icon
Enable in config.yml:
web-editor:
enabled: true
bind: "0.0.0.0"
port: 8765
public-host: "YOUR_SERVER_IP_OR_DOMAIN"
Important:
- bind is where the HTTP server listens (0.0.0.0 to allow other devices).
- public-host is used to generate the clickable link.
Do not set public-host to 0.0.0.0.
Open it:
- Run: /motd web
- Click the link (it includes a token).

Presets
Built-in presets:
- survival
- smp
- lifesteal
- minigames
Apply:
/motd preset apply <name>
It overwrites plugins/SmartMOTD/config.yml and creates a backup in:
plugins/SmartMOTD/config-backups/
Optional services
Performance Guard:
- Watches pings-per-second + TPS + MSPT.
- Switches to "safe" mode under load (disables animations/hex/gradients and makes weather/geo return fallbacks).
Event:
- event.target: ISO-8601 timestamp (example: 2026-01-01T00:00:00Z)
- event.live-mode: which mode name to use when live (default: event-live)
- Use %countdown% in event mode.
Promotions / Tips pools:
- promotions.enabled / tips.enabled
- mode: daily or rotating
- pool: list of strings
- Use %promo% and %tip% placeholders.
Easter eggs:
- easter-eggs.enabled
- easter-eggs.chance
- easter-eggs.entries: temporary MOTD overrides (can include placeholders)
Weather:
- weather.enabled
- weather.url and weather.extract-regex (extracts first capture group)
- %weather% placeholder
Geo:
- geo.enabled
- geo.url and geo.extract-regex (extracts first capture group, e.g., countryCode)
- Used for %geo% in MOTD and icon paths and for geo-based conditions
- Includes caching, rate-limiting, and failure backoff
Failover TCP check:
- failover.tcp-check.enabled: true
- Checks host:port periodically
- If auto-enable is true, it can automatically set flags.failover based on reachability
Troubleshooting
- Web editor link opens localhost/127.0.0.1:
Set web-editor.public-host to your server IP/domain.
- Hex/gradients not working:
Ensure format.hex / format.gradients are enabled and server is not in safe mode (%perf_mode%).
- Geo always empty:
Enable geo.enabled, set a working geo.url + geo.extract-regex, and ensure safe mode is not active.
评论 0
登录后参与评分
还没有评论,来抢沙发吧