Skip to content

Commit d282d8c

Browse files
committed
fix: #13
1 parent 7f404e3 commit d282d8c

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

common/src/main/resources/assets/x-backup/lang/en_us.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"xb.button.backups_entry": "Manage world backups",
4646
"xb.button.delete_backup": "Delete Backup",
4747
"xb.button.restore_backup": "Restore Backup",
48+
"xb.gui.backups.restore_check_failed": "This backup is corrupted, cannot restore it!",
4849
"xb.gui.backups.restored": "Backup restored successfully!",
4950
"xb.gui.backups.title": "World Backups",
5051
"xb.gui.no_polylib": "PolyLib is not installed, please install it to use the GUI."

common/src/main/resources/assets/x-backup/lang/zh_cn.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"command.xb.backup_not_found": "未找到备份 %s",
1111
"command.xb.backup_ok": "备份 %s 正常",
1212
"command.xb.backup_uploaded": "备份 %s 已上传",
13-
"message.xb.error.free_plan_limit": "你已达到免费限额 (每个备份最多1GB, 总共 3 个备份),请升级到高级计划 https://redenmc.com/x-backup/plans",
1413
"command.xb.backups": "备份:",
1514
"command.xb.checking_backup": "正在检查备份 %s...",
1615
"command.xb.click_delete": "点击删除",
@@ -34,6 +33,7 @@
3433
"command.xb.status": "X Backup 状态: %s",
3534
"command.xb.uploading_backup": "正在上传备份 %s...",
3635
"command.xb.version": "X Backup %s https://github.com/zly2006/x-backup",
36+
"message.xb.error.free_plan_limit": "你已达到免费限额 (每个备份最多1GB, 总共 3 个备份),请升级到高级计划 https://redenmc.com/x-backup/plans",
3737
"message.xb.prune_finished": "清理完成,已删除 %s 个备份",
3838
"message.xb.pruning_backup": "正在清理旧备份 %s",
3939
"message.xb.running_prune": "正在清理...",
@@ -45,6 +45,7 @@
4545
"xb.button.backups_entry": "管理备份",
4646
"xb.button.delete_backup": "删除备份",
4747
"xb.button.restore_backup": "还原备份",
48+
"xb.gui.backups.restore_check_failed": "此备份已损坏,无法回档!",
4849
"xb.gui.backups.restored": "成功还原备份",
4950
"xb.gui.backups.title": "备份列表",
5051
"xb.gui.no_polylib": "未安装 PolyLib,请安装后使用 GUI 功能。"

src/main/kotlin/com/github/zly2006/xbackup/gui/BackupsGui.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ class BackupsGui(private val service: BackupDatabaseService, val worldRoot: Path
120120

121121
private fun restoreSelected(gui: ModularGui) {
122122
if (selected == null) return
123+
if (!service.check(selected!!)) {
124+
OptionDialog.simpleInfoDialog(
125+
gui,
126+
Text.translatable("xb.gui.backups.restore_check_failed")
127+
.formatted(Formatting.RED)
128+
)
129+
return
130+
}
123131
runBlocking {
124132
service.restore(selected!!.id, worldRoot) { false }
125133
}

0 commit comments

Comments
 (0)