Esempio n. 1
0
 internal ServerStatus(string label, ServerStatusUpdater basis, EventMessages msg)
 {
     Label        = label;
     Updater      = basis;
     NotifyServer = true;
     NotifyCount  = true;
     NotifyNames  = true;
     PlayerList   = new List <PlayerPayLoad>();
     messages     = msg;
     ApplyServerInfo(null);
 }
Esempio n. 2
0
        /// <summary>
        ///     Will either reuse a given ServerStatusBase with same address or create one
        /// </summary>
        /// <param name="label"></param>
        /// <param name="addr"></param>
        /// <param name="port"></param>
        /// <returns>a new ServerStatus object with given params</returns>
        public ServerStatus Make(string addr, int port = 25565, bool forceNewBase = false, string label = "")
        {
            // Get Serverstatusbase or make & add one
            var found = forceNewBase ? null : GetByAddr(addr, port);

            if (found == null)
            {
                updaters.Add(found = new ServerStatusUpdater()
                {
                    Address = addr, Port = port
                });
            }
            // Make & add new status
            var state = new ServerStatus(label, found, Messages);

            states.Add(state);
            return(state);
        }
Esempio n. 3
0
 /// <summary>
 ///     Returns whether the ServerStatusBase is used more than once
 /// </summary>
 /// <param name="ssb"></param>
 /// <returns></returns>
 private bool IsBeingUsed(ServerStatusUpdater ssb)
 {
     return(states.FindAll(s => ssb.Equals(s.Updater)).Count() > 1);
 }