Updated TextFormat constants

This commit is contained in:
Shoghi Cervantes
2014-02-27 00:11:06 +01:00
parent 4a2852bb90
commit 103d0bf2ea
13 changed files with 85 additions and 86 deletions

View File

@@ -19,32 +19,31 @@
*
*/
define("FORMAT_BLACK", "§0");
define("FORMAT_DARK_BLUE", "§1");
define("FORMAT_DARK_GREEN", "§2");
define("FORMAT_DARK_AQUA", "§3");
define("FORMAT_DARK_RED", "§4");
define("FORMAT_DARK_PURPLE", "§5");
define("FORMAT_GOLD", "§6");
define("FORMAT_GRAY", "§7");
define("FORMAT_DARK_GRAY", "§8");
define("FORMAT_BLUE", "§9");
define("FORMAT_GREEN", "§a");
define("FORMAT_AQUA", "§b");
define("FORMAT_RED", "§c");
define("FORMAT_LIGHT_PURPLE", "§d");
define("FORMAT_YELLOW", "§e");
define("FORMAT_WHITE", "§f");
define("FORMAT_OBFUSCATED", "§k");
define("FORMAT_BOLD", "§l");
define("FORMAT_STRIKETHROUGH", "§m");
define("FORMAT_UNDERLINE", "§n");
define("FORMAT_ITALIC", "§o");
define("FORMAT_RESET", "§r");
class TextFormat{
const BLACK = "§0";
const DARK_BLUE = "§1";
const DARK_GREEN = "§2";
const DARK_AQUA = "§3";
const DARK_RED = "§4";
const DARK_PURPLE = "§5";
const GOLD = "§6";
const GRAY = "§7";
const DARK_GRAY = "§8";
const BLUE = "§9";
const GREEN = "§a";
const AQUA = "§b";
const RED = "§c";
const LIGHT_PURPLE = "§d";
const YELLOW = "§e";
const WHITE = "§f";
const OBFUSCATED = "§k";
const BOLD = "§l";
const STRIKETHROUGH = "§m";
const UNDERLINE = "§n";
const ITALIC = "§o";
const RESET = "§r";
public static function tokenize($string){
return preg_split("/(§[0123456789abcdefklmnor])/", $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
}
@@ -60,70 +59,70 @@ class TextFormat{
$newString = "";
foreach($string as $token){
switch($token){
case FORMAT_BOLD:
case TextFormat::BOLD:
break;
case FORMAT_OBFUSCATED:
case TextFormat::OBFUSCATED:
$newString .= "\x1b[8m";
break;
case FORMAT_ITALIC:
case TextFormat::ITALIC:
$newString .= "\x1b[3m";
break;
case FORMAT_UNDERLINE:
case TextFormat::UNDERLINE:
$newString .= "\x1b[4m";
break;
case FORMAT_STRIKETHROUGH:
case TextFormat::STRIKETHROUGH:
$newString .= "\x1b[9m";
break;
case FORMAT_RESET:
case TextFormat::RESET:
$newString .= "\x1b[0m";
break;
//Colors
case FORMAT_BLACK:
case TextFormat::BLACK:
$newString .= "\x1b[30m";
break;
case FORMAT_DARK_BLUE:
case TextFormat::DARK_BLUE:
$newString .= "\x1b[34m";
break;
case FORMAT_DARK_GREEN:
case TextFormat::DARK_GREEN:
$newString .= "\x1b[32m";
break;
case FORMAT_DARK_AQUA:
case TextFormat::DARK_AQUA:
$newString .= "\x1b[36m";
break;
case FORMAT_DARK_RED:
case TextFormat::DARK_RED:
$newString .= "\x1b[31m";
break;
case FORMAT_DARK_PURPLE:
case TextFormat::DARK_PURPLE:
$newString .= "\x1b[35m";
break;
case FORMAT_GOLD:
case TextFormat::GOLD:
$newString .= "\x1b[33m";
break;
case FORMAT_GRAY:
case TextFormat::GRAY:
$newString .= "\x1b[37m";
break;
case FORMAT_DARK_GRAY:
case TextFormat::DARK_GRAY:
$newString .= "\x1b[30;1m";
break;
case FORMAT_BLUE:
case TextFormat::BLUE:
$newString .= "\x1b[34;1m";
break;
case FORMAT_GREEN:
case TextFormat::GREEN:
$newString .= "\x1b[32;1m";
break;
case FORMAT_AQUA:
case TextFormat::AQUA:
$newString .= "\x1b[36;1m";
break;
case FORMAT_RED:
case TextFormat::RED:
$newString .= "\x1b[31;1m";
break;
case FORMAT_LIGHT_PURPLE:
case TextFormat::LIGHT_PURPLE:
$newString .= "\x1b[35;1m";
break;
case FORMAT_YELLOW:
case TextFormat::YELLOW:
$newString .= "\x1b[33;1m";
break;
case FORMAT_WHITE:
case TextFormat::WHITE:
$newString .= "\x1b[37;1m";
break;
default: