Пример #1
0
 private static void Exec()
 {
     PersistentOperations.PlayerCheck();
     if (Jail.IsEnabled)
     {
         Jail.StatusCheck();
     }
     if (DiscordBot.IsEnabled && DiscordBot.Queue.Count > 0)
     {
         DiscordBot.WebHook();
     }
     if (_twoSecondTick >= 2)
     {
         _twoSecondTick = 0;
         if (WorldRadius.IsEnabled)
         {
             WorldRadius.Exec();
         }
         if (PlayerChecks.GodEnabled || PlayerChecks.FlyEnabled || PlayerChecks.SpectatorEnabled || PlayerChecks.WaterEnabled)
         {
             PlayerChecks.Exec();
         }
     }
     if (_fiveSecondTick >= 5)
     {
         _fiveSecondTick = 0;
         if (Zones.IsEnabled)
         {
             Zones.HostileCheck();
         }
         if (PlayerStats.IsEnabled)
         {
             PlayerStats.Exec();
         }
     }
     if (_tenSecondTick >= 10)
     {
         _tenSecondTick = 0;
         if (EntityCleanup.IsEnabled)
         {
             EntityCleanup.EntityCheck();
         }
         EventSchedule.Exec();
     }
     if (_twentySecondTick >= 20)
     {
         _twentySecondTick = 0;
         if (Track.IsEnabled)
         {
             Track.Exec();
         }
     }
     if (_oneMinTick >= 60)
     {
         _oneMinTick = 0;
         if (Jail.IsEnabled && Jail.Jailed.Count > 0)
         {
             Jail.Clear();
         }
         if (Mute.IsEnabled && Mute.Mutes.Count > 0)
         {
             Mute.Clear();
         }
         if (BloodmoonWarrior.IsEnabled)
         {
             BloodmoonWarrior.Exec();
         }
     }
     if (_fiveMinTick >= 300)
     {
         _fiveMinTick = 0;
         StateManager.Save();
         if (InvalidItems.Check_Storage)
         {
             InvalidItems.CheckStorage();
         }
     }
     if (WeatherVote.IsEnabled && WeatherVote.VoteOpen)
     {
         _weatherVote++;
         if (_weatherVote >= 60)
         {
             _weatherVote         = 0;
             WeatherVote.VoteOpen = false;
             WeatherVote.ProcessWeatherVote();
         }
     }
     if (RestartVote.IsEnabled && RestartVote.VoteOpen)
     {
         _restartVote++;
         if (_restartVote >= 60)
         {
             _restartVote         = 0;
             RestartVote.VoteOpen = false;
             RestartVote.ProcessRestartVote();
         }
     }
     if (MuteVote.IsEnabled && MuteVote.VoteOpen)
     {
         _muteVote++;
         if (_muteVote >= 60)
         {
             _muteVote         = 0;
             MuteVote.VoteOpen = false;
             MuteVote.ProcessMuteVote();
         }
     }
     if (KickVote.IsEnabled && KickVote.VoteOpen)
     {
         _kickVote++;
         if (_kickVote >= 60)
         {
             _kickVote         = 0;
             KickVote.VoteOpen = false;
             KickVote.ProcessKickVote();
         }
     }
     if (Lottery.IsEnabled && Lottery.OpenLotto)
     {
         _lottery++;
         if (_lottery == 3300)
         {
             Lottery.Alert();
         }
         if (_lottery >= 3600)
         {
             _lottery = 0;
             Lottery.StartLotto();
         }
     }
     else
     {
         _lottery = 0;
     }
     if (Hordes.IsEnabled)
     {
         _horde++;
         if (_horde >= 1200)
         {
             _horde = 0;
             Hordes.Exec();
         }
     }
     else
     {
         _horde = 0;
     }
     if (StopServer.ShuttingDown)
     {
         _stopServerSeconds++;
         if (_stopServerSeconds >= 60)
         {
             _stopServerSeconds = 0;
             StopServerMinutes--;
             if (StopServerMinutes > 1)
             {
                 StopServer.TimeRemaining(StopServerMinutes);
             }
             else if (StopServerMinutes == 1)
             {
                 StopServer.OneMinuteRemains();
             }
             else if (StopServerMinutes == 0)
             {
                 StopServer.ShuttingDown = false;
                 StopServer.Stop();
             }
         }
         if (_stopServerSeconds == 30 && StopServerMinutes == 1)
         {
             StopServer.Kick30();
         }
     }
     else
     {
         _stopServerSeconds = 0;
     }
     if (Event.Invited)
     {
         _eventInvitation++;
         if (_eventInvitation >= 900)
         {
             _eventInvitation = 0;
             Event.Invited    = false;
             Event.CheckOpen();
         }
     }
     if (Event.Open)
     {
         _eventOpen++;
         if (_eventOpen == _eventTime / 2)
         {
             Event.HalfTime();
         }
         if (_eventOpen == _eventTime - 300)
         {
             Event.FiveMin();
         }
         if (_eventOpen >= _eventTime)
         {
             _eventOpen = 0;
             Event.EndEvent();
         }
     }
     else
     {
         _eventOpen = 0;
     }
     if (RestartVote.Cycle)
     {
         _restartVoteCycle++;
         if (_restartVoteCycle >= 1800)
         {
             RestartVote.Cycle = false;
         }
     }
 }