@@ -90,6 +90,7 @@ def execute_task(self, server: PluginServerInterface, hook: str, var_dict: dict
9090 command .write (self .command )
9191
9292 os .system (command .getvalue ())
93+ # mc command
9394 elif self .task_type == TaskType .server_command :
9495 # 替换参数
9596 command = self .command
@@ -98,6 +99,7 @@ def execute_task(self, server: PluginServerInterface, hook: str, var_dict: dict
9899 command = command .replace ('{$' + key + '}' , str (var_dict .get (key )))
99100
100101 server .execute (command )
102+ # mcdr command
101103 elif self .task_type == TaskType .mcdr_command :
102104 # 替换参数
103105 command = self .command
@@ -106,7 +108,8 @@ def execute_task(self, server: PluginServerInterface, hook: str, var_dict: dict
106108 command = command .replace ('{$' + key + '}' , str (var_dict .get (key )))
107109
108110 server .execute_command (command )
109-
111+
112+ # python code
110113 elif self .task_type == TaskType .python_code :
111114 if obj_dict is not None :
112115 exec (self .command , obj_dict , {})
@@ -343,9 +346,15 @@ def parse_and_apply_scripts(script: str, server: PluginServerInterface):
343346 content : dict [str , Union [str , Union [list , dict ]]] = yaml .load (f .read (), Loader = yaml .Loader )
344347
345348 for task in content .get ('tasks' ).values ():
349+ cmd_file_path = str (task .get ('command_file' )).replace ('{hooks_config_path}' , server .get_data_folder ())
350+
351+ if not os .path .isfile (cmd_file_path ):
352+ server .logger .warning (f'Script path for task { task .get ("name" )} is invalid! { task .get ("command_file" )} ' )
353+
346354 if (task .get ('command_file' ) is not None ) and (len (task .get ('command_file' )) > 0 ) and \
347- (os .path .isfile (task .get ('command_file' ))):
348- with open (task .get ('command_file' ), 'r' ) as command_file :
355+ (os .path .isfile (cmd_file_path )):
356+ with open (cmd_file_path , 'r' ) \
357+ as command_file :
349358 command_file_content = command_file .read ()
350359 # 创建task
351360 create_task (task .get ('task_type' ), command_file_content , task .get ('name' ),
0 commit comments