@@ -15,6 +15,7 @@ def read_config():
15
15
main_directory = config .get ('Settings' , 'main_directory' )
16
16
backup_dir = config .get ('Settings' , 'backup_dir' )
17
17
arguments = config .get ('Settings' , 'arguments' )
18
+ palinject_enabled = config .getboolean ('Settings' , 'PalInject_enabled' )
18
19
use_multicore_options = config .getboolean ('Settings' , 'use_multicore_options' )
19
20
backup_interval_hours = config .getint ('Settings' , 'backup_interval_hours' )
20
21
backup_interval_minutes = config .getint ('Settings' , 'backup_interval_minutes' )
@@ -26,12 +27,26 @@ def read_config():
26
27
polling_interval_seconds = config .getint ('Memory' , 'polling_interval_seconds' )
27
28
memory_usage_threshold = config .getint ('Memory' , 'memory_usage_threshold' )
28
29
shutdown_notices = dict (item .split (':' ) for item in config .get ('RCON' , 'shutdown_notices' ).split (';' ))
30
+ shutdown_notices_cn = dict (item .split (':' ) for item in config .get ('RCON' , 'shutdown_notices_cn' ).split (';' ))
29
31
rcon_enabled = config .getboolean ('RCON' , 'rcon_enabled' )
30
32
rcon_host = config .get ('RCON' , 'HOST' )
31
33
rcon_port = config .getint ('RCON' , 'PORT' )
32
34
rcon_password = config .get ('RCON' , 'AdminPassword' )
33
35
rcon_command = config .get ('RCON' , 'COMMAND' )
34
36
37
+ announcement_enabled = config .getboolean ('Messages' , 'announcement_enabled' )
38
+ announcement_time = config .getint ('Messages' , 'announcement_time' )
39
+
40
+ # 获取公告消息
41
+ announcement_messages = []
42
+ for i in range (1 , 11 ): # 10个公告消息
43
+ key = f'announcement_messages_{ i } '
44
+ if config .has_option ('Messages' , key ):
45
+ message = config .get ('Messages' , key )
46
+ announcement_messages .append (message )
47
+ else :
48
+ break
49
+
35
50
# 将小时和分钟转换为秒
36
51
restart_interval = (restart_interval_hours * 60 + restart_interval_minutes ) * 60
37
52
backup_interval = (backup_interval_hours * 60 + backup_interval_minutes ) * 60
@@ -40,6 +55,7 @@ def read_config():
40
55
'main_directory' : main_directory ,
41
56
'backup_dir' : backup_dir ,
42
57
'arguments' : arguments ,
58
+ 'palinject_enabled' : palinject_enabled ,
43
59
'use_multicore_options' : use_multicore_options ,
44
60
'rcon_enabled' : rcon_enabled ,
45
61
'rcon_host' : rcon_host ,
@@ -49,11 +65,15 @@ def read_config():
49
65
'backup_interval' : backup_interval ,
50
66
'restart_interval' : restart_interval ,
51
67
'shutdown_notices' : shutdown_notices ,
68
+ 'shutdown_notices_cn' : shutdown_notices_cn ,
52
69
'daemon_enabled' : daemon_enabled ,
53
70
'daemon_time' : daemon_time ,
54
71
'memory_monitor_enabled' : memory_monitor_enabled ,
55
72
'polling_interval_seconds' : polling_interval_seconds ,
56
73
'memory_usage_threshold' : memory_usage_threshold ,
74
+ 'announcement_enabled' : announcement_enabled ,
75
+ 'announcement_time' : announcement_time ,
76
+ 'announcement_messages' : announcement_messages ,
57
77
}
58
78
59
79
0 commit comments