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);
     }
 }
Esempio n. 3
0
        private void OnServerInitialized()
        {
            lang.RegisterMessages(Messages, this);
            permission.RegisterPermission("popupnotifications.send", this);

            panelColor  = UI.Color(configData.Options.Color, configData.Options.Alpha);
            buttonColor = UI.Color(configData.Options.CloseColor, configData.Options.CloseAlpha);
            font        = configData.Options.Font;
            fontSize    = configData.Options.FontSize;

            ins = this;
        }
Esempio n. 4
0
        private void Unload()
        {
            foreach (BasePlayer player in BasePlayer.activePlayerList)
            {
                Notifier notifier = player.GetComponent <Notifier>();
                if (notifier != null)
                {
                    UnityEngine.Object.Destroy(notifier);
                }
            }

            ins = null;
        }