public void Update() { RemoveLoggedOutPlayers(); if (m_LeaveTimers.Count > 0) { List <LeaveTimer> toRemove = new List <LeaveTimer>(); foreach (LeaveTimer t in m_LeaveTimers) { if (t.IsExpired()) { m_CommandListener.AddCommand("sub", AddToSubList); Chat.SendMessage(">> Leaver Detected: " + t.Leaver.Name); Chat.SendMessage(">> Type /sub to join."); m_SubSearches.Add(new SubSearch(t.Leaver)); toRemove.Add(t); } else if (m_Context.GetPlayer(t.Leaver.Name) != null) { //player rejoined m_Context.AddPlayerToTeam(t.Leaver.Name, t.Leaver.TeamLeft); toRemove.Add(t); } } m_LeaveTimers.RemoveAll(x => toRemove.Contains(x)); } if (m_SubSearches.Count > 0) { List <SubSearch> done = new List <SubSearch>(); bool sentNoSubMessage = false; foreach (SubSearch s in m_SubSearches) { if (s.IsExpired()) { if (m_PotentialSubs.Count > 0) { RankedPlayer p = s.ClosestElo(m_PotentialSubs); m_Context.RemovePlayerFromTeam(p.Name); m_Context.AddPlayerToTeam(p.Name, s.Team); Chat.SendMessage(">> " + p.Name + " added to " + s.Team.ToString() + " team."); done.Add(s); } else { if (!sentNoSubMessage) { Chat.SendMessage(">> No Sub Found."); Chat.SendMessage(">> Type /sub to join."); sentNoSubMessage = true; } s.ResetSearchTime(); } } } m_SubSearches.RemoveAll(x => done.Contains(x)); if (m_SubSearches.Count == 0) { m_PotentialSubs = new List <RankedPlayer>(); m_CommandListener.RemoveCommand("sub"); } } }