diff --git a/README.md b/README.md index 1277f90..77bbeb0 100644 --- a/README.md +++ b/README.md @@ -58,9 +58,9 @@ You can modify the config `dimension_region_folder` to make entities sync during "source_world_directory": "./qb_multi/slot1/world", "destination_world_directory": "./server/world", "dimension_region_folder": { - "-1": ["DIM-1/region", "DIM-1/entities"], - "0": ["region", "entities"], - "1": ["DIM1/region", "DIM1/entities"] + "-1": ["DIM-1/region", "DIM-1/poi", "DIM-1/entities"], + "0": ["region", "poi", "entities"], + "1": ["DIM1/region", "DIM1/poi", "DIM1/entities"] } } ``` diff --git a/region_file_updater/__init__.py b/region_file_updater/__init__.py index af640f4..077785e 100644 --- a/region_file_updater/__init__.py +++ b/region_file_updater/__init__.py @@ -13,9 +13,9 @@ class Config(Serializable): source_world_directory: str = './qb_multi/slot1/world' destination_world_directory: str = './server/world' dimension_region_folder: Dict[str, Union[str, List[str]]] = { - '-1': 'DIM-1/region', - '0': 'region', - '1': 'DIM1/region' + '-1': ['DIM-1/region', 'DIM-1/poi'], + '0': ['region', 'poi'], + '1': ['DIM1/region', 'DIM1/poi'] } @@ -79,8 +79,11 @@ def __repr__(self): def print_log(server: ServerInterface, msg: str): server.logger.info(msg) - with open(LogFilePath, 'a') as logfile: - logfile.write(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) + ': ' + msg + '\n') + try: + with open(LogFilePath, 'a') as logfile: + logfile.write(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) + ': ' + msg + '\n') + except Exception as e: + server.logger.info('错误写入日志文件: {}'.format(e)) def add_region(source: CommandSource, region: Region): @@ -164,6 +167,9 @@ def region_update(source: CommandSource): except Exception as e: msg = '失败,错误信息:{}'.format(str(e)) flag = False + if isinstance(e, FileNotFoundError) and os.path.exists(destination): + os.remove(destination) + source.get_server().logger.info('在目的地被删除的文件: {}'.format(destination)) else: msg = '成功' flag = True