Exemple #1
0
 /// <summary>
 /// Runs the specified server command
 /// </summary>
 /// <param name="command"></param>
 /// <param name="args"></param>
 public void Command(string command, params object[] args) => ServerConsole.DoServerString($"{command} {string.Join(" ", Array.ConvertAll(args, x => x.ToString()))}");
Exemple #2
0
        public override void LowFrequencyUpdate()
        {
            if (worldSetupComplete == false)
            {
                if (WorldScript.instance != null)
                {
                    if (WorldScript.instance.mWorldData != null)
                    {
                        worldSetupComplete = true;
                        Settings.SaveSettings();
                    }
                }
            }

            if (networkSetupComplete == false)
            {
                if (NetworkManager.instance != null)
                {
                    if (NetworkManager.instance.mServerThread != null)
                    {
                        networkSetupComplete = true;
                        //Network Side
                        Settings.ApplyServerSettings();

                        if (Settings.Instance.settings.HTTPServerEnabled == 1)
                        {
                            Directory.CreateDirectory(workingDir + Path.DirectorySeparatorChar + "webroot");
                            HTTPServer = new HTTPServ(workingDir + Path.DirectorySeparatorChar + "webroot", Settings.Instance.settings.HTTPServerPort);
                            HTTPServer.Start();
                        }
                    }
                }
            }


            if (triggerCounter < triggerCounterMax)
            {
                triggerCounter++;
            }
            else
            {
                try
                {
                    triggerCounter = 0;
                    //List<NetworkServerConnection> playerConns = NetworkManager.instance.mServerThread.GetConnections();

                    //if (playerConns.Count > 0)
                    //{
                    //    Players.clearPlayers();
                    //    foreach (NetworkServerConnection conn in playerConns)
                    //    {

                    //        ServerConsole.DoServerString(conn.mPlayer.mUserName);
                    //        if (conn.mPlayer.mbHasGameObject)
                    //        {
                    //            //Access to Player :D
                    //            Players.addPlayer(conn.mPlayer);
                    //        }
                    //    }

                    //}

                    if (Settings.Instance.settings.statsEnabled == 1)
                    {
                        if (Settings.Instance.settings.statsMode == 0 || Settings.Instance.settings.statsMode == 2)
                        {
                            //Stats
                            StatsHTML.GenerateHTML("Template.html", Settings.Instance.settings.StatsSaveFileName);
                        }
                        if (Settings.Instance.settings.statsMode == 1 || Settings.Instance.settings.statsMode == 2)
                        {
                            //Banner
                            StatsHTML.GenerateHTML("TemplateBanner.html", Settings.Instance.settings.BannerSaveFileName);
                        }
                    }
                }
                catch (Exception e)
                {
                    ServerConsole.DoServerString(e.Message);
                }
            }
        }
Exemple #3
0
 internal static void WriteLine(Exception ex)
 {
     ServerConsole.DoServerString(UtilClass.modName + ": " + ex.Message);
     ServerConsole.DoServerString(ex.StackTrace);
 }
Exemple #4
0
 public static void WriteLine(bool b)
 {
     ServerConsole.DoServerString(UtilClass.modName + ": " + b);
 }
Exemple #5
0
 public static void WriteLine(float f)
 {
     ServerConsole.DoServerString(UtilClass.modName + ": " + f);
 }
Exemple #6
0
 public static void WriteLine(int x)
 {
     ServerConsole.DoServerString(UtilClass.modName + ": " + x);
 }