Skip to content

Commit

Permalink
v1.5.0: custom saved_world_keywords support
Browse files Browse the repository at this point in the history
for #28
  • Loading branch information
Fallen-Breath committed Dec 20, 2021
1 parent a5994ed commit 748e823
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,21 @@ mcd_root/

若文件名字符串以 `*` 结尾,则将忽略以指定字符串开头的文件,如 `temp*` 表示忽略所有以 `temp` 开头的文件,如 `tempfile`

### saved_world_keywords

默认值:

```
"saved_world_keywords": [
"Saved the game",
"Saved the world"
]
```

用于识别服务端已保存完毕存档的关键词

如果服务器的输出与任何一个关键词相符,则认为存档已保存完毕,随后插件将开始复制存档文件

### backup_path

默认值: `./qb_multi`
Expand Down
15 changes: 15 additions & 0 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,21 @@ If the name string starts with `*`, then it will ignore files with name ending w

If the name string ends with `*`, then it will ignore files with name starting with specific string, e.g. `temp*` makes all files starts with `temp` be ignored, like `tempfile`

### saved_world_keywords

Default:

```
"saved_world_keywords": [
"Saved the game",
"Saved the world"
]
```

Keywords for the plugin to consider if the server has saved the world

It is considered that the world has been saved if any keyword string equals to the server output, then the plugin will start copying the world files

### backup_path

Default: `./qb_multi`
Expand Down
2 changes: 1 addition & 1 deletion mcdreforged.plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "quick_backup_multi",
"version": "1.4.4",
"version": "1.5.0",
"name": "Quick Backup Multi",
"description": {
"en_us": "A backup / restore plugin, with multiple backup slot",
Expand Down
4 changes: 2 additions & 2 deletions quick_backup_multi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,9 @@ def print_help_message(source: CommandSource):
)


def on_info(server, info: Info):
def on_info(server: PluginServerInterface, info: Info):
if not info.is_user:
if info.content == 'Saved the game' or info.content == 'Saved the world':
if info.content in config.saved_world_keywords:
global game_saved
game_saved = True

Expand Down
4 changes: 4 additions & 0 deletions quick_backup_multi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class Configure(Serializable):
ignored_files: List[str] = [
'session.lock'
]
saved_world_keywords: List[str] = [
'Saved the game', # 1.13+
'Saved the world', # 1.12-
]
backup_path: str = './qb_multi'
server_path: str = './server'
overwrite_backup_folder: str = 'overwrite'
Expand Down

0 comments on commit 748e823

Please sign in to comment.