diff --git a/Packages/com.trytalo.talo/Runtime/Entities/Player.cs b/Packages/com.trytalo.talo/Runtime/Entities/Player.cs index 2737535..cef4f4f 100644 --- a/Packages/com.trytalo.talo/Runtime/Entities/Player.cs +++ b/Packages/com.trytalo.talo/Runtime/Entities/Player.cs @@ -1,8 +1,8 @@ using UnityEngine; using System.Linq; using System; -using System.Threading.Tasks; - +using System.Threading.Tasks; + namespace TaloGameServices { [Serializable] @@ -19,8 +19,8 @@ public override string ToString() public string GetProp(string key, string fallback = null) { - Prop prop = props.First((prop) => prop.key == key); - return prop?.key ?? fallback; + Prop prop = props.FirstOrDefault((prop) => prop.key == key); + return prop?.value ?? fallback; } public async Task SetProp(string key, string value) @@ -45,17 +45,22 @@ public async Task SetProp(string key, string value) public async Task DeleteProp(string key) { - Prop prop = props.First((prop) => prop.key == key); + Prop prop = props.FirstOrDefault((prop) => prop.key == key); if (prop == null) throw new Exception($"Prop with key {key} does not exist"); prop.value = null; await Talo.Players.Update(); - } - - public bool IsInGroup(string groupId) - { - return groups.Any((group) => group.id == groupId); + } + + public bool IsInGroupID(string groupId) + { + return groups.Any((group) => group.id == groupId); + } + + public bool IsInGroupName(string groupName) + { + return groups.Any((group) => group.name == groupName); } } }