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

Static class with definitions of Minecraft color codes, parsers, converters, and utilities. More...

Static Public Member Functions

static string GetName (char code)
 Looks up color name for the given character color code. Codes are case-insensitive. Both standard (0-F) and fCraft-specific (H, I, M, P, R, S, W, and Y) color codes are accepted. Assigned (standard) colors are substituted for fCraft-specific color codes.
 
static string GetName ([CanBeNull] string color)
 Looks up color name for the given color string. Accepts any input format that is recognized by Color.Parse(String).
 
static string Parse (char code)
 Converts the given character color code into standard representation (ampersand-color-code). Codes are case-insensitive. Both standard (0-F) and fCraft-specific (H, I, M, P, R, S, W, and Y) color codes are accepted. Assigned (standard) colors are substituted for fCraft-specific color codes.
 
static string Parse ([CanBeNull] string color)
 Converts the given character color code into standard representation (ampersand-color-code). Accepts 2-character ampersand color codes, single character codes, and color names. Does not accept 2-character percent-codes. All input is case-insensitive. Both standard (0-F) and fCraft-specific (H, I, M, P, R, S, W, and Y) color codes are accepted. Assigned (standard) colors are substituted for fCraft-specific color codes.
 
static bool IsStandardColorCode (char code)
 Checks whether a color code is valid (is a recognized standard color code). Standard color codes are hexadecimal digits. Both uppercase and lowercase digits are accepted. Does not recognize fCraft-specific color codes.
 
static bool IsColorCode (char code)
 Checks whether a color code is valid. Both uppercase and lowercase digits are accepted. Both standard (0-F) and fCraft-specific (H, I, M, P, R, S, W, and Y) color codes are accepted.
 
static void SubstituteSpecialColors ([NotNull] StringBuilder sb)
 Substitutes all fCraft-specific ampersand color codes (like &S/Color.Sys) with the assigned Minecraft colors (like &E/Color.Yellow). Strips any unrecognized sequences. Does not replace percent-codes. Note that LineWrapper itself does this substitution internally.
 
static string SubstituteSpecialColors ([NotNull] string input)
 Substitutes all fCraft-specific ampersand color codes (like &S/Color.Sys) with the assigned Minecraft colors (like &E/Color.Yellow). Strips any unrecognized sequences. Does not replace percent-codes. Note that LineWrapper itself does this substitution internally.
 
static string StripColors ([NotNull] string message)
 Strips Minecraft color codes from a given string. Removes all ampersand-character sequences, including standard, fCraft-specific color codes, and newline codes. Does not remove percent-color-codes.
 
static void MinecraftToIrcColors ([NotNull] StringBuilder sb)
 Replaces Minecraft color codes with equivalent IRC color codes, in the given StringBuilder. Opposite of IrcToMinecraftColors method.
 
static string MinecraftToIrcColors ([NotNull] string input)
 Replaces Minecraft color codes with equivalent IRC color codes, in the given string. Opposite of IrcToMinecraftColors method.
 
static void IrcToMinecraftColors ([NotNull] StringBuilder sb)
 Replaces IRC color codes with equivalent Minecraft color codes, in the given StringBuilder. Opposite of MinecraftToIrcColors method.
 
static string IrcToMinecraftColors ([NotNull] string input)
 Replaces IRC color codes with equivalent Minecraft color codes, in the given string. Opposite of MinecraftToIrcColors method.
 

Public Attributes

const string Black = "&0"
 
const string SysDefault = Yellow
 Default color of system messages, nickserv, chanserv. Yellow.
 
const string HelpDefault = Lime
 Default color of help messages, /help. Lime.
 
const string SayDefault = Green
 Default color of say messages (/say) and timer announcements. Green.
 
const string AnnouncementDefault = Green
 Default color of announcements, server announcements. Green.
 
const string PMDefault = Aqua
 Default color of personal messages. Aqua.
 
const string IRCDefault = Purple
 Default color of IRC chat. Purple.
 
const string MeDefault = Purple
 Default color of /me command. Purple.
 
