Skip to content

Commit

Permalink
Merge pull request #28 from Ground-Hyper-Sky/dev
Browse files Browse the repository at this point in the history
修复了v1.6.0的恶性bug,在地狱或末地使用!!rb back回档不成功
  • Loading branch information
mc-doge666 authored Mar 24, 2024
2 parents a1d8eec + 02d64ad commit 6536f58
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion mcdreforged.plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "region_backup",
"version": "1.5.0",
"version": "1.6.1",
"name": "Region-BackUp",
"description": {
"en_us": "An MCDR plugin that backs up or backs up files on a regional basis",
Expand Down
27 changes: 16 additions & 11 deletions region_backup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#sc=!!rb abort<>st=点击运行指令#§7{0} abort §a§l[▷] §e在任何时候键入此指令可中断回档
#sc=!!rb list<>st=点击运行指令#§7{0} list §a§l[▷] §e显示各槽位的存档信息
#sc=!!rb reload<>st=点击运行指令#§7{0} reload §a§l[▷] §e重载插件
'''.format(Prefix, "Region BackUp", "1.6.0")
'''.format(Prefix, "Region BackUp", "1.6.1")


def print_help_msg(source: CommandSource):
Expand Down Expand Up @@ -493,33 +493,37 @@ def on_server_stop(server: PluginServerInterface, server_return_code: int):

else:

lst = [i for i in os.listdir(os.path.join(path_)) if os.path.isdir(os.path.join(path_, i))]

dim_name = dim_path[0] if dim_path[0] in dim_dict.values() else ""

if back_slot != "overwrite":

for i in dim_path:
for i in lst:
os.makedirs(overwrite_path + f"/{i}")

for backup_file in dim_path:
for backup_file in lst:
if get_file_size([os.path.join(path_, backup_file)])[-1]:
lst = os.listdir(os.path.join(path_, backup_file))
for i in lst:
lst_ = os.listdir(os.path.join(path_, backup_file))
for i in lst_:
# 复制即将被替换的区域到overwrite
shutil.copy2(os.path.join(world_path, backup_file, i),
shutil.copy2(os.path.join(world_path,dim_name, backup_file, i),
os.path.join(overwrite_path, backup_file, i))
# 将备份的区域对存档里对应的区域替换
shutil.copy2(os.path.join(path_, backup_file, i),
os.path.join(world_path, backup_file, i))
os.path.join(world_path, dim_name, backup_file, i))
# 复制本次回档槽位的info文件到overwrite
shutil.copy2(os.path.join(path_, "info.json"),
os.path.join(overwrite_path, "info.json"))

else:
for backup_file in dim_path:
for backup_file in lst:
if get_file_size([os.path.join(path_, backup_file)])[-1]:
lst = os.listdir(os.path.join(path_, backup_file))
for i in lst:
lst_ = os.listdir(os.path.join(path_, backup_file))
for i in lst_:
# 将备份的区域对存档里对应的区域替换
shutil.copy2(os.path.join(path_, backup_file, i),
os.path.join(world_path, backup_file, i))
os.path.join(world_path, dim_name, backup_file, i))

back_slot = None

Expand Down Expand Up @@ -712,6 +716,7 @@ def rename_slot():


def copy_files(valid_pos, data):

if data in dim_dict:
path = os.path.join(world_path, dim_dict[data])

Expand Down

0 comments on commit 6536f58

Please sign in to comment.