Snapback
备份是简单的那一半。这个插件负责另一半。
一条命令即可将服务器回滚至任意备份。免费,无依赖,无推销。
为什么需要另一个备份插件
制作存档已经是成熟的技术。有很多插件可以做到这一点,其中不少还是免费的。
问题出在恢复上。世界被破坏,或者插件更新吃掉了玩家数据,现在已是午夜,你不得不停止服务器,寻找正确的 zip 文件,手动解压它,祈祷你把文件夹放回了原来的位置——并且更祈祷你没有漏掉任何一个。
Snapback 帮你完成了这部分工作,并且只在它真正能起作用的那一刻执行。
恢复机制及其设计原因
当服务器运行时,无法恢复世界文件。 服务器会占用这些文件:在 Windows 上根本无法覆盖它们;在 Linux 上,下一次自动保存会将内存中的世界重新写入磁盘,从而擦除你解压的内容。任何试图通过命令解压存档的插件都在与这一机制对抗,并且无声地失败。
因此,决策和工作被分开处理:
/backup restore <file>— 显示将会发生什么:涉及多少文件、哪种模式、你会丢失什么。不更改任何内容。/backup restore <file> confirm— 将当前状态归档为before-restore-*.zip,写入标记,然后停止服务器。- 启动服务器。 恢复过程在
onLoad中运行——这是插件生命周期中发生在世界加载之前的唯一时刻。 /backup restore cancel— 改变主意了?清除标记。
单个世界或单个玩家
当只有一个玩家丢失了物品栏,或者只有一个世界在被破坏而其他玩家仍在其他世界中建造时,完全回滚并不是合适的工具。
/backup restore <file> world <name>— 仅恢复该世界。其他世界、插件和设置保持不变。/backup restore <file> player <name>— 仅恢复该玩家的文件:物品栏、位置、进度、统计数据。其他人不会丢失任何东西。可以使用 UUID 代替名称。 世界文件不会被触碰,因此玩家在备份后掉落、放入箱子或送出的物品仍留在原位——并且也会出现在玩家的物品栏中。预览功能会对此发出警告。
相同的预览、相同的安全副本、相同的重启流程——只是影响范围更小。
防止回滚加剧问题的措施
恢复本身具有破坏性。每一项防护措施都是针对特定的错误场景设计的:
- 首先创建安全副本。 恢复点之后的所有内容即将消失。
before-restore-*.zip捕获当前状态,并从keep-last轮换中排除,因此更多的备份不会将其删除。 - 插件 jar 包不回滚。 将世界回滚一周几乎从不意味着希望将所有插件也降级一周——包括本插件。默认关闭,需通过一项设置启用。
- 备份文件夹永远不会被触碰。 否则,一次恢复操作可能会删除正在读取的存档。
- 检查存档条目是否存在路径穿越漏洞。 包含
../../的恶意 zip 文件无法写入你的服务器文件夹之外——在检查存档和解压时都会进行检查。 - 标记仅在成功时清除。 重复解压同一个存档是无害的;但如果在失败的恢复中遗留了一个未清除的标记,就会导致世界丢失。如果存档不可读,标记会被重命名,服务器会在当前文件上启动。
备份功能
- Paper、Purpur 和 Folia —— 一个 jar 包,在这三个服务端上行为一致
- 定时或手动 —— 设置分钟数作为间隔,或设为
0以仅使用/backup run - 自动发现世界 —— 无需维护与世界名称同步的列表
keep-last—— 自动清理旧存档- 可用空间检查 —— 如果备份空间不足,会在开始前拒绝,而不是填满磁盘
- 重新读取服务器仍在写入的文件,而非复制半写文件;如果一个文件持续变化,备份记录会说明情况
skip-if-no-activity—— 如果自上次备份以来没有人上线,则跳过定时备份include/exclude—— 自定义包含或排除任何内容。默认情况下已排除session.lock、日志和缓存- 压缩级别 0–9
- 聊天通知 —— 向持有
snapback.notify权限的玩家发送通知 - Discord 通知 —— 当备份完成或失败时,通过 webhook 发布到频道(可选)
在复制开始前,会通过服务器 API 告知服务器将世界刷盘并停止写入(日志中不会出现 save-off 刷屏),并且之后自动保存会恢复到确切的状态——始终如此,即使存档失败也是如此。跳过这一步会导致存档中出现半写的区域文件,直到你需要它的那一天才会发现问题。
打包在主线程之外运行,因此大型世界不会冻结服务器上的所有人。
命令
| 命令 | 作用 |
|---|---|
/backup run |
立即备份 |
/backup list |
显示存档大小和年龄 |
/backup status |
距离下次定时备份的时间 |
/backup restore <file> |
预览回滚 —— 不更改任何内容 |
/backup restore <file> confirm |
创建安全副本,然后停止服务器 |
/backup restore <file> world <name> [confirm] |
回滚单个世界 |
/backup restore <file> player <name> [confirm] |
回滚单个玩家 |
/backup restore cancel |
取消预定的回滚 |
/backup reload |
重新读取 config.yml |
权限:snapback.use, snapback.notify, snapback.restore, snapback.reload —— 默认均为 op。
配置
restore:
# 在回滚前将当前状态归档为 before-restore-*.zip。
# 它会被排除在 keep-last 轮换之外。
safety-copy: true
# 是否从存档中覆盖插件 jar 包。
# 默认关闭:到恢复时,服务器已经打开了这些文件,
# 并且将世界回滚很少意味着也要将所有插件回滚。
replace-plugin-jars: false
true - 用存档中的世界文件夹完全替换当前的(即真正的回滚)
false - 将文件覆盖到当前文件上;备份中缺失的区块保持现状,形成两种状态的混合
默认关闭:删除世界文件夹的操作无法撤销。
clean-worlds: false
配置文件中每条消息都有对应的文本。自带俄语翻译文件 `config-ru.yml`,会在首次启动时与你的配置文件放在同一目录下——替换该文件,重启服务器即可。
## Discord 通知
Snapback 可以通过 Webhook 在每次备份成功或失败时向 Discord 频道发送一条消息。无需邀请机器人、无需登录、无需额外的服务器权限——只需一个 URL。
1. 在 Discord 中:打开目标频道,点击齿轮图标(**编辑频道**)→ **集成** → **Webhooks** → **新建 Webhook** → **复制 Webhook URL**。
2. 打开 `plugins/Snapback/config.yml`,找到 `discord` 部分,设置 `enabled: true`,并将 URL 粘贴到 `webhook-url` 中。
3. 重启服务器,或运行 `/reload confirm`。
```yaml
discord:
enabled: false
webhook-url: ""
notify-success: true
notify-failure: true
你可以通过 notify-success / notify-failure 关闭某一类通知,例如如果你只关心失败情况(或只关心成功情况)。请将 Webhook URL 视为密码对待——任何拥有它的人都能向该频道发送消息。
要求
- Paper、Purpur 或 Folia,版本 1.21.4 – 1.21.11 和 26.1 – 26.2 —— 单个 JAR 文件兼容所有这些版本
- Java 21 或更高版本
- 无依赖项
不包含的功能
- 不支持云上传。 仅本地副本——不支持 S3、Google Drive 或 FTP。如果磁盘损坏,备份也会随之丢失。这是诚实的局限性,也是同时保留服务器外备份的主要原因。
- 不支持增量备份——每个存档都是完整副本
- 不备份外部数据库
为什么免费
因为现有的备份插件已经有不错的免费选项,而付费版必须在发布第一天就明显优于所有其他选项才能成立。这是首个发行版本:我更希望它在真实服务器上运行,并收集哪些功能会出现问题。
欢迎提交 Bug 报告,且会优先处理。提供配置文件和相关日志行的报告修复速度最快。
Snapback
Backups are the easy half. This one does the other half.
Roll your server back to any backup with one command. Free, no dependencies, no upsell.
Why another backup plugin
Making archives is a solved problem. Plenty of plugins do it, several of them for free.
Restoring is where it falls apart. A world gets griefed, or a plugin update eats your player data, and now it is midnight and you are stopping the server, hunting for the right zip, unpacking it by hand, hoping you put the folders back exactly where they came from — and hoping harder that you did not miss one.
Snapback does that part for you, and does it at the only moment it can actually work.
The restore, and why it is built this way
While the server is running, a world cannot be restored. The server holds those files open: on Windows you cannot overwrite them at all, and on Linux the next autosave writes the world back out of memory and erases whatever you unpacked. Any plugin that unzips an archive on command is fighting that, and losing quietly.
So the decision and the work are split apart:
/backup restore <file>— shows what would happen: how many files, which mode, what you would lose. Changes nothing./backup restore <file> confirm— archives the current state asbefore-restore-*.zip, writes a marker, stops the server.- You start the server. The restore runs in
onLoad— the one point in the plugin lifecycle that happens before the worlds are loaded. /backup restore cancel— changed your mind, marker gone.
One world, or one player
A full rollback is the wrong tool when one player lost an inventory, or one world got griefed while everyone kept building in the others.
/backup restore <file> world <name>— only that world comes back. Other worlds, plugins and settings stay as they are./backup restore <file> player <name>— only that player's files: inventory, position, advancements, stats. Nobody else loses anything. A UUID works in place of the name. The world is not touched, so items the player dropped, put in chests or gave away after the backup stay where they are — and come back in the inventory too. The preview warns about it.
Same preview, same safety copy, same restart — just a smaller blast radius.
What stops a rollback from making things worse
A restore is itself destructive. Each guard exists because of a specific way this goes wrong:
- A safety copy first. Everything after the backup you are restoring is about to disappear.
before-restore-*.zipcaptures the current state and is excluded fromkeep-lastrotation, so a few more backups cannot delete it. - Plugin jars are not rolled back. Rolling a world back a week almost never means wanting every plugin downgraded a week with it — including this one. Off by default, one setting to enable.
- The backups folder is never touched. Otherwise a restore could delete the archive it is reading from.
- Archive entries are checked for path escapes. A crafted zip containing
../../cannot write outside your server folder — checked when the archive is inspected, and again while unpacking. - The marker is only cleared on success. Unpacking the same archive twice is harmless; a forgotten marker on a failed restore is a lost world. An unreadable archive gets the marker renamed, and the server starts on your current files.
Backups
- Paper, Purpur and Folia — one jar, the same behaviour on all three
- Scheduled or manual — an interval in minutes, or
0for/backup runonly - Worlds found automatically — no list of world names to keep in sync
keep-last— old archives removed automatically- Free space check — a backup that would not fit is refused up front instead of filling the disk
- Files the server is still writing are re-read, not copied half-written; if one keeps changing, the backup says so
skip-if-no-activity— no scheduled backup when nobody has been online since the last oneinclude/exclude— anything else you want, and anything you don't.session.lock, logs and caches are excluded out of the box- Compression level 0–9
- Chat notifications for anyone holding
snapback.notify - Discord notifications — post to a channel via webhook when a backup completes or fails (optional)
The server is told to flush the world to disk and stop writing before the copy starts (through the server API — no save-off spam in the log), and autosave goes back to exactly what it was afterwards — always, including when the archive fails. Skip that and you get half-written region files in an archive that looks fine until the day you need it.
Packing runs off the main thread, so a large world does not freeze everyone on the server.
Commands
| Command | What it does |
|---|---|
/backup run |
Back up now |
/backup list |
Archives with size and age |
/backup status |
Time until the next scheduled backup |
/backup restore <file> |
Preview a rollback — changes nothing |
/backup restore <file> confirm |
Safety copy, then stop the server |
/backup restore <file> world <name> [confirm] |
Roll back one world |
/backup restore <file> player <name> [confirm] |
Roll back one player |
/backup restore cancel |
Cancel a scheduled rollback |
/backup reload |
Re-read config.yml |
Permissions: snapback.use, snapback.notify, snapback.restore, snapback.reload — all default to op.
Configuration
restore:
# Archive the current state before rolling back, as before-restore-*.zip.
# It is excluded from keep-last rotation.
safety-copy: true
# Whether to overwrite plugin jars from the archive.
# Off by default: by restore time the server has already opened them,
# and rolling a world back rarely means rolling every plugin back too.
replace-plugin-jars: false
# true - world folders from the archive replace the current ones entirely
# (a true rollback)
# false - files are laid over the current ones; chunks missing from the
# backup stay as they are now, leaving a mix of two states
# Off by default: deleting a world folder cannot be undone.
clean-worlds: false
Every message is in the config. A Russian translation ships as config-ru.yml and lands next to your config on first start — swap the file, restart, done.
Discord notifications
Snapback can post a message to a Discord channel every time a backup finishes or fails, using a webhook. No bot to invite, no login, no extra server permissions — just a URL.
- In Discord: open the channel, click the gear icon (Edit Channel) → Integrations → Webhooks → New Webhook → Copy Webhook URL.
- Open
plugins/Snapback/config.yml, find thediscordsection, setenabled: trueand paste the URL intowebhook-url. - Restart the server, or run
/reload confirm.
discord:
enabled: false
webhook-url: ""
notify-success: true
notify-failure: true
notify-success / notify-failure let you turn off one type of notification if you only care about failures (or only successes). Treat the webhook URL like a password — anyone who has it can post messages to that channel.
Requirements
- Paper, Purpur or Folia, 1.21.4 – 1.21.11 and 26.1 – 26.2 — one jar for all of them
- Java 21 or newer
- No dependencies
What is not in it
- No cloud upload. Local copies only — no S3, Google Drive or FTP. If your disk dies, they die with it. This is the honest limitation, and the main reason to also keep an off-server backup.
- No incremental backups — every archive is a full copy
- No backup of external databases
Why free
Because backup plugins already have good free options, and a paid one would have to be clearly better than all of them on day one. This is a first release: I would rather have it running on real servers and hear what breaks.
Bug reports are welcome and get priority. A report with your config and the relevant log lines gets fixed fastest.
下载 Snapback
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Snapback
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Snapback
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Snapback
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Snapback
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Snapback
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Snapback
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Snapback
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Snapback
下载 Snapback
- 新增:
/backup info <file>显示备份内容——大小、文件数量、游戏版本、世界 - 新增:
/backup verify <file>读取归档至末尾并校验每个校验和,以便你在需要时确认备份完好。verify-after-backup: true会自动对每次新创建的备份执行相同操作 - 新增:
/backup status现在还会显示最近一次备份的信息、所有备份占用的空间以及剩余磁盘空间 - 新增:
/backup help。当子命令未知时,将返回来自config.yml的命令列表,而非固定的英文用法提示行 - 新增:Discord 消息文本位于
config.yml(messages: discord-...),支持翻译。修复:错误文本中的特殊字符可能导致 Discord 拒绝发送消息 - 配置:新增一项设置(
verify-after-backup,默认关闭)以及上述命令的新消息。旧的config.yml仍可使用——未指定的项将使用默认值
- 新增:更长的备份历史记录。
keep-daily和keep-weekly在保留keep-last的基础上,分别每天保留一个备份、每周保留一个备份。示例:keep-last: 5、keep-daily: 7、keep-weekly: 4会保留最近几小时的备份、过去一周中每天的备份以及过去一个月中每周的备份 - 新增:按一天中的固定时间进行备份——
schedule-at: ["04:00", "16:00"]。与间隔模式不同,这些备份在重启后不会发生漂移,因此重要备份仍会安排在非高峰时段进行。可与interval-minutes配合使用,或替代它(设置interval-minutes: 0) - 新增:
restore.keep-safety-copies用于限制保留多少个before-restore-*.zip归档文件。默认关闭——即像以前一样保留所有文件 /backup status命令及启动日志会显示来自任一调度计划的最近一次备份- 配置:新增四个设置项(
schedule-at、keep-daily、keep-weekly、restore.keep-safety-copies),默认均为关闭状态。旧的config.yml配置文件仍可正常工作,行为与之前完全一致
- 新增:回滚单个世界 ——
/backup restore <file> world <name> confirm。其他世界、插件和服务端配置保持不变 - 新增:回滚单个玩家 ——
/backup restore <file> player <name> confirm。仅恢复该玩家的文件(物品栏、位置、进度、统计数据);世界和其他玩家的进度不受影响。可使用 UUID 代替名称 - 两者均会先显示预览,创建相同的安全备份副本,并在下次服务端启动时执行,与完整回滚行为一致。支持旧版世界结构(1.21.x)和最新版本(26.1+)
- 玩家回滚不会影响世界数据,因此玩家在备份之后丢弃的物品、存入箱子或送出的物品仍保留在原处,并会重新出现在其物品栏中。确认前,预览信息会以红色提示此情况
- Tab 补全功能会列出所选存档中实际存在的世界,以及当前在线的玩家
- 配置文件:新增六条消息(
restore-preview-world、restore-preview-player、restore-preview-player-items、restore-world-unknown、restore-player-unknown、restore-player-absent),restore-usage现在列出了新的命令格式。旧的 config.yml 仍可正常工作——将使用默认值
- 新增:支持 Folia。计划备份、
/backup run命令和回滚功能现在可在 Folia 上运行(已在 Folia 1.21.11 和 26.2 版本中测试)。同一个 jar 文件可同时兼容 Paper、Purpur 和 Folia - 新增:服务器仍在写入的文件不再被复制为不完整状态。对于最近几秒内发生更改的文件,将通过临时副本读取并反复重新读取,直到其停止变化;如果服务器持续对该文件进行写入操作,备份过程会明确提示这一情况,而不会保持沉默
- 变更:世界数据的保存和自动保存的暂停改为通过服务器 API 实现,而非使用
save-all、save-off和save-on控制台命令。每次备份额外输出的三行日志已移除 - 修复:如果你手动关闭了自动保存(执行过
save-off),备份完成时会自动将其重新开启。现在,每个世界的先前状态会在备份结束后按原样恢复 - 配置:新增一条消息(
finished-with-changes)。旧的 config.yml 配置文件仍可正常工作——未指定时将使用默认值
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
插件
PacketEvents 是一款专为 Minecraft Java 版打造的协议库,旨在简化数据包的处理与传输。
插件
ExyliaPlugins 的库。
插件
通过对话框或铁砧界面帮助你的 Anthme
插件
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
插件
为基于 Spigot/Paper/Folia 的服务器添加对 Vivecraft 的支持
插件
用于绘制游戏内地图或在浏览器中随探索实时进行地图绘制的实时地图。
评论 0
登录后参与评分
还没有评论,来抢沙发吧