internal void OnPlayerJoin(UnturnedPlayer player) { JArray arr = PlayerConfig.Document["Players"] as JArray; JToken token = arr.FirstOrDefault(a => (string)a["Steam64"] == player.SteamID.ToString()); if (token != null) { player.Cooldown = (int)token["Cooldown"]; player.TotalKills = (int)token["Kills"]; player.TotalDeaths = (int)token["Deaths"]; if (token["Permissions"] is JArray) { foreach (JToken t in (JArray)token["Permissions"]) { if (player.Permissions.Contains((string)t)) { continue; } player.AddPermission((string)t); } } else { if (!player.Permissions.Contains((string)token["Permissions"])) { player.AddPermission((string)token["Permissions"]); } } if (token["Groups"] is JArray) { foreach (JToken t in (JArray)token["Groups"]) { Group g = GM.Groups.FirstOrDefault(a => a.ID == (string)t); if (g == null || player.Groups.Contains(g)) { continue; } player.AddGroup(g); } } else { Group g = GM.Groups.FirstOrDefault(a => a.ID == (string)token["Groups"]); if (g != null && !player.Groups.Contains(g)) { player.AddGroup(g); } } if (token["Prefixes"] is JArray) { foreach (JToken t in (JArray)token["Prefixes"]) { if (player.Prefixes.Contains((string)t)) { continue; } player.AddPrefix((string)t); } } else { if (!player.Prefixes.Contains((string)token["Prefixes"])) { player.AddPrefix((string)token["Prefixes"]); } } if (token["Suffixes"] is JArray) { foreach (JToken t in (JArray)token["Suffixes"]) { if (player.Suffixes.Contains((string)t)) { continue; } player.AddSuffix((string)t); } } else { if (!player.Suffixes.Contains((string)token["Suffixes"])) { player.AddSuffix((string)token["Suffixes"]); } } } player.UnturnedCharacterName = player.CharacterName; player.UnturnedNickName = player.NickName; player.CharacterName = player.GetPrefix() + player.UnturnedCharacterName + player.GetSuffix(); player.NickName = player.GetPrefix() + player.UnturnedNickName + player.GetSuffix(); player.Loaded = true; }