private string GetOwnerPlayer(BuildingPrivlidge priv, ulong id = 0UL) { if (priv == null || !priv.AnyAuthed()) { return(string.Empty); } if (config.General.CupboardSettings.anyAuthed) { for (int i = 0; i < priv.authorizedPlayers.Count; i++) { var player = priv.authorizedPlayers[i]; if (player != null && permission.UserHasPermission(player.userid.ToString(), config.General.permission)) { return(player.userid.ToString()); } } } else { var player = priv.authorizedPlayers.Find(x => x.userid == id); if (player != null) { return(player.userid.ToString()); } } return(string.Empty); }
object TestForFriends(BuildingPrivlidge priviledge, BasePlayer player, bool isDamage = false) { DevMsg($"-------------------------------------------"); DevMsg($"Any authed: {priviledge.AnyAuthed()}"); if (FriendsAPI != null && priviledge.AnyAuthed()) { bool isFriend = false; List <string> ids = (from id in priviledge.authorizedPlayers select id.userid.ToString()).ToList(); foreach (string uid in ids) { DevMsg($"------------------------"); DevMsg($"Current uid: {uid}"); if (IsFriend(player, uid)) { DevMsg($"Found Friend: {uid}"); isFriend = true; } else if (Clans != null && IsClanMember(player, uid)) { DevMsg($"Found Clanmember: {uid}"); isFriend = true; } } DevMsg($"isFriend: {isFriend}"); if (!isFriend) { if (!isDamage) { SendChatMessage(player, GetMsg("Blocked Authorization", player.UserIDString)); } return(false); } } return(null); }