Changed ClientService.GetClientFromName() to case-insensitive names

This commit is contained in:
sprayzcs
2018-09-25 10:57:10 +02:00
parent f1dadfade9
commit f634af01ab

View File

@@ -21,13 +21,14 @@ namespace reallife_gamemode.Server.Services
* Gibt "null" zurück, falls kein Client gefunden wurde * Gibt "null" zurück, falls kein Client gefunden wurde
*/ */
Client toReturn = null; Client toReturn = null;
name = name.ToLower();
List<Client> playerList = NAPI.Pools.GetAllPlayers(); List<Client> playerList = NAPI.Pools.GetAllPlayers();
toReturn = playerList.Find(p => p.Name == name); toReturn = playerList.Find(p => p.Name.ToLower() == name);
if(toReturn == null) if(toReturn == null)
{ {
toReturn = playerList.Find(p => p.Name.StartsWith(name)); toReturn = playerList.Find(p => p.Name.ToLower().StartsWith(name));
} }
return toReturn; return toReturn;