- Timestamp:
- Sep 4, 2018, 2:33:52 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/PersistentData/Players.cs
r325 r326 6 6 [Serializable] 7 7 public class Players { 8 private readonly Dictionary<string, Player> players = new Dictionary<string,Player> ();8 private readonly Dictionary<string, Player> players = new CaseInsensitiveStringDictionary<Player> (); 9 9 10 10 public Player this [string steamId, bool create] { … … 18 18 } 19 19 20 if (create && steamId != null && steamId.Length == 17) { 21 Log.Out ("Created new player entry for ID: " + steamId); 22 Player p = new Player (steamId); 23 players.Add (steamId, p); 24 return p; 20 if (!create || steamId.Length != 17) { 21 return null; 25 22 } 26 23 27 return null; 24 Log.Out ("Created new player entry for ID: " + steamId); 25 Player p = new Player (steamId); 26 players.Add (steamId, p); 27 return p; 28 28 } 29 29 } … … 56 56 } 57 57 58 int entityId = -1;58 int entityId; 59 59 if (int.TryParse (_nameOrId, out entityId)) { 60 60 foreach (KeyValuePair<string, Player> kvp in players) { … … 65 65 } 66 66 67 _nameOrId = _nameOrId.ToLower ();68 67 foreach (KeyValuePair<string, Player> kvp in players) { 69 string name = kvp.Value.Name .ToLower ();68 string name = kvp.Value.Name; 70 69 if (_ignoreColorCodes) { 71 70 name = Regex.Replace (name, "\\[[0-9a-fA-F]{6}\\]", ""); 72 71 } 73 72 74 if (kvp.Value.IsOnline && name.Equals (_nameOrId)) {73 if (kvp.Value.IsOnline && name.EqualsCaseInsensitive (_nameOrId)) { 75 74 return kvp.Key; 76 75 }
Note:
See TracChangeset
for help on using the changeset viewer.