11/*
2- * This file is part of SWBF2Admin (https://github.com/jweigelt/swbf2admin).
2+ * This file is part of SWBF2Admin (https://github.com/jweigelt/swbf2admin).
33 * Copyright(C) 2017, 2018 Jan Weigelt <[email protected] > 44 *
55 * SWBF2Admin is free software: you can redistribute it and/or modify
1515 * You should have received a copy of the GNU General Public License
1616 * along with SWBF2Admin. If not, see<http://www.gnu.org/licenses/>.
1717 */
18+
1819using System ;
1920using System . Collections . Generic ;
20-
2121using SWBF2Admin . Utility ;
2222using SWBF2Admin . Config ;
2323using SWBF2Admin . Web ;
2424using SWBF2Admin . Database ;
2525using SWBF2Admin . Gameserver ;
2626using SWBF2Admin . Scheduler ;
2727using SWBF2Admin . Structures ;
28-
2928using SWBF2Admin . Runtime . Players ;
3029using SWBF2Admin . Runtime . Rcon ;
3130using SWBF2Admin . Runtime . Game ;
3231using SWBF2Admin . Runtime . Announce ;
3332using SWBF2Admin . Runtime . Commands ;
3433using SWBF2Admin . Runtime . ApplyMods ;
3534using SWBF2Admin . Runtime . Watchdog ;
36-
3735using SWBF2Admin . Plugins ;
3836
3937namespace SWBF2Admin
@@ -43,7 +41,12 @@ public class AdminCore
4341 private const string ARG_RESET_WEBUSER = "--reset-webcredentials" ;
4442
4543 private CoreConfiguration config ;
46- public CoreConfiguration Config { get { return config ; } }
44+
45+ public CoreConfiguration Config
46+ {
47+ get { return config ; }
48+ }
49+
4750 public FileHandler Files { get ; } = new FileHandler ( ) ;
4851 public TaskScheduler Scheduler { get ; } = new TaskScheduler ( ) ;
4952
@@ -168,6 +171,11 @@ public void Run(string[] args)
168171
169172 while ( ( cmd = Console . ReadLine ( ) ) != "quit" )
170173 {
174+ if ( string . IsNullOrEmpty ( cmd ) )
175+ {
176+ continue ;
177+ }
178+
171179 if ( cmd == "import maps" )
172180 {
173181 Database . ImportMaps ( ServerMap . ReadServerMapConfig ( this ) ) ;
@@ -185,9 +193,9 @@ public void Run(string[] args)
185193
186194
187195 #region "Events"
196+
188197 private void Server_Started ( object sender , EventArgs e )
189198 {
190-
191199 Logger . Log ( LogLevel . Verbose , "Starting runtime management..." ) ;
192200 Scheduler . PushDelayedTask ( ( ) =>
193201 {
@@ -214,7 +222,7 @@ private void Server_Stopped(object sender, EventArgs e)
214222 Logger . Log ( LogLevel . Verbose , "Restarting server..." ) ;
215223 Server . Start ( ) ;
216224 }
217- }
225+ }
218226 }
219227
220228 private void Server_Crashed ( object sender , EventArgs e )
@@ -223,24 +231,23 @@ private void Server_Crashed(object sender, EventArgs e)
223231 if ( Config . AutoRestartServer )
224232 {
225233 Logger . Log ( LogLevel . Info , "Automatic restart is enabled. Restarting server..." ) ;
226- Scheduler . PushDelayedTask ( ( ) => Server . Start ( ) , 90000 ) ;
234+ Scheduler . PushDelayedTask ( ( ) => Server . Start ( ) , Config . AutoRestartDelay ) ;
227235 }
228236 }
229237
230238 private void Rcon_Disconnected ( object sender , EventArgs e )
231239 {
232-
233240 }
234241
235242 private void Rcon_Chat ( object sender , EventArgs e )
236243 {
237-
238244 }
239245
240246 private void Announce_Broadcast ( object sender , EventArgs e )
241247 {
242248 Rcon . Say ( ( ( AnnounceEventArgs ) e ) . Announce . ParseMessage ( this ) ) ;
243249 }
250+
244251 #endregion
245252 }
246253}
0 commit comments