added editorconfig and formatted code

This commit is contained in:
hydrant
2019-07-17 19:52:55 +02:00
parent ada071cc93
commit 123ab7d07b
146 changed files with 10839 additions and 10715 deletions

View File

@@ -11,34 +11,34 @@ using System.Text;
namespace ReallifeGamemode.Server.Services
{
class ClientService
class ClientService
{
/// <summary>
/// Gibt einen Client anhand seines Namens oder der ID zurück
/// </summary>
/// <param name="nameOrId">Die ID oder der Name, nach dem gesucht werden soll</param>
/// <returns></returns>
public static Client GetClientByNameOrId(string nameOrId)
{
/// <summary>
/// Gibt einen Client anhand seines Namens oder der ID zurück
/// </summary>
/// <param name="nameOrId">Die ID oder der Name, nach dem gesucht werden soll</param>
/// <returns></returns>
public static Client GetClientByNameOrId(string nameOrId)
{
Client toReturn = null;
nameOrId = nameOrId.ToLower();
Client toReturn = null;
nameOrId = nameOrId.ToLower();
List<Client> playerList = NAPI.Pools.GetAllPlayers();
List<Client> playerList = NAPI.Pools.GetAllPlayers();
if (int.TryParse(nameOrId, out int id))
{
toReturn = playerList.Find(p => p.Handle.Value == id);
return toReturn;
}
if (int.TryParse(nameOrId, out int id))
{
toReturn = playerList.Find(p => p.Handle.Value == id);
return toReturn;
}
toReturn = playerList.Find(p => p.Name.ToLower() == nameOrId);
toReturn = playerList.Find(p => p.Name.ToLower() == nameOrId);
if (toReturn == null)
{
toReturn = playerList.Find(p => p.Name.ToLower().StartsWith(nameOrId));
}
if (toReturn == null)
{
toReturn = playerList.Find(p => p.Name.ToLower().StartsWith(nameOrId));
}
return toReturn;
}
return toReturn;
}
}
}