Index: binary-improvements/CoppisAdditions/src/Commands/ListPlayersFriends.cs
===================================================================
--- binary-improvements/CoppisAdditions/src/Commands/ListPlayersFriends.cs	(revision 279)
+++ binary-improvements/CoppisAdditions/src/Commands/ListPlayersFriends.cs	(revision 285)
@@ -31,54 +31,27 @@
 				} else {
 					if (_params.Count == 0) {
-						Dictionary<int, EntityPlayer>.Enumerator playerEnum = GameManager.Instance.World.Players.dict.GetEnumerator ();
-						while (playerEnum.MoveNext ()) {
-							try {
-								KeyValuePair<int, EntityPlayer> pair = playerEnum.Current;
-								ClientInfo ci1 = ConsoleHelper.ParseParamIdOrName (pair.Value.entityId.ToString ());
-								PersistentPlayerData data = GameManager.Instance.persistentPlayers.GetPlayerData (ci1.playerId);
-								HashSet<string>.Enumerator enumeratorFriends = data.ACL.GetEnumerator ();
-								String friends = "";
-								while (enumeratorFriends.MoveNext ()) {
-									string str = enumeratorFriends.Current;
-									if (str != null) {
-										if (!friends.Equals ("")) {
-											friends += ",";
-										}
-										friends += str;
-									}
-								}
-								SdtdConsole.Instance.Output ("FriendsOf id=" + pair.Value.entityId + ", friends=" + friends);
-							} catch (Exception e) {
-                                
+						foreach (string steamid in GameManager.Instance.persistentPlayers.Players.Keys) {
+							PrintFriendsOfPlayer (steamid);
+						}
+					} else {
+						string steamid = null;
+
+						ClientInfo ci = ConsoleHelper.ParseParamIdOrName (_params [0]);
+						if (ci != null) {
+							steamid = ci.playerId;
+						}
+
+						if (steamid == null) {
+							if (ConsoleHelper.ParseParamSteamIdValid (_params [0])) {
+								steamid = _params [0];
 							}
 						}
-					} else { 
-						ClientInfo ci = ConsoleHelper.ParseParamIdOrName (_params [0]);
-						if (ci == null) {
+
+						if (steamid == null) {
 							SdtdConsole.Instance.Output ("Playername or entity/steamid id not found.");
 							return;
 						}
-						EntityPlayer ep = GameManager.Instance.World.Players.dict [ci.entityId];
-						PersistentPlayerData data = GameManager.Instance.persistentPlayers.GetPlayerDataFromEntityID (ci.entityId);
 
-						HashSet<string>.Enumerator enumerator = data.ACL.GetEnumerator ();
-						//int count = 0;
-						String friends = "";
-						while (enumerator.MoveNext ()) {
-							string str = enumerator.Current;
-							if (!friends.Equals ("")) {
-								friends += ",";
-							}
-							friends += str;
-                           
-							//Player p = PersistentContainer.Instance.Players[str, false];
-							//if (p == null)
-							//{
-							//  continue;
-							//}
-							//count++;
-							//SdtdConsole.Instance.Output(count + ": " + p.EntityID + " - " + p.Name);
-						}
-						SdtdConsole.Instance.Output ("FriendsOf id=" + ci.entityId + ", friends=" + friends);
+						PrintFriendsOfPlayer (steamid);
 					}
 				}
@@ -87,4 +60,21 @@
 			}
 		}
+
+		private void PrintFriendsOfPlayer (string _steamid) {
+			PersistentPlayerData data = GameManager.Instance.persistentPlayers.GetPlayerData (_steamid);
+			string friends = "";
+			if (data != null && data.ACL != null) {
+				foreach (string friend in data.ACL) {
+					if (!string.IsNullOrEmpty (friend)) {
+						if (!friends.Equals ("")) {
+							friends += ",";
+						}
+						friends += friend;
+					}
+				}
+			}
+			SdtdConsole.Instance.Output ("FriendsOf id=" + _steamid + ", friends=" + friends);
+		}
+
 	}
 }
