예제 #1
0
 public static Task <NotificationSendResult> SendPairNotification(string type, BasePlayer player, string title, string message, Dictionary <string, string> data)
 {
     if (App.port < 0)
     {
         return(Task.FromResult(NotificationSendResult.Disabled));
     }
     if (!Server.CanSendPairingNotification(player.userID))
     {
         return(Task.FromResult(NotificationSendResult.RateLimited));
     }
     if (data == null)
     {
         data = GetPlayerPairingData(player);
     }
     data.Add("type", type);
     return(NotificationList.SendNotificationTo(player.userID, NotificationChannel.Pairing, title, message, data));
 }
예제 #2
0
        public static void SendNotification(this RelationshipManager.PlayerTeam team, NotificationChannel channel, string title, string body, Dictionary <string, string> data, ulong ignorePlayer = 0uL)
        {
            List <ulong> obj = Facepunch.Pool.GetList <ulong>();

            foreach (ulong member in team.members)
            {
                if (member != ignorePlayer)
                {
                    BasePlayer basePlayer = RelationshipManager.FindByID(member);
                    if (basePlayer == null || basePlayer.net?.connection == null)
                    {
                        obj.Add(member);
                    }
                }
            }
            NotificationList.SendNotificationTo(obj, channel, title, body, data);
            Facepunch.Pool.FreeList(ref obj);
        }