fCraft  0.638
Custom Minecraft Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events
fCraft.Chat Class Reference

Helper class for handling player-generated chat. More...

Static Public Member Functions

static bool SendGlobal ([NotNull] Player player,[NotNull] string rawMessage)
 Sends a global (white) chat.
 
static bool SendMe ([NotNull] Player player,[NotNull] string rawMessage)
 Sends an action message (/Me).
 
static bool SendPM ([NotNull] Player from,[NotNull] Player to,[NotNull] string rawMessage)
 Sends a private message (PM). Does NOT send a copy of the message to the sender.
 
static bool SendRank ([NotNull] Player player,[NotNull] Rank rank,[NotNull] string rawMessage)
 Sends a rank-wide message (@Rank message).
 
static bool SendSay ([NotNull] Player player,[NotNull] string rawMessage)
 Sends a global announcement (/Say).
 
static bool SendStaff ([NotNull] Player player,[NotNull] string rawMessage)
 Sends a staff message (/Staff).
 
static bool ContainsInvalidChars ([NotNull] string message)
 Checks for unprintable or illegal characters in a message.
 
static string ReplaceTextKeywords ([NotNull] Player player,[NotNull] string input)
 Replaces keywords with appropriate values. See http://www.fcraft.net/wiki/Constants
 
static string ReplaceNewlines ([NotNull] string message)
 Replaces newline codes (&n and &N) with actual newlines (
).
 
static string StripNewlines ([NotNull] string message)
 Removes newlines (
) and newline codes (&n and &N).
 
static string StripEmotes ([NotNull] string message)
 Strips all emote symbols (ASCII control characters). Does not strip UTF-8 equivalents of emotes.
 
static string ReplaceEmoteKeywords ([NotNull] string message)
 Replaces emote keywords with actual emotes, using Chat.EmoteKeywords mapping. Keywords are enclosed in curly braces, and are case-insensitive.
 
static string ReplacePercentColorCodes ([NotNull] string message, bool allowNewlines)
 Substitutes percent color codes (e.g. C) with equivalent ampersand color codes (&C). Also replaces newline codes (N) with actual newlines (
).
 
static string UnescapeBackslashes ([NotNull] string message)
 Unescapes backslashes. Any paid of backslashes (\) is converted to a single one ().
 
static string ReplaceUncodeWithEmotes ([NotNull] string input)
 Replaces UTF-8 symbol characters with ASCII control characters, matching Code Page 437. Opposite of ReplaceEmotesWithUncode.
 
static string ReplaceEmotesWithUncode ([NotNull] string input)
 Replaces ASCII control characters with UTF-8 symbol characters, matching Code Page 437. Opposite of ReplaceUncodeWithEmotes.
 

Static Public Attributes

static readonly Dictionary
< string, char > 
EmoteKeywords
 List of chat keywords, and emotes that they stand for.
 

Events

static EventHandler
< ChatSendingEventArgs
Sending
 Occurs when a chat message is about to be sent. Cancelable.
 
static EventHandler
< ChatSentEventArgs
Sent
 Occurs after a chat message has been sent.
 

Detailed Description

Helper class for handling player-generated chat.

Member Function Documentation

static bool fCraft.Chat.ContainsInvalidChars ( [NotNull] string  message)
static

Checks for unprintable or illegal characters in a message.

Parameters
messageMessage to check.
Returns
True if message contains invalid chars. False if message is clean.
Exceptions
ArgumentNullExceptionmessage is null.
static string fCraft.Chat.ReplaceEmoteKeywords ( [NotNull] string  message)
static

Replaces emote keywords with actual emotes, using Chat.EmoteKeywords mapping. Keywords are enclosed in curly braces, and are case-insensitive.

Parameters
messageString to process.
Returns
Processed string.
Exceptions
ArgumentNullExceptioninput is null.
static string fCraft.Chat.ReplaceEmotesWithUncode ( [NotNull] string  input)
static

Replaces ASCII control characters with UTF-8 symbol characters, matching Code Page 437. Opposite of ReplaceUncodeWithEmotes.

Parameters
inputString to process.
Returns
Processed string, with its ASCII control characters replaced.
Exceptions
ArgumentNullExceptioninput is null.
static string fCraft.Chat.ReplaceNewlines ( [NotNull] string  message)
static

Replaces newline codes (&n and &N) with actual newlines (
).

