From 54df497ef9fa1156a27659695ace8963f4bce9fc Mon Sep 17 00:00:00 2001 From: Fallen_Breath Date: Sat, 24 Feb 2024 12:19:08 +0800 Subject: [PATCH] config `server.saved_world_regex` is full-matched, so no need for `^$` --- docs/config.md | 8 ++++++-- docs/config.zh.md | 8 ++++++-- prime_backup/config/server_config.py | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/config.md b/docs/config.md index eef10a0..fa522b9 100644 --- a/docs/config.md +++ b/docs/config.md @@ -150,8 +150,8 @@ Options on how to interact with the Minecraft server "auto_save_on": "save-on" }, "saved_world_regex": [ - "^Saved the game$", - "^Saved the world$" + "Saved the game", + "Saved the world" ], "save_world_max_wait": "10m" } @@ -182,6 +182,10 @@ Timing of what Prime Backup will do during a backup creation A list of regular expressions for identifying whether the server has already saved the world +!!! note + + The regex patterns will perform a [full match](https://docs.python.org/3/library/re.html#re.fullmatch) check on the server info content + - Type: `List[re.Pattern]` #### save_world_max_wait diff --git a/docs/config.zh.md b/docs/config.zh.md index 09c3c00..64d1e40 100644 --- a/docs/config.zh.md +++ b/docs/config.zh.md @@ -149,8 +149,8 @@ MCDR 中,Prime Backup 所有命令的前缀。通常你不需要更改它 "auto_save_on": "save-on" }, "saved_world_regex": [ - "^Saved the game$", - "^Saved the world$" + "Saved the game", + "Saved the world" ], "save_world_max_wait": "10m" } @@ -181,6 +181,10 @@ Prime Backup 在创建备份时的操作时序如下: 一个正则表达式列表,用于识别服务器是否已保存完成 +!!! note + + 正则表达式将对服务端消息输出执行 [全串匹配](https://docs.python.org/3/library/re.html#re.fullmatch) 检查 + - 类型:`List[re.Pattern]` #### save_world_max_wait diff --git a/prime_backup/config/server_config.py b/prime_backup/config/server_config.py index f36734f..1fd7593 100644 --- a/prime_backup/config/server_config.py +++ b/prime_backup/config/server_config.py @@ -16,7 +16,7 @@ class ServerConfig(Serializable): turn_off_auto_save: bool = True commands: MinecraftServerCommands = MinecraftServerCommands() saved_world_regex: List[re.Pattern] = [ - re.compile('^Saved the game$'), - re.compile('^Saved the world$'), + re.compile('Saved the game'), + re.compile('Saved the world'), ] save_world_max_wait: Duration = Duration('10min')