Ejemplo n.º 1
0
        /// <summary>
        /// Send a chat message from the user.
        /// </summary>
        /// <param name="clean">The pre-cleaned message to be sent.</param>
        internal void ExecuteChat(string clean)
        {
            //Event
            ClientPreChatEventArgs e1 = new ClientPreChatEventArgs(this, clean);

            _player.Server.PluginManager.CallEvent(Event.PlayerPreChat, 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.PlayerChat, e2);
                if (e2.EventCanceled)
                {
                    return;
                }
                clean = e2.Message;
                //End Event

                _player.Server.Broadcast(Chat.Format(_player.DisplayName, clean));
                Logger.Log(LogLevel.Info, "{0}: {1}", _player.DisplayName, clean);
            }
        }
Ejemplo n.º 2
0
 public void OnPlayerChat(ClientChatEventArgs e)
 {
     if (e.EventCanceled)
     {
         return;
     }
     e.Message = ChatColor.Blue + e.Message;
 }
Ejemplo n.º 3
0
 private void OnPlayerChat(ClientChatEventArgs e)
 {
     foreach (EventListener bl in Plugins)
     {
         IPlayerListener pl = (IPlayerListener)bl.Listener;
         if (bl.Event == Event.PlayerChat)
         {
             pl.OnPlayerChat(e);
         }
     }
 }