Parameters
messageMessage to process.
Returns
Processed message.
Exceptions
ArgumentNullExceptionmessage is null.
static string fCraft.Chat.ReplacePercentColorCodes ( [NotNull] string  message,
bool  allowNewlines 
)
static

Substitutes percent color codes (e.g. C) with equivalent ampersand color codes (&C). Also replaces newline codes (N) with actual newlines (
).

Parameters
messageMessage to process.
allowNewlinesWhether newlines are allowed.
Returns
Processed string.
Exceptions
ArgumentNullExceptionmessage is null.
static string fCraft.Chat.ReplaceTextKeywords ( [NotNull] Player  player,
[NotNull] string  input 
)
static

Replaces keywords with appropriate values. See http://www.fcraft.net/wiki/Constants

static string fCraft.Chat.ReplaceUncodeWithEmotes ( [NotNull] string  input)
static

Replaces UTF-8 symbol characters with ASCII control characters, matching Code Page 437. Opposite of ReplaceEmotesWithUncode.

Parameters
inputString to process.
Returns
Processed string, with its UTF-8 symbol characters replaced.
Exceptions
ArgumentNullExceptioninput is null.
static bool fCraft.Chat.SendGlobal ( [NotNull] Player  player,
[NotNull] string  rawMessage 
)
static

Sends a global (white) chat.

Parameters
playerPlayer writing the message.
rawMessageMessage text.
Returns
True if message was sent, false if it was cancelled by an event callback.
static bool fCraft.Chat.SendMe ( [NotNull] Player  player,
[NotNull] string  rawMessage 
)
static

Sends an action message (/Me).

Parameters
playerPlayer writing the message.
rawMessageMessage text.
Returns
True if message was sent, false if it was cancelled by an event callback.
static bool fCraft.Chat.SendPM ( [NotNull] Player  from,
[NotNull] Player  to,
[NotNull] string  rawMessage 
)
static

Sends a private message (PM). Does NOT send a copy of the message to the sender.

Parameters
fromSender player.
toRecepient player.
rawMessageMessage text.
Returns
True if message was sent, false if it was cancelled by an event callback.
static bool fCraft.Chat.SendRank ( [NotNull] Player  player,
[NotNull] Rank  rank,
[NotNull] string  rawMessage 
)
static

Sends a rank-wide message (@Rank message).

Parameters
playerPlayer writing the message.
rankTarget rank.
rawMessageMessage text.
Returns
True if message was sent, false if it was cancelled by an event callback.
static bool fCraft.Chat.SendSay ( [NotNull] Player  player,
[NotNull] string  rawMessage 
)
static

Sends a global announcement (/Say).

Parameters
playerPlayer writing the message.
rawMessageMessage text.
Returns
True if message was sent, false if it was cancelled by an event callback.
static bool fCraft.Chat.SendStaff ( [NotNull] Player  player,
[NotNull] string  rawMessage 
)
static

Sends a staff message (/Staff).

Parameters
playerPlayer writing the message.
rawMessageMessage text.
Returns
True if message was sent, false if it was cancelled by an event callback.
static string fCraft.Chat.StripEmotes ( [NotNull] string  message)
static

Strips all emote symbols (ASCII control characters). Does not strip UTF-8 equivalents of emotes.

Parameters
messageMessage to strip emotes from.
Returns
Message with its emotes stripped.
static string fCraft.Chat.StripNewlines ( [NotNull] string  message)
static

Removes newlines (
) and newline codes (&n and &N).

Parameters
messageMessage to process.
Returns
Processed message.
Exceptions
ArgumentNullExceptionmessage is null.
static string fCraft.Chat.UnescapeBackslashes ( [NotNull] string  message)
static

Unescapes backslashes. Any paid of backslashes (\) is converted to a single one ().

Parameters
messageString to process.
Returns
Processed string.
Exceptions
ArgumentNullExceptionmessage is null.

Member Data Documentation

readonly Dictionary<string, char> fCraft.Chat.EmoteKeywords
static

List of chat keywords, and emotes that they stand for.

Event Documentation

EventHandler<ChatSendingEventArgs> fCraft.Chat.Sending
static

Occurs when a chat message is about to be sent. Cancelable.

EventHandler<ChatSentEventArgs> fCraft.Chat.Sent
static

Occurs after a chat message has been sent.


The documentation for this class was generated from the following file: