55using System . Reflection ;
66using MultiAdmin . Config . ConfigHandler ;
77using MultiAdmin . ConsoleTools ;
8+ using MultiAdmin . ServerIO ;
9+ using MultiAdmin . Utility ;
810
911namespace MultiAdmin . Config
1012{
@@ -33,7 +35,7 @@ public class MultiAdminConfig : InheritableConfigRegister
3335 "MultiAdmin Debug Logging" , "Enables MultiAdmin debug logging, this logs to a separate file than any other logs" ) ;
3436
3537 public ConfigEntry < string [ ] > DebugLogBlacklist { get ; } =
36- new ConfigEntry < string [ ] > ( "multiadmin_debug_log_blacklist" , new string [ ] { " ProcessFile" } ,
38+ new ConfigEntry < string [ ] > ( "multiadmin_debug_log_blacklist" , new string [ ] { nameof ( OutputHandler . ProcessFile ) , nameof ( Utils . StringMatches ) } ,
3739 "MultiAdmin Debug Logging Blacklist" , "Which tags to block for MultiAdmin debug logging" ) ;
3840
3941 public ConfigEntry < string [ ] > DebugLogWhitelist { get ; } =
@@ -84,22 +86,26 @@ public class MultiAdminConfig : InheritableConfigRegister
8486 new ConfigEntry < bool > ( "manual_start" , false ,
8587 "Manual Start" , "Whether or not to start the server automatically when launching MultiAdmin" ) ;
8688
87- public ConfigEntry < float > MaxMemory { get ; } =
88- new ConfigEntry < float > ( "max_memory" , 2048 ,
89+ public ConfigEntry < decimal > MaxMemory { get ; } =
90+ new ConfigEntry < decimal > ( "max_memory" , 2048 ,
8991 "Max Memory" , "The amount of memory in megabytes for MultiAdmin to check against" ) ;
9092
91- public ConfigEntry < float > RestartLowMemory { get ; } =
92- new ConfigEntry < float > ( "restart_low_memory" , 400 ,
93+ public ConfigEntry < decimal > RestartLowMemory { get ; } =
94+ new ConfigEntry < decimal > ( "restart_low_memory" , 400 ,
9395 "Restart Low Memory" , "Restart if the game's remaining memory falls below this value in megabytes" ) ;
9496
95- public ConfigEntry < float > RestartLowMemoryRoundEnd { get ; } =
96- new ConfigEntry < float > ( "restart_low_memory_roundend" , 450 ,
97+ public ConfigEntry < decimal > RestartLowMemoryRoundEnd { get ; } =
98+ new ConfigEntry < decimal > ( "restart_low_memory_roundend" , 450 ,
9799 "Restart Low Memory Round-End" , "Restart at the end of the round if the game's remaining memory falls below this value in megabytes" ) ;
98100
99101 public ConfigEntry < int > MaxPlayers { get ; } =
100102 new ConfigEntry < int > ( "max_players" , 20 ,
101103 "Max Players" , "The number of players to display as the maximum for the server (within MultiAdmin, not in-game)" ) ;
102104
105+ public ConfigEntry < int > OutputReadAttempts { get ; } =
106+ new ConfigEntry < int > ( "output_read_attempts" , 100 ,
107+ "Output Read Attempts" , "The number of times to attempt reading a message from the server before giving up" ) ;
108+
103109 public ConfigEntry < bool > RandomInputColors { get ; } =
104110 new ConfigEntry < bool > ( "random_input_colors" , false ,
105111 "Random Input Colors" , "Randomize the new input system's colors every time a message is input" ) ;
@@ -108,16 +114,28 @@ public class MultiAdminConfig : InheritableConfigRegister
108114 new ConfigEntry < int > ( "restart_every_num_rounds" , - 1 ,
109115 "Restart Every Number of Rounds" , "Restart the server every number of rounds" ) ;
110116
117+ public ConfigEntry < bool > RestartEveryNumRoundsCounting { get ; } =
118+ new ConfigEntry < bool > ( "restart_every_num_rounds_counting" , false ,
119+ "Restart Every Number of Rounds Counting" , "Whether to print the count of rounds passed after each round if the server is set to restart after a number of rounds" ) ;
120+
111121 public ConfigEntry < bool > SafeServerShutdown { get ; } =
112122 new ConfigEntry < bool > ( "safe_server_shutdown" , true ,
113- "Safe Server Shutdown" , "When MultiAdmin closes, if this is true, MultiAdmin will attempt to safely shutdown all the servers" ) ;
123+ "Safe Server Shutdown" , "When MultiAdmin closes, if this is true, MultiAdmin will attempt to safely shutdown all servers" ) ;
124+
125+ public ConfigEntry < int > SafeShutdownCheckDelay { get ; } =
126+ new ConfigEntry < int > ( "safe_shutdown_check_delay" , 100 ,
127+ "Safe Shutdown Check Delay" , "The time in milliseconds between checking if a server is still running when safely shutting down" ) ;
114128
115- public ConfigEntry < float > ServerRestartTimeout { get ; } =
116- new ConfigEntry < float > ( "server_restart_timeout" , 10 ,
129+ public ConfigEntry < int > SafeShutdownTimeout { get ; } =
130+ new ConfigEntry < int > ( "safe_shutdown_timeout" , 10000 ,
131+ "Safe Shutdown Timeout" , "The time in milliseconds before MultiAdmin gives up on safely shutting down a server" ) ;
132+
133+ public ConfigEntry < double > ServerRestartTimeout { get ; } =
134+ new ConfigEntry < double > ( "server_restart_timeout" , 10 ,
117135 "Server Restart Timeout" , "The time in seconds before MultiAdmin forces a server restart if it doesn't respond to the regular restart command" ) ;
118136
119- public ConfigEntry < float > ServerStopTimeout { get ; } =
120- new ConfigEntry < float > ( "server_stop_timeout" , 10 ,
137+ public ConfigEntry < double > ServerStopTimeout { get ; } =
138+ new ConfigEntry < double > ( "server_stop_timeout" , 10 ,
121139 "Server Stop Timeout" , "The time in seconds before MultiAdmin forces a server shutdown if it doesn't respond to the regular shutdown command" ) ;
122140
123141 public ConfigEntry < string > ServersFolder { get ; } =
@@ -241,6 +259,18 @@ public override void UpdateConfigValueInheritable(ConfigEntry configEntry)
241259 break ;
242260 }
243261
262+ case ConfigEntry < double > config :
263+ {
264+ config . Value = Config . GetDouble ( config . Key , config . Default ) ;
265+ break ;
266+ }
267+
268+ case ConfigEntry < decimal > config :
269+ {
270+ config . Value = Config . GetDecimal ( config . Key , config . Default ) ;
271+ break ;
272+ }
273+
244274 case ConfigEntry < bool > config :
245275 {
246276 config . Value = Config . GetBool ( config . Key , config . Default ) ;
@@ -283,7 +313,7 @@ public MultiAdminConfig[] GetConfigHierarchy(bool highestToLowest = true)
283313 {
284314 List < MultiAdminConfig > configHierarchy = new List < MultiAdminConfig > ( ) ;
285315
286- foreach ( InheritableConfigRegister configRegister in GetConfigRegisterHierarchy ( highestToLowest ) )
316+ foreach ( ConfigRegister configRegister in GetConfigRegisterHierarchy ( highestToLowest ) )
287317 {
288318 if ( configRegister is MultiAdminConfig config )
289319 configHierarchy . Add ( config ) ;
0 commit comments