Esempio n. 1
0
        void SendMsg(string msg)
        {
            var msgFiltered_p = Regex.Replace(msg, filterTags, String.Empty);
            var msgFiltered   = Regex.Replace(msgFiltered_p, @"<\/?color.*?>", String.Empty);

            if (configData.notifications.chat)
            {
                Server.Broadcast(msg, null, iconID);
            }
            if (configData.notifications.popup)
            {
                PopupNotifications?.Call("CreatePopupNotification", msgFiltered_p);
            }
            if (configData.discordMsg.enabled && configData.discordMsg.webhookURL.Contains("/api/webhooks/"))
            {
                DiscordMessages?.Call("API_SendTextMessage", configData.discordMsg.webhookURL, Lang("DiscordMessage", null, msgFiltered));
            }
            if (configData.misc.logToConsole)
            {
                Puts(msgFiltered);
            }
            if (configData.misc.logToFile)
            {
                LogToFile("log", $"[{DateTime.Now.ToString("HH:mm:ss")}] {msgFiltered}", this);
            }
        }
Esempio n. 2
0
 private void BroadcastToPlayer(BasePlayer player, string message)
 {
     if (configData.Notifications.UsePopupNotifications && PopupNotifications)
     {
         PopupNotifications?.Call("CreatePopupOnPlayer", message, player, configData.Notifications.PopupDuration);
     }
     else
     {
         SendReply(player, message);
     }
 }