Example #1
0
        public bool Start()
        {
            if (!server.Start())
            {
                return(false);
            }

            Log.Info($"Server is listening on port {Port} UDP");
            Log.Info($"Using {serverConfig.SerializerMode} as save file serializer");
            Log.InfoSensitive("Server Password: {password}", string.IsNullOrEmpty(serverConfig.ServerPassword) ? "None. Public Server." : serverConfig.ServerPassword);
            Log.InfoSensitive("Admin Password: {password}", serverConfig.AdminPassword);
            Log.Info($"Autosave: {(serverConfig.DisableAutoSave ? "DISABLED" : $"ENABLED ({serverConfig.SaveInterval / 60000} min)")}");
Example #2
0
        public bool Start(CancellationTokenSource cancellationToken)
        {
            serverCancelSource = cancellationToken;
            if (!server.Start())
            {
                return(false);
            }

            try
            {
                if (serverConfig.CreateFullEntityCache)
                {
                    Log.Info("Starting to load all batches up front.");
                    Log.Info("This can take up to several minutes and you can't join until it's completed.");
                    Log.Info($"{entityManager.GetAllEntities().Count} entities already cached");
                    if (entityManager.GetAllEntities().Count < 504732)
                    {
                        entityManager.LoadAllUnspawnedEntities(serverCancelSource.Token);

                        Log.Info("Saving newly cached entities.");
                        Save();
                    }
                    Log.Info("All batches have now been loaded.");
                }
            }
            catch (OperationCanceledException ex)
            {
                Log.Warn($"Server start was cancelled by user:{Environment.NewLine}{ex.Message}");
                return(false);
            }

            LogHowToConnectAsync().ConfigureAwait(false);
            Log.Info($"Server is listening on port {Port} UDP");
            Log.Info($"Using {serverConfig.SerializerMode} as save file serializer");
            Log.InfoSensitive("Server Password: {password}", string.IsNullOrEmpty(serverConfig.ServerPassword) ? "None. Public Server." : serverConfig.ServerPassword);
            Log.InfoSensitive("Admin Password: {password}", serverConfig.AdminPassword);
            Log.Info($"Autosave: {(serverConfig.DisableAutoSave ? "DISABLED" : $"ENABLED ({serverConfig.SaveInterval / 60000} min)")}");