internal Task <bool> SendFriendRequest(Player from, long to_permanent_id) { if (disposedValue) { Log.Warning("Tried to send friend request while player auth is disposing."); return(null); } return(Task.Run(async() => { if (!await db.AddPendingFriendRequest(from.permanent_id, to_permanent_id)) { return false; } Player to_player; if (permanent_id_mapped_players.TryGetValue(to_permanent_id, out to_player)) { var ev = new Event { FriendRequest = new Event_FriendRequest { BasicPlayerInfo = from.BasicPlayerInfo() } }; to_player.event_stream.Enqueue(ev); } return true; })); }