const string WarningDefault = Red
 Default color of warning messages. Red.
 

Static Public Attributes

static readonly SortedList
< char, string > 
ColorNames
 List of color names indexed by their id.
 

Properties

static string Sys [get, set]
 Color of system messages, nickserv, chanserv.
 
static string Help [get, set]
 Color of help messages, /help.
 
static string Say [get, set]
 Color of say messages (/say) and timer announcements.
 
static string Announcement [get, set]
 Color of announcements, server announcements.
 
static string PM [get, set]
 Color of personal messages.
 
static string IRC [get, set]
 Color of IRC chat.
 
static string Me [get, set]
 Color of /me command.
 
static string Warning [get, set]
 Color of warning messages.
 

Detailed Description

Static class with definitions of Minecraft color codes, parsers, converters, and utilities.

Member Function Documentation

static string fCraft.Color.GetName ( char  code)
static

Looks up color name for the given character color code. Codes are case-insensitive. Both standard (0-F) and fCraft-specific (H, I, M, P, R, S, W, and Y) color codes are accepted. Assigned (standard) colors are substituted for fCraft-specific color codes.

Parameters
codeColor code character.
Returns
Lowercase color name if input code was recognized; otherwise null.
static string fCraft.Color.GetName ( [CanBeNull] string  color)
static

Looks up color name for the given color string. Accepts any input format that is recognized by Color.Parse(String).

Parameters
colorString representation of a color, empty string, or null.
Returns
Lowercase color name. If input is an empty string, returns an empty string. If input is null or cannot be parsed, returns null.
static void fCraft.Color.IrcToMinecraftColors ( [NotNull] StringBuilder  sb)
static

Replaces IRC color codes with equivalent Minecraft color codes, in the given StringBuilder. Opposite of MinecraftToIrcColors method.

Parameters
sbStringBuilder objects, the contents of which will be processed.
Exceptions
ArgumentNullExceptionsb is null.
static string fCraft.Color.IrcToMinecraftColors ( [NotNull] string  input)
static

Replaces IRC color codes with equivalent Minecraft color codes, in the given string. Opposite of MinecraftToIrcColors method.

Parameters
inputString to process.
Returns
A processed string.
Exceptions
ArgumentNullExceptioninput is null.
static bool fCraft.Color.IsColorCode ( char  code)
static

Checks whether a color code is valid. Both uppercase and lowercase digits are accepted. Both standard (0-F) and fCraft-specific (H, I, M, P, R, S, W, and Y) color codes are accepted.

Returns
True if given char is a recognized color code; otherwise false.
static bool fCraft.Color.IsStandardColorCode ( char  code)
static

Checks whether a color code is valid (is a recognized standard color code). Standard color codes are hexadecimal digits. Both uppercase and lowercase digits are accepted. Does not recognize fCraft-specific color codes.

Returns
True if given char is a recognized standard color code; otherwise false.
static void fCraft.Color.MinecraftToIrcColors ( [NotNull] StringBuilder  sb)
static

Replaces Minecraft color codes with equivalent IRC color codes, in the given StringBuilder. Opposite of IrcToMinecraftColors method.

Parameters
sbStringBuilder objects, the contents of which will be processed.
Exceptions
ArgumentNullExceptionsb is null.
static string fCraft.Color.MinecraftToIrcColors ( [NotNull] string  input)
static

Replaces Minecraft color codes with equivalent IRC color codes, in the given string. Opposite of IrcToMinecraftColors method.

Parameters
inputString to process.
Returns
A processed string.
Exceptions
ArgumentNullExceptioninput is null.
static string fCraft.Color.Parse ( char  code)
static

Converts the given character color code into standard representation (ampersand-color-code). Codes are case-insensitive. Both standard (0-F) and fCraft-specific (H, I, M, P, R, S, W, and Y) color codes are accepted. Assigned (standard) colors are substituted for fCraft-specific color codes.

Parameters
codeColor code character.
Returns
Standard Minecraft ampersand-color-code if input code was recognized; otherwise null.
static string fCraft.Color.Parse ( [CanBeNull] string  color)
static

