MemoryGuard
当内存不足时自动警告玩家并安全关闭你的 Minecraft 服务器,有助于降低因崩溃导致世界文件损坏的风险。
MemoryGuard 会定期检查 JVM 堆内存以及主机或容器的可用内存。当其中任一指标低于配置的阈值时,插件会广播警告信息,并在正常关闭服务器前开始倒计时,以便世界数据有机会保存。
功能特性
- 同时监控 JVM 堆内存和主机/容器可用内存。
- 可配置内存阈值、检查间隔以及关闭倒计时。
- 提供英文和繁体中文消息;默认为英文。
- 在 Linux 环境下检测容器内存限制(如果支持)。
- 包含一个管理员测试命令,用于检查关闭流程。
命令
/memoryguard reload — 重新加载配置文件。
/memoryguard test — 测试公告和倒计时。倒计时结束后服务器将真正关闭。仅在可以接受停机时间时运行此命令。
这些命令默认仅对服务器操作员开放。
安装与配置
将插件 JAR 文件放入服务器的 plugins 文件夹中,然后重启服务器。首次启动时,配置文件将在 plugins/MemoryGuard/config.yml 处创建。
默认内存阈值为 1.5 GB,检查间隔为 30 秒,关闭倒计时为 10 秒。请在配置文件中调整这些值。将 language 设置为 en 或 zh 以选择消息语言,然后运行 /memoryguard reload 应用更改。
MemoryGuard 会以正常方式关闭服务器,但它无法自行重启 Minecraft。若要自动重启,请在服务器托管面板或启动脚本中启用“停止后重启”选项。
兼容性
基于 Paper API 编译,适用于 Paper 和 Purpur 1.20–26.3。其他基于 Bukkit/Paper 的服务器软件可能也能正常工作,但未经过单独测试,不保证兼容。
MemoryGuard
Automatically warns players and safely shuts down your Minecraft server when memory runs low, helping reduce the risk of world-file corruption caused by crashes.
MemoryGuard regularly monitors JVM heap memory and available host or container memory. When either falls below the configured threshold, the plugin broadcasts a warning and starts a countdown before shutting down the server normally, giving world data a chance to be saved.
Features
- Monitors both JVM heap memory and available host/container memory.
- Configurable memory threshold, check interval, and shutdown countdown.
- English and Traditional Chinese messages; English is the default.
- Detects container memory limits on Linux where available.
- Includes an admin test command for checking the shutdown flow.
Commands
/memoryguard reload — Reloads the configuration.
/memoryguard test — Tests the announcement and countdown. The server will actually shut down when the countdown ends. Run this only when downtime is acceptable.
These commands are restricted to server operators by default.
Installation and Configuration
Place the plugin JAR in your server’s plugins folder and restart the server. On first startup, the configuration file is created at plugins/MemoryGuard/config.yml.
The default memory threshold is 1.5 GB, the check interval is 30 seconds, and the shutdown countdown is 10 seconds. Adjust these values in the configuration file. Set language to en or zh to choose the message language, then run /memoryguard reload to apply the changes.
MemoryGuard shuts the server down normally, but it cannot restart Minecraft by itself. To restart automatically, enable restart-after-stop in your server hosting panel or startup script.
Compatibility
Compiled against the Paper API and intended for Paper and Purpur 1.20–26.3. Other Bukkit/Paper-based server software may work, but has not been individually tested and is not guaranteed to be compatible.
评论 0
登录后参与评分
还没有评论,来抢沙发吧