Esempio n. 1
0
 public static void Exec() //Dictionary keys in schedule correspond to specific class in order to execute corresponding methods
 {
     try
     {
         foreach (var _event in Schedule.ToArray())
         {
             if (DateTime.Now >= _event.Value)
             {
                 if (_event.Key == "AutoBackup")
                 {
                     Add("AutoBackup", DateTime.Now.AddMinutes(AutoBackup.Delay));
                     AutoBackup.Exec();
                 }
                 else if (_event.Key == "AutoSaveWorld")
                 {
                     Add("AutoSaveWorld", DateTime.Now.AddMinutes(AutoSaveWorld.Delay));
                     AutoSaveWorld.Save();
                 }
                 else if (_event.Key == "Bloodmoon")
                 {
                     Add("Bloodmoon", DateTime.Now.AddMinutes(Bloodmoon.Delay));
                     Bloodmoon.StatusCheck();
                 }
                 else if (_event.Key == "BreakTime")
                 {
                     Add("BreakTime", DateTime.Now.AddMinutes(BreakTime.Delay));
                     BreakTime.Exec();
                 }
                 else if (_event.Key == "InfoTicker")
                 {
                     Add("InfoTicker", DateTime.Now.AddMinutes(InfoTicker.Delay));
                     InfoTicker.Exec();
                 }
                 else if (_event.Key == "NightAlert")
                 {
                     Add("NightAlert", DateTime.Now.AddMinutes(NightAlert.Delay));
                     NightAlert.Exec();
                 }
                 else if (_event.Key == "PlayerLogs")
                 {
                     Add("PlayerLogs", DateTime.Now.AddMinutes(PlayerLogs.Delay));
                     PlayerLogs.Exec();
                 }
                 else if (_event.Key == "RealWorldTime")
                 {
                     Add("RealWorldTime", DateTime.Now.AddMinutes(RealWorldTime.Delay));
                     RealWorldTime.Exec();
                 }
                 else if (_event.Key == "Watchlist")
                 {
                     Add("Watchlist", DateTime.Now.AddMinutes(Watchlist.Delay));
                     Watchlist.CheckWatchlist();
                 }
                 else if (_event.Key == "Zones")
                 {
                     Add("Zones", DateTime.Now.AddMinutes(Zones.Reminder_Delay));
                     Zones.ReminderExec();
                 }
                 else if (_event.Key == "Shutdown") //combines stop server tool to apply a countdown timer before shutdown
                 {
                     StopServer.PrepareShutdown();
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in EventSchedule.Exec: {0}", e.Message));
     }
 }