private static void Init(object sender, ElapsedEventArgs e) { if (!StopServer.Shutdown) { PersistentOperations.PlayerCheck(); if (Jail.IsEnabled) { Jail.StatusCheck(); } if (UnderWater.IsEnabled) { UnderWater.Exec(); } timer2Second++; if (timer2Second >= 2) { if (WorldRadius.IsEnabled) { WorldRadius.Exec(); } if (Flying.IsEnabled) { Flying.Exec(); } timer2Second = 0; } timer5Second++; if (timer5Second >= 5) { if (Zones.IsEnabled) { Zones.HostileCheck(); } if (PlayerStatCheck.IsEnabled) { PlayerStatCheck.PlayerStat(); } timer5Second = 0; } timer10Second++; if (timer10Second >= 10) { if (EntityCleanup.IsEnabled) { EntityCleanup.EntityCheck(); } timer10Second = 0; } timer60Second++; if (timer60Second >= 60) { if (Jail.IsEnabled && Jail.Jailed.Count > 0) { Jail.Clear(); } if (Mute.IsEnabled && Mute.Mutes.Count > 0) { Mute.Clear(); } if (BloodmoonWarrior.IsEnabled) { BloodmoonWarrior.Exec(); } timer60Second = 0; } 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 (NightAlert.IsEnabled) { _nightAlert++; if (_nightAlert >= NightAlert.Delay * 60) { _nightAlert = 0; NightAlert.Exec(); } } else { _nightAlert = 0; } if (Watchlist.IsEnabled) { _watchList++; if (_watchList >= Watchlist.Delay * 60) { _watchList = 0; Watchlist.CheckWatchlist(); } } else { _watchList = 0; } if (Bloodmoon.IsEnabled & Bloodmoon.Auto_Show) { if (Bloodmoon.Delay > 0) { _bloodmoon++; if (_bloodmoon >= Bloodmoon.Delay * 60) { _bloodmoon = 0; Bloodmoon.StatusCheck(); } } } else { _bloodmoon = 0; } if (PlayerLogs.IsEnabled & PlayerLogs.Delay > 0) { _playerLogs++; if (_playerLogs >= PlayerLogs.Delay) { _playerLogs = 0; PlayerLogs.Exec(); } } else { _playerLogs = 0; } if (StopServer.StopServerCountingDown) { _stopServerCountDown++; if (_stopServerCountDown == 60) { _stopServerCountDown = 0; _stopServerCount--; } if (_stopServerCount == 0) { _stopServerCountDown = 0; StopServer.StopServerCountingDown = false; StopServer.Stop(); } if (_stopServerCount == 1 && _stopServerCountDown == 0) { StopServer.StartShutdown3(); } if (_stopServerCount > 1 && _stopServerCountDown == 0) { StopServer.StartShutdown2(_stopServerCount); } if (StopServer.Kick_30_Seconds) { if (_stopServerCount == 1 && _stopServerCountDown == 30) { StopServer.NoEntry = true; StopServer.Kick30(); } } if (StopServer.Ten_Second_Countdown) { if (_stopServerCount == 1 && _stopServerCountDown == 50) { StopServer.StartShutdown4(); } if (_stopServerCount == 1 && _stopServerCountDown == 55) { StopServer.StartShutdown5(); } if (_stopServerCount == 1 && _stopServerCountDown == 56) { StopServer.StartShutdown6(); } if (_stopServerCount == 1 && _stopServerCountDown == 57) { StopServer.StartShutdown7(); } if (_stopServerCount == 1 && _stopServerCountDown == 58) { StopServer.StartShutdown8(); } if (_stopServerCount == 1 && _stopServerCountDown == 59) { StopServer.StartShutdown9(); } } } else { _stopServerCountDown = 0; _stopServerCount = 0; } if (AutoSaveWorld.IsEnabled & AutoSaveWorld.Delay > 0) { _autoSaveWorld++; if (_autoSaveWorld >= AutoSaveWorld.Delay * 60) { _autoSaveWorld = 0; AutoSaveWorld.Save(); } } else { _autoSaveWorld = 0; } if (AutoShutdown.IsEnabled && !AutoShutdown.Bloodmoon && !AutoShutdown.BloodmoonOver && !StopServer.StopServerCountingDown) { _autoShutdown++; if (!Event.Open && _autoShutdown >= AutoShutdown.Delay * 60) { _autoShutdown = 0; AutoShutdown.BloodmoonCheck(); } } else { _autoShutdown = 0; } if (AutoShutdown.Bloodmoon) { _autoShutdownBloodmoon++; if (_autoShutdownBloodmoon >= 150) { _autoShutdownBloodmoon = 0; AutoShutdown.BloodmoonCheck(); } } if (AutoShutdown.BloodmoonOver && !Event.Open) { _autoShutdownBloodmoonOver++; if (_autoShutdownBloodmoonOver == 1) { AutoShutdown.BloodmoonOverAlert(); } else if (_autoShutdownBloodmoonOver >= 900) { _autoShutdownBloodmoonOver = 0; AutoShutdown.BloodmoonOver = false; AutoShutdown.Shutdown(); } } if (InfoTicker.IsEnabled) { _infoTicker++; if (_infoTicker >= InfoTicker.Delay * 60) { _infoTicker = 0; InfoTicker.StatusCheck(); } } else { _infoTicker = 0; } if (Event.Invited) { _eventInvitation++; if (_eventInvitation >= 900) { _eventInvitation = 0; Event.Invited = false; Event.CheckOpen(); } } else { _eventInvitation = 0; } 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.Startup) { _restartVote++; if (_restartVote >= 1800) { RestartVote.Startup = false; } } else { _restartVote = 0; } if (Zones.IsEnabled & Zones.Reminder.Count > 0) { _zoneReminder++; if (_zoneReminder >= Zones.Reminder_Delay * 60) { _zoneReminder = 0; Zones.ReminderExec(); } } else { _zoneReminder = 0; } if (AutoBackup.IsEnabled) { _autoBackup++; if (_autoBackup >= AutoBackup.Delay * 60) { _autoBackup = 0; AutoBackup.Exec(); } } else { _autoBackup = 0; } if (BreakTime.IsEnabled) { _breakTime++; if (_breakTime >= BreakTime.Break_Time * 60) { _breakTime = 0; BreakTime.Exec(); } } else { _breakTime = 0; } if (Tracking.IsEnabled) { _tracking++; if (_tracking >= Tracking.Rate) { _tracking = 0; Tracking.Exec(); } } else { _tracking = 0; } if (InvalidItems.IsEnabled && InvalidItems.Check_Storage) { _invalidItems++; if (_invalidItems >= 300) { _invalidItems = 0; InvalidItems.CheckStorage(); } } else { _invalidItems = 0; } if (RealWorldTime.IsEnabled) { _realWorldTime++; if (_realWorldTime >= RealWorldTime.Delay * 60) { _realWorldTime = 0; RealWorldTime.Time(); } } else { _realWorldTime = 0; } } }
public static void Init(object sender, ElapsedEventArgs e) { if (HatchElevator.IsEnabled) { HatchElevator.AutoHatchCheck(); } if (Jail.IsEnabled) { Jail.StatusCheck(); } if (UnderWater.IsEnabled) { UnderWater.Exec(); } if (Jail.Jailed.Count > 0) { _jR++; if (_jR >= 60) { _jR = 0; Jail.Clear(); } } else { _jR = 0; } if (StopServer.Shutdown) { _sC++; if (_sC >= 60) { _sC = 0; StopServer.FailSafe(); } } else { _sC = 0; } if (WeatherVote.IsEnabled) { if (WeatherVote.VoteOpen) { _wV++; if (_wV >= 60) { _wV = 0; WeatherVote.CallForVote2(); } } } else { _wV = 0; } if (MutePlayer.IsEnabled && MutePlayer.Mutes.Count > 0) { _mC++; if (_mC >= 60) { _mC = 0; MutePlayer.Clear(); } } else { _mC = 0; } if (RealWorldTime.IsEnabled) { _rWT++; if (_rWT >= Real_Time_Delay * 60) { _rWT = 0; RealWorldTime.Time(); } } else { _rWT = 0; } if (Lottery.IsEnabled && Lottery.OpenLotto) { _l++; if (_l == 3300) { Lottery.Alert(); } if (_l >= 3600) { _l = 0; Lottery.StartLotto(); } } else { _l = 0; } if (RestartVote.IsEnabled) { if (RestartVote.VoteOpen) { _rV++; if (_rV >= 60) { _rV = 0; RestartVote.CallForVote2(); } } } else { _rV = 0; } if (MuteVote.IsEnabled) { if (MuteVote.VoteOpen) { _mV++; if (_mV >= 60) { _mV = 0; MuteVote.VoteCount(); } } } else { _mV = 0; } if (KickVote.IsEnabled) { if (KickVote.VoteOpen) { _kV++; if (_kV >= 60) { _kV = 0; KickVote.VoteCount(); } } } else { _kV = 0; } if (Hordes.IsEnabled) { _h++; if (_h >= 1200) { _h = 0; Hordes.Exec(); } } else { _h = 0; } if (EntityCleanup.IsEnabled && (EntityCleanup.BlockIsEnabled || EntityCleanup.FallingTreeEnabled || EntityCleanup.Underground || EntityCleanup.MiniBikes)) { _eC++; if (_eC >= 10) { _eC = 0; EntityCleanup.EntityCheck(); } } else { _eC = 0; } if (Zones.IsEnabled) { _rE++; if (_rE >= 5) { _rE = 0; EntityCleanup.ZombieCheck(); } } else { _rE = 0; } if (NightAlert.IsEnabled) { _nA++; if (_nA >= Night_Time_Delay * 60) { _nA = 0; NightAlert.Exec(); } } else { _nA = 0; } if (Watchlist.IsEnabled) { _wL++; if (_wL >= Alert_Delay * 60) { _wL = 0; Watchlist.CheckWatchlist(); } } else { _wL = 0; } if (PlayerStatCheck.IsEnabled) { _pSC++; if (_pSC >= 5) { _pSC = 0; PlayerStatCheck.PlayerStat(); } } else { _pSC = 0; } if (ReservedSlots.IsEnabled) { _rS++; if (_rS >= 120) { _rS = 0; int _playerCount = ConnectionManager.Instance.ClientCount(); if (_playerCount >= API.MaxPlayers - ReservedSlots.Admin_Slots) { ReservedSlots.OpenSlot(); } } } else { _rS = 0; } if (Bloodmoon.IsEnabled & Bloodmoon.Auto_Show) { if (Auto_Show_Bloodmoon_Delay > 0) { _b++; if (_b >= Auto_Show_Bloodmoon_Delay * 60) { _b = 0; Bloodmoon.StatusCheck(); } } } else { _b = 0; } if (PlayerLogs.IsEnabled & Player_Log_Interval > 0) { _pL++; if (_pL >= Player_Log_Interval) { _pL = 0; PlayerLogs.Exec(); } } else { _pL = 0; } if (StopServer.stopServerCountingDown) { _sSCD++; if (_sSCD == 60) { _sSCD = 0; _sSC--; } if (_sSC == 0) { _sSCD = 0; StopServer.stopServerCountingDown = false; StopServer.Stop(); } if (_sSC == 1 && _sSCD == 0) { StopServer.StartShutdown3(); } if (_sSC > 1 && _sSCD == 0) { StopServer.StartShutdown2(_sSC); } if (StopServer.Kick_30_Seconds) { if (_sSC == 1 && _sSCD == 30) { StopServer.Kick30(); } } if (StopServer.Ten_Second_Countdown) { if (_sSC == 1 && _sSCD == 50) { StopServer.StartShutdown4(); } if (_sSC == 1 && _sSCD == 55) { StopServer.StartShutdown5(); } if (_sSC == 1 && _sSCD == 56) { StopServer.StartShutdown6(); } if (_sSC == 1 && _sSCD == 57) { StopServer.StartShutdown7(); } if (_sSC == 1 && _sSCD == 58) { StopServer.StartShutdown8(); } if (_sSC == 1 && _sSCD == 59) { StopServer.StartShutdown9(); } } } else { _sSCD = 0; _sSC = 0; } if (AutoSaveWorld.IsEnabled & Delay_Between_World_Saves > 0) { _wSD++; if (_wSD >= Delay_Between_World_Saves * 60) { _wSD = 0; AutoSaveWorld.Save(); } } else { _wSD = 0; } if (AutoShutdown.IsEnabled && !AutoShutdown.Bloodmoon && !StopServer.stopServerCountingDown) { _sD++; if (!Event.Open && _sD >= Shutdown_Delay * 60) { _sD = 0; AutoShutdown.CheckBloodmoon(); } } else { _sD = 0; } if (AutoShutdown.Bloodmoon) { _aSB++; if (_aSB >= 900) { _aSB = 0; AutoShutdown.CheckBloodmoon(); } } else { _aSB = 0; } if (InfoTicker.IsEnabled) { _iT++; if (_iT >= Infoticker_Delay * 60) { _iT = 0; InfoTicker.StatusCheck(); } } else { _iT = 0; } if (WorldRadius.IsEnabled) { _wR++; if (_wR >= 2) { _wR = 0; WorldRadius.Exec(); } } else { _wR = 0; } if (Event.Invited) { _eI++; if (_eI >= 900) { _eI = 0; Event.Invited = false; Event.CheckOpen(); } } else { _eI = 0; } if (Event.Open) { _eO++; if (_eO == _eventTime / 2) { Event.HalfTime(); } if (_eO == _eventTime - 300) { Event.FiveMin(); } if (_eO >= _eventTime) { _eO = 0; Event.EndEvent(); } } else { _eO = 0; } if (RestartVote.Startup) { _rVS++; if (_rVS >= 1800) { RestartVote.Startup = false; } } else { _rVS = 0; } if (Zones.IsEnabled & Zones.reminder.Count > 0) { _zR++; if (_zR >= Zones.Reminder_Delay * 60) { _zR = 0; Zones.Reminder(); } } else { _zR = 0; } if (AutoBackup.IsEnabled) { _tBS++; if (_tBS >= AutoBackup.Time_Between_Saves * 60) { _tBS = 0; AutoBackup.BackupExec(); } } else { _tBS = 0; } if (API.Que.Count > 0) { _nP++; if (_nP >= 5) { API.NewPlayerExec(); _nP = 0; } } else { _nP = 0; } if (BreakTime.IsEnabled) { _bT++; if (_bT >= BreakTime.Break_Time * 60) { _bT = 0; BreakTime.Exec(); } } else { _bT = 0; } if (Tracking.IsEnabled) { _tP++; if (_tP >= Tracking.Rate) { _tP = 0; Tracking.Exec(); } } else { _tP = 0; } if (InventoryCheck.IsEnabled && InventoryCheck.Chest_Checker) { _cC++; if (_cC >= 300) { _cC = 0; InventoryCheck.ChestCheck(); } } else { _cC = 0; } }