WorldSlim
通过自动清理玩家极少访问的区块,减小 Minecraft 世界文件大小。三层防御机制拦截了原本会被原版自动保存写入磁盘的数据。
功能介绍
现代 Minecraft(1.18+)会在比玩家视距更长的时间内保持区块加载状态,并且无论玩家是否活动,自动保存都会将它们全部写入磁盘。WorldSlim 钩入了该流程的每一层:
- ChunkUnloadListener — 当区块卸载时,如果
InhabitedTime( inhabitation time,生存时间/占用时间)较低,则拦截保存操作。 - AutosaveShield (2.0 新增) — 每 2 秒一次,预先清除已加载的低
InhabitedTime区块的脏标记(dirty flag),以便自动保存跳过它们。 - ChunkCleaner — 定期重写区域文件(region files),移除漏过前两层处理的区块。
玩家活动(放置方块、攻击生物、打开容器、拾取/丢弃物品)会将区块标记为“强制保存”,使其免受清理影响。
亮点
- 三层架构 — 卸载 + 自动保存 + 区域重写。激进但安全。
- 基于文件的 ChunkRegistry — 管理/强制保存状态存储在
plugins/WorldSlim/data/中,可存活于服务器重启以及 Leaf/Moonrise 对区块 PDC 的剥离。崩溃安全(丢失标记会降级为“勿动”)。 - 激进模式 (
cleanup.aggressive: true) — 恢复 1.0.6 之前的清理逻辑,在新生服务器上可实现 90% 以上的清理率。默认关闭以保护已有世界的建筑。 - 诊断工具 —
/worldslim diagnose查看运行时计数器,/worldslim scan检查任意区域文件的原始 NBT,/worldslim chunk查看你当前所在区块的完整决策树。 - 每日轮换的文件日志记录器,位于
plugins/WorldSlim/logs/,级别可配置。 - 配置迁移 (2.0.1 新增) — 升级时自动注入新字段,保留你的编辑和注释。
- 异步且有限制 — 所有磁盘操作均在主线程之外运行,并设有 5 秒超时,当服务器繁忙时安全跳过。
兼容性
| Server | PDC Persistence | Registry | AutosaveShield |
|---|---|---|---|
| Paper 1.21.x | Yes | Yes | Yes |
| Purpur 1.21.x | Yes | Yes | Yes |
| Folia 1.21.x | Yes | Yes | Partial |
| Leaves 1.21.x | Yes | Yes | Yes |
| Leaf 1.21.x | Stripped | Load-bearing | Limited |
需要 Minecraft 1.21.x 和 Java 21。
命令
| Command | Description |
|---|---|
/worldslim status |
显示插件状态和当前配置 |
/worldslim stats |
扫描/清理的区块总数及节省的空间 |
/worldslim chunk |
你当前所在区块的完整决策树 |
/worldslim cleanup |
立即执行一次清理 |
/worldslim diagnose [here] |
运行时诊断快照。附加 here 可查看当前区块详情 |
/worldslim scan |
解析当前区域文件的原始 NBT 并报告存活的标签 |
/worldslim reload |
重载 config.yml(同时运行配置迁移) |
/worldslim reset |
重置清理统计数据 |
支持别名 /ws。权限:修改类命令需 worldslim.admin;只读命令需 worldslim.use。
快速开始
- 将 jar 放入
plugins/目录,重启服务器。 - 默认配置较为保守(会保留任何看起来是预存在的区块)。大多数服务器无需额外配置即可正常运行。
- 在新生服务器上 — 设置
cleanup.aggressive: true以获得最佳清理率。 - 在已有建筑和内容的服务器上 — 保持
aggressive: false(默认值),让注册表追踪后续新增的区块。
配置亮点
# 区块生命周期阈值。低于此值的区块可能会被清理。
# 默认 1200 ticks = 60 秒。
min-inhabited-time: 1200
cleanup:
interval-minutes: 30
run-on-startup: false
# 1.0.6 之前的清理行为。强烈建议新生服务器使用。
aggressive: false
autosave-shield:
enabled: true
interval-ticks: 40 # 2s
logging:
file-enabled: true
level: INFO # DEBUG / INFO / WARN / ERROR
worlds:
enabled: [] # 若非空,则仅管理这些世界
disabled: [] # 始终跳过的世界
首次运行时生成包含所有注释的完整默认配置。
报告问题
请包含以下内容:
/worldslim diagnose的截图plugins/WorldSlim/logs/中的最新日志- 服务器类型和版本
WorldSlim
Reduce Minecraft world file size by automatically cleaning chunks that players barely visit. Three layers of defense catch what vanilla autosave would otherwise commit to disk.
What it does
Modern Minecraft (1.18+) keeps chunks loaded much longer than a player's view distance, and autosave writes them all to disk regardless of activity. WorldSlim hooks every layer of that pipeline:
- ChunkUnloadListener — when a chunk does unload, intercept the save if
InhabitedTimeis low. - AutosaveShield (new in 2.0) — every 2 seconds, pre-emptively clear the dirty flag on loaded low-
InhabitedTimechunks so autosave skips them. - ChunkCleaner — periodically rewrite region files, removing chunks that slipped through the first two layers.
Player activity (placing blocks, attacking mobs, opening containers, picking up / dropping items) marks chunks as "force-save" so they survive cleanup.
Highlights
- Three-layer architecture — unload + autosave + region rewrite. Aggressive without being unsafe.
- File-based ChunkRegistry — managed/force-save state stored in
plugins/WorldSlim/data/, survives server restarts and Leaf/Moonrise's chunk-PDC strip. Crash-safe (lost marks degrade to "leave it alone"). - Aggressive mode (
cleanup.aggressive: true) — restores the pre-1.0.6 cleanup logic, achieves 90%+ cleanup rate on fresh servers. Off by default to protect builds on established worlds. - Diagnostics —
/worldslim diagnosefor runtime counters,/worldslim scanfor raw-NBT inspection of any region file,/worldslim chunkfor full decision-tree of the chunk you're standing in. - Daily-rotating file logger at
plugins/WorldSlim/logs/, configurable level. - Config migration (new in 2.0.1) — new fields auto-injected on upgrade, preserving your edits and comments.
- Async + bounded — every disk operation runs off the main thread, with a 5-second timeout that safely skips when the server is busy.
Compatibility
| Server | PDC Persistence | Registry | AutosaveShield |
|---|---|---|---|
| Paper 1.21.x | Yes | Yes | Yes |
| Purpur 1.21.x | Yes | Yes | Yes |
| Folia 1.21.x | Yes | Yes | Partial |
| Leaves 1.21.x | Yes | Yes | Yes |
| Leaf 1.21.x | Stripped | Load-bearing | Limited |
Requires Minecraft 1.21.x and Java 21.
Commands
| Command | Description |
|---|---|
/worldslim status |
Show plugin status and active configuration |
/worldslim stats |
Total chunks scanned/cleaned and space saved |
/worldslim chunk |
Full decision tree for the chunk you're standing in |
/worldslim cleanup |
Run a cleanup pass immediately |
/worldslim diagnose [here] |
Runtime diagnostic snapshot. Append here for current-chunk details |
/worldslim scan |
Parse the current region file's raw NBT and report what tags survived |
/worldslim reload |
Reload config.yml (also runs config migration) |
/worldslim reset |
Reset cleanup statistics |
Aliased to /ws. Permission: worldslim.admin for mutating commands; worldslim.use for the read-only ones.
Quick start
- Drop the jar in
plugins/, restart. - Default config is conservative (preserves any chunks that look pre-existing). Works without configuration on most servers.
- On a fresh server — set
cleanup.aggressive: truefor the best cleanup rate. - On an established server with builds — leave
aggressive: false(default) and let the registry track new chunks going forward.
Configuration highlights
# Chunk lifetime threshold. Below this, chunks may be cleaned.
# Default 1200 ticks = 60 seconds.
min-inhabited-time: 1200
cleanup:
interval-minutes: 30
run-on-startup: false
# Pre-1.0.6 cleanup behavior. Highly recommended for fresh servers.
aggressive: false
autosave-shield:
enabled: true
interval-ticks: 40 # 2s
logging:
file-enabled: true
level: INFO # DEBUG / INFO / WARN / ERROR
worlds:
enabled: [] # if non-empty, ONLY these worlds are managed
disabled: [] # always-skipped worlds
Full default config (with all comments) is generated on first run.
Reporting issues
Please include:
/worldslim diagnosescreenshot- Latest log from
plugins/WorldSlim/logs/ - Server type and version
下载 WorldSlim
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 WorldSlim
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 WorldSlim
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 WorldSlim
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 WorldSlim
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 WorldSlim
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 WorldSlim
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 WorldSlim
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 WorldSlim
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
WorldSlim 2.0.1
次要版本更新。在 2.0.0 的基础上进行了生活质量改进。支持直接升级——从 2.0.0 升级无需任何手动操作。
两项聚焦于提升易用性的变更:配置文件跨版本自动更新,以及 /worldslim chunk 现在会详细解释每个区块被保留或删除的具体原因。
新增内容
配置迁移
在 config.yml 中添加了 config-version 字段。每次插件重载时,迁移程序会遍历 JAR 包内的默认配置,并将缺失的键值复制到本地磁盘的配置文件中。
- 用户编辑的值会被保留(例如你的
min-inhabited-time: 1500仍为1500) - 现有注释在加载和保存的往返过程中得以保留
- 新键会附带其默认注释一同出现
- 任何修改发生前,原始文件都会备份至
config.yml.bak.v<old> - 如果迁移因任何原因失败,系统会自动从备份中恢复原始文件
这意味着未来引入新配置项的更新(例如 v2.1 将添加 worlds.overrides)将无需手动编辑——在首次重新加载时,现有配置会自动追加这些新字段,并保留其默认值和文档说明。
/worldslim chunk — 完整决策树
之前的输出(一行“是否保留:是/否”)仅检查了 InhabitedTime,给出了误导性的结果。新的输出展示了影响清理决策的所有信号,以及四个与实际运行时行为一致的裁决:
=== 当前区块决策路径 ===
[123, -456] @ world
--- 状态信号 ---
managed (registry): yes
managed (PDC): no
pre-existing (PDC): no
force-save (registry): no
force-save (PDC): no
loaded (now): yes
InhabitedTime: 340 ticks (17s) < 1200 threshold
aggressive mode: OFF
--- 裁决结果 ---
> Current (loaded): KEEP (loaded chunks are always protected)
> Hypothetical unloaded, aggressive=OFF: DELETE (low InhabitedTime, no force-save, not loaded)
> Hypothetical unloaded, aggressive=ON: DELETE (low InhabitedTime, no force-save, not loaded)
> ChunkUnloadListener: BLOCK SAVE (low InhabitedTime, NMS unsaved=false)
该决策逻辑直接取自 ChunkCleaner.rewriteRegionFile 和 ChunkUnloadListener.onChunkUnload,因此此处展示的内容即为清理或卸载时实际会发生的情况。插件的实际聊天输出已本地化(2.0.x 版本为简体中文);上述结构与之一一对应。
兼容性
- 从 2.0.0 升级:无缝兼容。迁移仅添加
config-version: 2标记;由于 v2.0.0 已包含所有当前字段,其他内容均无变化。 - 从 1.x 升级:无缝兼容。迁移会自动注入
cleanup.aggressive、autosave-shield.*和logging.*及其默认值与注释。您的config.yml.bak.v1会保留原始文件的安全副本。 - 服务器端 Fork:与 2.0.0 保持一致——Paper / Purpur / Folia / Leaves / Leaf 1.21.x 均受支持。
需要 Minecraft 1.21.x 和 Java 21。
验证
在 Leaf 1.21.11 上进行了端到端测试,使用合成的 v1 配置(不含 config-version、aggressive、autosave-shield、logging):
| 检查项 | 结果 |
|---|---|
| 保留的 6 个用户编辑值 | 是 |
| 使用默认值注入缺失的 8 个字段 | 是 |
| 保留现有键上的注释 | 是 |
| 为新添加的键附加注释 | 是 |
备份写入 config.yml.bak.v1 |
是 |
/worldslim chunk 决策与 ChunkCleaner 运行时一致 |
是 |
报告问题
提交错误报告时,请包含:
/worldslim diagnose截图- 受影响区块的
/worldslim chunk输出 plugins/WorldSlim/logs/中的最新日志- 服务器类型及版本(Paper / Leaf / 等)
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
插件
PacketEvents 是一款专为 Minecraft Java 版打造的协议库,旨在简化数据包的处理与传输。
插件
ExyliaPlugins 的库。
插件
通过对话框或铁砧界面帮助你的 Anthme
插件
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
插件
为基于 Spigot/Paper/Folia 的服务器添加对 Vivecraft 的支持
插件
用于绘制游戏内地图或在浏览器中随探索实时进行地图绘制的实时地图。
评论 0
登录后参与评分
还没有评论,来抢沙发吧