Converts the given character color code into standard representation (ampersand-color-code). Accepts 2-character ampersand color codes, single character codes, and color names. Does not accept 2-character percent-codes. All input is case-insensitive. Both standard (0-F) and fCraft-specific (H, I, M, P, R, S, W, and Y) color codes are accepted. Assigned (standard) colors are substituted for fCraft-specific color codes.

Parameters
colorString representation of a color, empty string, or null.
Returns
If input could be parsed, returns a standard Minecraft ampersand-color-code. If input is an empty string, returns an empty string. If input is null or cannot be parsed, returns null.
static string fCraft.Color.StripColors ( [NotNull] string  message)
static

Strips Minecraft color codes from a given string. Removes all ampersand-character sequences, including standard, fCraft-specific color codes, and newline codes. Does not remove percent-color-codes.

Parameters
messageString to process.
Returns
A processed string.
Exceptions
ArgumentNullExceptionmessage is null.
static void fCraft.Color.SubstituteSpecialColors ( [NotNull] StringBuilder  sb)
static

Substitutes all fCraft-specific ampersand color codes (like &S/Color.Sys) with the assigned Minecraft colors (like &E/Color.Yellow). Strips any unrecognized sequences. Does not replace percent-codes. Note that LineWrapper itself does this substitution internally.

Parameters
sbStringBuilder, contents of which will be processed.
Returns
Processed string.
Exceptions
ArgumentNullExceptionsb is null.
static string fCraft.Color.SubstituteSpecialColors ( [NotNull] string  input)
static

Substitutes all fCraft-specific ampersand color codes (like &S/Color.Sys) with the assigned Minecraft colors (like &E/Color.Yellow). Strips any unrecognized sequences. Does not replace percent-codes. Note that LineWrapper itself does this substitution internally.

Parameters
inputString to process.
Returns
Processed string.
Exceptions
ArgumentNullExceptioninput is null.

Member Data Documentation

const string fCraft.Color.AnnouncementDefault = Green

Default color of announcements, server announcements. Green.

const string fCraft.Color.Black = "&0"
readonly SortedList<char, string> fCraft.Color.ColorNames
static
Initial value:
= new SortedList<char, string> {
{ '0', "black" },
{ '1', "navy" },
{ '2', "green" },
{ '3', "teal" },
{ '4', "maroon" },
{ '5', "purple" },
{ '6', "olive" },
{ '7', "silver" },
{ '8', "gray" },
{ '9', "blue" },
{ 'a', "lime" },
{ 'b', "aqua" },
{ 'c', "red" },
{ 'd', "magenta" },
{ 'e', "yellow" },
{ 'f', "white" }
}

List of color names indexed by their id.

const string fCraft.Color.HelpDefault = Lime

Default color of help messages, /help. Lime.

const string fCraft.Color.IRCDefault = Purple

Default color of IRC chat. Purple.

const string fCraft.Color.MeDefault = Purple

Default color of /me command. Purple.

const string fCraft.Color.PMDefault = Aqua

Default color of personal messages. Aqua.

const string fCraft.Color.SayDefault = Green

Default color of say messages (/say) and timer announcements. Green.

const string fCraft.Color.SysDefault = Yellow

Default color of system messages, nickserv, chanserv. Yellow.

const string fCraft.Color.WarningDefault = Red

Default color of warning messages. Red.

Property Documentation

string fCraft.Color.Announcement
staticgetset

Color of announcements, server announcements.

string fCraft.Color.Help
staticgetset

Color of help messages, /help.

string fCraft.Color.IRC
staticgetset

Color of IRC chat.

string fCraft.Color.Me
staticgetset

Color of /me command.

string fCraft.Color.PM
staticgetset

Color of personal messages.

string fCraft.Color.Say
staticgetset

Color of say messages (/say) and timer announcements.

string fCraft.Color.Sys
staticgetset

Color of system messages, nickserv, chanserv.

string fCraft.Color.Warning
staticgetset

Color of warning messages.


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