Esempio n. 1
0
        protected override void OnTick()
        {
            if (m_Restarting || !Enabled)
            {
                return;
            }

//			if ( DateTime.Now < m_RestartTime )
//				return;

            if (m_WarningCount < WarningIntervals.Length && DateTime.Now >= (m_RestartTime - TimeSpan.FromSeconds(WarningIntervals[m_WarningCount])))
            {
                Warning_Callback();
            }
            else if (DateTime.Now >= m_RestartTime)
            {
                AutoSave.SavesEnabled = false;

                if (!WorldBackup.BackingUp)
                {
                    WorldBackup.ThreadedBackup();
                }

                FinalRestart();
            }
        }
Esempio n. 2
0
        protected override void OnTick()
        {
            if (!m_SavesEnabled || AutoRestart.Restarting)
            {
                return;
            }

            if (m_Warning == TimeSpan.Zero)
            {
                //Console.WriteLine( "World: Saving initiated." );
                WorldBackup.ThreadedBackup();
                Save(true);
            }
            else
            {
                int s = (int)m_Warning.TotalSeconds;
                int m = s / 60;
                s %= 60;

                if (m > 0 && s > 0)
                {
                    World.Broadcast(0x35, true, "The world will save in {0} minute{1} and {2} second{3}.", m, m != 1 ? "s" : "", s, s != 1 ? "s" : "");
                }
                else if (m > 0)
                {
                    World.Broadcast(0x35, true, "The world will save in {0} minute{1}.", m, m != 1 ? "s" : "");
                }
                else
                {
                    World.Broadcast(0x35, true, "The world will save in {0} second{1}.", s, s != 1 ? "s" : "");
                }

                WorldBackup.ThreadedBackup();

                Timer.DelayCall(m_Warning, new TimerCallback(Save));
            }
        }