/// <summary>
        /// Send a chat message from the user.
        /// </summary>
        /// <param name="clean">The pre-cleaned message to be sent.</param>
        public void ExecuteChat(string clean)
        {
            //Event
            ClientPreChatEventArgs e1 = new ClientPreChatEventArgs(this, clean);
            _Player.Server.PluginManager.CallEvent(Event.PLAYER_PRE_CHAT, e1);
            if (e1.EventCanceled) return;
            clean = e1.Message;
            //End Event

            if (_Player.IsMuted)
            {
                SendMessage("You have been muted");
                return;
            }

            if ((clean = OnChat(clean)) != null)
            {
                //Event
                ClientChatEventArgs e2 = new ClientChatEventArgs(this, clean);
                _Player.Server.PluginManager.CallEvent(Event.PLAYER_CHAT, e2);
                if (e2.EventCanceled) return;
                clean = e2.Message;
                //End Event

                _Player.Server.Broadcast(Chat.Format(_Player.DisplayName, clean));
                Logger.Log(Logger.LogLevel.Info, "{0}: {1}", _Player.DisplayName, clean);
            }
        }
Beispiel #2
0
 public virtual void OnPlayerChat(ClientChatEventArgs e)
 {
 }
Beispiel #3
0
 private void OnPlayerChat(ClientChatEventArgs e)
 {
     foreach (EventListener bl in Plugins)
     {
         PlayerListener pl = (PlayerListener)bl.Listener;
         if (bl.Event == Event.PLAYER_CHAT)
             pl.OnPlayerChat(e);
     }
 }