特性
-
计划自动备份:可配置的备份间隔,默认 60 分钟
-
基于时间的备份模式:在指定时区的特定时间触发备份(支持 24/12 小时格式)
-
手动触发备份:通过命令立即执行备份
-
启动时备份:服务器启动时自动执行备份(可选)
-
热备份:异步执行,不阻塞主线程
-
世界保存控制:备份前保存世界数据,备份期间暂停自动保存以防止数据不一致
-
压缩备份:支持将备份文件压缩为 zip 格式以节省磁盘空间
-
备份文件管理:自动清理旧备份,保留指定数量的最新备份(手动上传至 GitHub 后也会进行清理)
-
多云存储上传:支持本地目录、FTP/FTPS、WebDAV、百度网盘、123 网盘
-
GitHub 备份:通过 GitHub Release API 上传/下载备份,支持自动创建私有仓库
-
告警通知:备份失败时通过电子邮件、飞书机器人、钉钉机器人发送告警
-
备份还原:从指定的备份中恢复世界数据(将重新加载世界)
-
热重载配置:无需重启服务器即可重新加载配置文件
-
状态查询:查看插件状态与调度器信息
安装
- 下载最新的
PluralBackupJava-1.0.0.jar
- 将 jar 文件放入服务器的
plugins/ 目录中
- 启动服务器,插件将在
plugins/PluralBackup/config.yml 自动生成默认配置文件
- 根据需要编辑配置文件
- 执行
/backup reload 或重启服务器以应用更改
命令
所有命令都需要 pluralbackup.admin 权限(默认:OP)。
| 命令 |
说明 |
/backup now |
立即执行备份 |
/backup list |
列出所有备份 |
/backup restore <备份名称> |
恢复指定的备份 |
/backup clean |
清理旧备份 |
/backup reload |
重新加载配置文件 |
/backup status |
查看插件状态 |
/backup github-list |
列出 GitHub 上的备份版本 |
| /backup github-download <版本> | 从 GitHub 下载指定版本 |
| /backup github-upload | 备份服务器并上传至 GitHub |
别名:/pbackup、/pluralbackup
配置
配置文件位于 plugins/PluralBackup/config.yml:
# 基本备份设置
backup:
auto-backup: true # 启用自动备份(间隔模式)
interval-minutes: 60 # 备份间隔(分钟,仅适用于间隔模式)
backup-on-start: false # 在服务器启动时执行备份
broadcast-message: true # 广播备份消息
# 计划备份(基于时间的触发,独立于间隔模式,可与间隔模式同时启用)
schedule:
enabled: false # 启用基于时间的模式
timezone: "Asia/Shanghai" # 触发时区,例如 Asia/Shanghai、America/New_York、Europe/London
use-24-hour-format: true # 使用 24 小时制(false 表示使用带有上午/下午的 12 小时制)
times: # 触发时间列表
- "00:00" # 24 小时制示例:["00:00", "06:00", "12:00", "18:00"]
- "12:00" # 12 小时制示例:["12:00 AM", "06:00 AM", "12:00 PM", "06:00 PM"]
backup-dir: "backups" # 备份目录(相对于插件数据文件夹)
max-backups: 10 # 最大备份数量(0 = 无限制)
compress: true # 压缩为 zip 格式
exclude-dirs: # 排除的目录(相对于服务器根目录)
- "plugins/PluralBackup/backups"
# 备份行为
save-world-before-backup: true # 在备份前保存所有世界
pause-autosave-during-backup: true # 在备份期间暂停自动保存
file-copy-retry-count: 3 # 文件复制重试次数
file-copy-retry-delay-ms: 500 # 重试延迟(毫秒)
# 云上传
cloud:
enabled: false
type: "local" # local / ftp / webdav / baidu / pan123
local:
path: "cloud-backups"
ftp:
host: "127.0.0.1"
port: 21
username: "ftpuser"
password: "ftppass"
remote-dir: "/backups"
use-ssl: false
webdav:
url: "https://dav.example.com/backups"
username: "user"
password: "pass"
# 百度网盘 (https://pan.baidu.com/union/console)
baidu:
app-id: ""
app-secret: ""
app-folder: "" # 产品名称,文件存储在 /我的应用数据/{app-folder}/ 下
access-token: "" # 留空以自动获取并缓存
# 123云盘 (https://www.123pan.cn/developer)
pan123:
client-id: ""
client-secret: ""
access-token: "" # 留空以自动获取并缓存
parent-folder-id: 0 # 目标文件夹 ID,0 表示根目录
警报通知
notification:
enabled: false # 启用备份失败通知
邮件通知
email:
enabled: false
smtp-host: "" # 例如 smtp.qq.com
smtp-port: 465
use-ssl: true
username: "" # 发送者登录账号
password: "" # 授权码(QQ 邮箱需要授权码)
from: "" # 发件人邮箱
to: "" # 收件人邮箱
subject: "PluralBackup 备份警报"
飞书机器人
feishu:
enabled: false
webhook: "" # 自定义机器人 Webhook
secret: "" # 签名密钥(如果不使用签名则留空)
钉钉机器人
dingtalk:
enabled: false
webhook: "" # 自定义机器人 Webhook
secret: "" # 签名密钥(如果不使用签名则留空)
GitHub 备份
github:
enabled: false
token: "your-github-token" # 具有仓库权限的 PAT
owner: "your-username"
repo: "PluralGamneBackup"
auto-create-repo: true # 如果不存在则自动创建私有仓库
消息设置
backup-start-message: "§e[备份] §b服务器正在执行自动备份..."
backup-done-message: "§e[备份] §a备份完成!耗时:{time}s"
backup-fail-message: "§e[备份] §c备份失败:{error}"
## GitHub 备份说明
1. 创建具有 `repo` 权限的 GitHub 个人访问令牌,建议不设过期时间
2. 在配置文件中配置 `token`、`owner`、`repo`
3. 启用 `github.enabled: true`
4. 如果仓库不存在则自动创建私有仓库(需设置 `auto-create-repo: true`)
5. 空仓库会自动初始化(写入 README.md),否则 Release 创建将失败
6. 备份文件以 Release Assets 形式上传,单个文件大小限制为 2GB
7. GitHub 定时备份与本地备份共享 `interval-minutes` 设置
8. 所有网络操作(上传/下载)均异步执行,不阻塞主线程
9. 手动执行 `/backup github-upload` 将自动清理本地旧备份(受 `max-backups` 限制)
## 双模式定时备份
插件支持两种独立的触发模式,可同时启用:
**1. 间隔模式** (`backup.auto-backup: true` + `backup.interval-minutes: 60`)
- 每隔 N 分钟执行一次备份
- 适用于高频备份场景
**2. 基于时间的模式** (`backup.schedule.enabled: true`)
- 在指定时区的特定时间执行备份
- 支持自定义时区(例如 `Asia/Shanghai`、`America/New_York`、`Europe/London`)
- 支持 24 小时制格式(`HH:mm`,例如 `00:00`、`12:00`、`18:30`)
- 支持 12 小时制格式(`hh:mm a`,例如 `12:00 AM`、`06:00 PM`)
- 可配置多个触发时间
两种模式可同时启用且互不冲突。示例:间隔模式每小时备份一次,基于时间的模式在每天 00:00 和 12:00 额外增加备份。
## 权限
| 权限 | 默认值 | 描述 |
|------------|---------|-------------|
| `pluralbackup.admin` | OP | 使用所有备份管理命令 |
## 构建
```bash
mvn clean package
生成的 jar 文件位于 target/PluralBackupJava-1.0.0.jar。
许可证
Copyright © PluralTeam
Features
- Scheduled Automatic Backup: Configurable backup interval, default 60 minutes
- Time-Based Backup Mode: Trigger backups at specific times in a specified timezone (supports 24/12-hour format)
- Manual Backup Trigger: Execute backup immediately via command
- Startup Backup: Auto-execute backup on server start (optional)
- Hot Backup: Asynchronous execution, non-blocking main thread
- World Save Control: Save worlds before backup, pause autosave during backup to prevent data inconsistency
- Compressed Backup: Support compressing backups as zip format to save disk space
- Backup File Management: Auto-clean old backups, keep specified count of recent backups (also cleans after manual GitHub upload)
- Multi-Cloud Upload: Local directory, FTP/FTPS, WebDAV, Baidu Netdisk, 123 Cloud
- GitHub Backup: Upload/download backups via GitHub Release API, supports auto-creation of private repository
- Alert Notifications: Send alerts via Email, Lark bot, DingTalk bot on backup failure
- Backup Restore: Restore world data from specified backup (will reload worlds)
- Hot Config Reload: Reload config without server restart
- Status Query: View plugin status and scheduler info
Installation
- Download the latest
PluralBackupJava-1.0.0.jar
- Place the jar file in the server's
plugins/ directory
- Start the server, the plugin will auto-generate default config at
plugins/PluralBackup/config.yml
- Edit the config file as needed
- Execute
/backup reload or restart the server to apply changes
Commands
All commands require pluralbackup.admin permission (default: OP).
| Command |
Description |
/backup now |
Execute a backup immediately |
/backup list |
List all backups |
/backup restore <backup-name> |
Restore specified backup |
/backup clean |
Clean old backups |
/backup reload |
Reload configuration file |
/backup status |
View plugin status |
/backup github-list |
List backup versions on GitHub |
/backup github-download <version> |
Download specified version from GitHub |
/backup github-upload |
Backup server and upload to GitHub |
Aliases: /pbackup, /pluralbackup
Configuration
Config file located at plugins/PluralBackup/config.yml:
# Basic Backup Settings
backup:
auto-backup: true # Enable automatic backup (interval mode)
interval-minutes: 60 # Backup interval in minutes (interval mode only)
backup-on-start: false # Execute backup on server start
broadcast-message: true # Broadcast backup messages
# Scheduled backup (time-based trigger, independent from interval mode, can be enabled together)
schedule:
enabled: false # Enable time-based mode
timezone: "Asia/Shanghai" # Trigger timezone, e.g. Asia/Shanghai, America/New_York, Europe/London
use-24-hour-format: true # Use 24-hour format (false for 12-hour format with AM/PM)
times: # Trigger times list
- "00:00" # 24-hour examples: ["00:00", "06:00", "12:00", "18:00"]
- "12:00" # 12-hour examples: ["12:00 AM", "06:00 AM", "12:00 PM", "06:00 PM"]
backup-dir: "backups" # Backup directory (relative to plugin data folder)
max-backups: 10 # Maximum backup count (0 = unlimited)
compress: true # Compress as zip
exclude-dirs: # Excluded directories (relative to server root)
- "plugins/PluralBackup/backups"
# Backup Behavior
save-world-before-backup: true # Save all worlds before backup
pause-autosave-during-backup: true # Pause autosave during backup
file-copy-retry-count: 3 # File copy retry count
file-copy-retry-delay-ms: 500 # Retry delay in milliseconds
# Cloud Upload
cloud:
enabled: false
type: "local" # local / ftp / webdav / baidu / pan123
local:
path: "cloud-backups"
ftp:
host: "127.0.0.1"
port: 21
username: "ftpuser"
password: "ftppass"
remote-dir: "/backups"
use-ssl: false
webdav:
url: "https://dav.example.com/backups"
username: "user"
password: "pass"
# Baidu Netdisk (https://pan.baidu.com/union/console)
baidu:
app-id: ""
app-secret: ""
app-folder: "" # Product name, files stored at /我的应用数据/{app-folder}/
access-token: "" # Leave empty for auto-fetch and cache
# 123 Cloud (https://www.123pan.cn/developer)
pan123:
client-id: ""
client-secret: ""
access-token: "" # Leave empty for auto-fetch and cache
parent-folder-id: 0 # Target folder ID, 0 for root
# Alert Notifications
notification:
enabled: false # Enable backup failure notifications
# Email notification
email:
enabled: false
smtp-host: "" # e.g. smtp.qq.com
smtp-port: 465
use-ssl: true
username: "" # Sender login account
password: "" # Authorization code (QQ Mail requires auth code)
from: "" # Sender email
to: "" # Recipient email
subject: "PluralBackup Backup Alert"
# Lark bot
feishu:
enabled: false
webhook: "" # Custom bot Webhook
secret: "" # Signing secret (leave empty if not using signature)
# DingTalk bot
dingtalk:
enabled: false
webhook: "" # Custom bot Webhook
secret: "" # Signing secret (leave empty if not using signature)
# GitHub Backup
github:
enabled: false
token: "your-github-token" # PAT with repo permission
owner: "your-username"
repo: "PluralGamneBackup"
auto-create-repo: true # Auto-create private repo if not exists
# Message Settings
backup-start-message: "§e[Backup] §bServer is performing automatic backup..."
backup-done-message: "§e[Backup] §aBackup complete! Time: {time}s"
backup-fail-message: "§e[Backup] §cBackup failed: {error}"
GitHub Backup Instructions
- Create GitHub Personal Access Token with
repo permission, recommend no expiration
- Configure
token, owner, repo in config file
- Enable
github.enabled: true
- Private repo auto-created if not exists (requires
auto-create-repo: true)
- Empty repo auto-initialized (README.md written), otherwise Release creation fails
- Backup files uploaded as Release Assets, single file limit 2GB
- GitHub scheduled backup shares
interval-minutes with local backup
- All network operations (upload/download) execute asynchronously, non-blocking main thread
- Manual
/backup github-upload will auto-clean local old backups (subject to max-backups limit)
Dual-Mode Scheduled Backup
The plugin supports two independent trigger modes that can be enabled simultaneously:
1. Interval Mode (backup.auto-backup: true + backup.interval-minutes: 60)
- Execute backup every N minutes
- Suitable for high-frequency backup scenarios
2. Time-Based Mode (backup.schedule.enabled: true)
- Execute backup at specific times in a specified timezone
- Supports custom timezone (e.g.
Asia/Shanghai, America/New_York, Europe/London)
- Supports 24-hour format (
HH:mm, e.g. 00:00, 12:00, 18:30)
- Supports 12-hour format (
hh:mm a, e.g. 12:00 AM, 06:00 PM)
- Multiple trigger times configurable
Both modes can be enabled together without conflict. Example: interval mode backs up every hour, time-based mode adds extra backups at 00:00 and 12:00 daily.
Permissions
| Permission |
Default |
Description |
pluralbackup.admin |
OP |
Use all backup management commands |
Build
mvn clean package
Generated jar file at target/PluralBackupJava-1.0.0.jar.
License
Copyright © PluralTeam
评论 0
登录后参与评分
还没有评论,来抢沙发吧