Exemple #1
0
        // World initialization
        // NOTE: Logger, Config, and Color are initialized by now
        public bool Start() {
            Player.Console = new Player( this, "(console)" );

            // start listening
            server = new Server( this );

            if( !server.Start() ) {
                return false;
            }

            serverStart = DateTime.Now;

            // queue up some tasks to run on the scheduler
            AddTask( server.CheckForIncomingConnections, 0 );
            AddTask( UpdateBlocks, config.GetInt( "TickInterval" ) );
            saveMapTaskId = AddTask( SaveMap, config.GetInt( "SaveInterval" ) * 1000 );
            TaskToggle( saveMapTaskId, config.GetInt( "SaveInterval" ) > 0 );
            autoBackupTaskId = AddTask( AutoBackup, config.GetInt( "BackupInterval" ) * 1000 * 60 );
            TaskToggle( autoBackupTaskId, config.GetInt( "BackupInterval" ) > 0 );

            mainThread = new Thread( Update );
            mainThread.Start();
            heartbeat.Start();
            return true;
        }