/// <inheritdoc /> public bool TryGetOnlinePlayerById(string id, out IPlayer output) { IEnumerable <EcoPlayer> players = OnlinePlayers.Cast <EcoPlayer>(); EcoPlayer player = players.FirstOrDefault(x => x.Id.Equals(id)); output = player; return(player != null); }
/// <inheritdoc /> public bool TryGetOnlinePlayerByName(string name, out IPlayer output) { IEnumerable <EcoPlayer> players = OnlinePlayers.Cast <EcoPlayer>(); EcoPlayer player = players.FirstOrDefault(x => x.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)) ?? players.FirstOrDefault(x => x.Name.ComparerContains(name)); output = player; return(player != null); }
/// <inheritdoc /> public IUserInfo GetUser(string id) { if (TryGetOnlinePlayerById(id, out IPlayer p)) { return(p.GetUser()); } p = new EcoPlayer(id, this, container); InternalPlayersList.Add((EcoPlayer)p); return(p.GetUser()); }