PocketMine
TextFormat Class Reference

Static Public Member Functions

static tokenize ($string)
 
static clean ($string, $removeFormat=true)
 
static toJSON ($string)
 
static toHTML ($string)
 
static toANSI ($string)
 

Data Fields

const ESCAPE = "\xc2\xa7"
 
const BLACK = TextFormat::ESCAPE . "0"
 
const DARK_BLUE = TextFormat::ESCAPE . "1"
 
const DARK_GREEN = TextFormat::ESCAPE . "2"
 
const DARK_AQUA = TextFormat::ESCAPE . "3"
 
const DARK_RED = TextFormat::ESCAPE . "4"
 
const DARK_PURPLE = TextFormat::ESCAPE . "5"
 
const GOLD = TextFormat::ESCAPE . "6"
 
const GRAY = TextFormat::ESCAPE . "7"
 
const DARK_GRAY = TextFormat::ESCAPE . "8"
 
const BLUE = TextFormat::ESCAPE . "9"
 
const GREEN = TextFormat::ESCAPE . "a"
 
const AQUA = TextFormat::ESCAPE . "b"
 
const RED = TextFormat::ESCAPE . "c"
 
const LIGHT_PURPLE = TextFormat::ESCAPE . "d"
 
const YELLOW = TextFormat::ESCAPE . "e"
 
const WHITE = TextFormat::ESCAPE . "f"
 
const OBFUSCATED = TextFormat::ESCAPE . "k"
 
const BOLD = TextFormat::ESCAPE . "l"
 
const STRIKETHROUGH = TextFormat::ESCAPE . "m"
 
const UNDERLINE = TextFormat::ESCAPE . "n"
 
const ITALIC = TextFormat::ESCAPE . "o"
 
const RESET = TextFormat::ESCAPE . "r"
 

Detailed Description

Class used to handle Minecraft chat format, and convert it to other formats like ANSI or HTML

Member Function Documentation

static clean (   $string,
  $removeFormat = true 
)
static

Cleans the string from Minecraft codes and ANSI Escape Codes

Parameters
string$string
bool$removeFormat
Returns
mixed
static toANSI (   $string)
static

Returns a string with colorized ANSI Escape codes

Parameters
$string
Returns
string
static toHTML (   $string)
static

Returns an HTML-formatted string with colors/markup

Parameters
string | array$string
Returns
string
static toJSON (   $string)
static

Returns an JSON-formatted string with colors/markup

Parameters
string | array$string
Returns
string
static tokenize (   $string)
static

Splits the string by Format tokens

Parameters
string$string
Returns
array

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