Added comments to some functions, renamed GetClientByName to GetClientByNameOrId

This commit is contained in:
hydrant
2018-11-01 12:13:20 +01:00
parent e5be3783f6
commit 15498b1baf
14 changed files with 133 additions and 41 deletions

View File

@@ -19,6 +19,13 @@ namespace reallife_gamemode.Server.Extensions
{
public static class ClientExtension
{
/// <summary>
/// Gibt das User-Objekt eines Client's zurück
/// Gibt nichts zurück, wenn der Client nicht eingeloggt ist
/// </summary>
/// <param name="client">Der Client, dessen User man bekommen möchte</param>
/// <param name="context">Ein eventuell vorhandener Datenbank-Context, falls man Änderungen in der Datenbank vornehmen will</param>
/// <returns></returns>
public static User GetUser(this Client client, DatabaseContext context = null)
{
if (!client.IsLoggedIn()) return null;
@@ -35,6 +42,11 @@ namespace reallife_gamemode.Server.Extensions
}
}
/// <summary>
/// Gibt zurück, ob ein Client eingeloggt ist
/// </summary>
/// <param name="player">Der Client, dessen Login-Status man bekommen möchte</param>
/// <returns></returns>
public static bool IsLoggedIn(this Client player)
{
return player.HasData("isLoggedIn") ? player.GetData("isLoggedIn") : false;