/// <inheritdoc /> public IPlayer GetOnlinePlayerById(string id) { IEnumerable <EcoPlayer> players = OnlinePlayers.Cast <EcoPlayer>(); return(players.FirstOrDefault(x => x.Id.Equals(id)) ?? throw new EcoPlayerNotFoundException(id)); }
/// <inheritdoc /> public IPlayer GetOnlinePlayerByName(string name) { IEnumerable <EcoPlayer> players = OnlinePlayers.Cast <EcoPlayer>(); return(players.FirstOrDefault(x => x.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)) ?? players.FirstOrDefault(x => x.Name.ComparerContains(name)) ?? throw new EcoPlayerNotFoundException(name)); }
/// <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); }