/// <summary> /// Get all the watchlist or <see cref="Collections.Player"/> watchlist. /// </summary> /// <param name="player">The <see cref="Collections.Player"/> player, but can be null.</param> /// <returns> the watchlist.</returns> public static string GetWatchList([CanBeNull] Collections.Player player) { StringBuilder text = StringBuilderPool.Shared.Rent().AppendLine(); if (player == null) { text.AppendLine($"WatchList ({WatchListCollection.Count()})").AppendLine(); foreach (WatchList wl in WatchListCollection.FindAll().ToList()) { text.AppendLine($"Target: {wl.Target.Name} ({wl.Target.Id}@{wl.Target.Authentication})") .AppendLine($"Issuer: {wl.Issuer.Name} ({wl.Issuer.Id}@{wl.Issuer.Authentication})") .AppendLine($"Reason: {wl.Reason}").AppendLine($"ID: {wl.WatchListId}") .AppendLine($"Date: {wl.Date}").AppendLine($"Server sender Port: {wl.Server}").AppendLine(); } return(StringBuilderPool.Shared.ToStringReturn(text)); } text.AppendLine($"WatchList ({player.Name} - {player.Id}@{player.Authentication})").AppendLine(); foreach (WatchList wl in WatchListCollection.Find(wl => wl.Target.Id == player.Id).ToList()) { text.AppendLine($"Target: {wl.Target.Name} ({wl.Target.Id}@{wl.Target.Authentication})") .AppendLine($"Issuer: {wl.Issuer.Name} ({wl.Issuer.Id}@{wl.Issuer.Authentication})") .AppendLine($"Reason: {wl.Reason}").AppendLine($"ID: {wl.WatchListId}") .AppendLine($"Date: {wl.Date}").AppendLine($"Server sender Port: {wl.Server}").AppendLine(); } return(StringBuilderPool.Shared.ToStringReturn(text)); }