fCraft.Chat.SendMe C# (CSharp) Method

SendMe() public static method

Sends an action message (/Me).
public static SendMe ( [ player, [ rawMessage ) : bool
player [ Player writing the message.
rawMessage [ Message text.
return bool
        public static bool SendMe( [NotNull] Player player, [NotNull] string rawMessage ) {
            if ( player == null )
                throw new ArgumentNullException( "player" );
            if ( rawMessage == null )
                throw new ArgumentNullException( "rawMessage" );
            var recepientList = Server.Players.NotIgnoring( player );

            string formattedMessage = String.Format( "&M*{0} {1}",
                                                     player.Name,
                                                     rawMessage );

            var e = new ChatSendingEventArgs( player,
                                              rawMessage,
                                              formattedMessage,
                                              ChatMessageType.Me,
                                              recepientList );

            if ( !SendInternal( e ) )
                return false;

            Logger.Log( LogType.GlobalChat,
                        "(me){0}: {1}", player.Name, rawMessage );
            return true;
        }

Usage Example

Example #1
0
        static void MeHandler(Player player, Command cmd)
        {
            if (player.Info.IsMuted)
            {
                player.MessageMuted();
                return;
            }

            if (player.DetectChatSpam())
            {
                return;
            }

            string msg = cmd.NextAll().Trim();

            if (msg.Length > 0)
            {
                player.Info.ProcessMessageWritten();
                if (player.Can(Permission.UseColorCodes) && msg.Contains("%"))
                {
                    msg = Color.ReplacePercentCodes(msg);
                }
                Chat.SendMe(player, msg);
            }
        }
All Usage Examples Of fCraft.Chat::SendMe