diff --git a/README.md b/README.md index a974c40..520501c 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/README_en.md b/README_en.md index e233560..ef90311 100644 --- a/README_en.md +++ b/README_en.md @@ -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` diff --git a/mcdreforged.plugin.json b/mcdreforged.plugin.json index a659df5..7255d5c 100644 --- a/mcdreforged.plugin.json +++ b/mcdreforged.plugin.json @@ -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", diff --git a/quick_backup_multi/__init__.py b/quick_backup_multi/__init__.py index 81e27a5..60ce2eb 100644 --- a/quick_backup_multi/__init__.py +++ b/quick_backup_multi/__init__.py @@ -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 diff --git a/quick_backup_multi/config.py b/quick_backup_multi/config.py index d8dd4f0..419c384 100644 --- a/quick_backup_multi/config.py +++ b/quick_backup_multi/config.py @@ -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'