PocketMine-MP 5.25.1 git-694aa17cc916a954b10fe12721c81b1dc73eecd5
|
Static Public Member Functions | |
static | addBase (string $baseFormat, string $string) |
static | clean (string $string, bool $removeFormat=true) |
static | colorize (string $string, string $placeholder="&") |
static | javaToBedrock (string $string) |
static | toHTML (string $string) |
static | tokenize (string $string) |
Public Attributes | |
const | AQUA = TextFormat::ESCAPE . "b" |
const | BLACK = TextFormat::ESCAPE . "0" |
const | BLUE = TextFormat::ESCAPE . "9" |
const | BOLD = TextFormat::ESCAPE . "l" |
const | COLORS |
const | DARK_AQUA = TextFormat::ESCAPE . "3" |
const | DARK_BLUE = TextFormat::ESCAPE . "1" |
const | DARK_GRAY = TextFormat::ESCAPE . "8" |
const | DARK_GREEN = TextFormat::ESCAPE . "2" |
const | DARK_PURPLE = TextFormat::ESCAPE . "5" |
const | DARK_RED = TextFormat::ESCAPE . "4" |
const | EOL = "\n" |
const | ESCAPE = "\xc2\xa7" |
const | FORMATS |
const | GOLD = TextFormat::ESCAPE . "6" |
const | GRAY = TextFormat::ESCAPE . "7" |
const | GREEN = TextFormat::ESCAPE . "a" |
const | ITALIC = TextFormat::ESCAPE . "o" |
const | LIGHT_PURPLE = TextFormat::ESCAPE . "d" |
const | MATERIAL_AMETHYST = TextFormat::ESCAPE . "u" |
const | MATERIAL_COPPER = TextFormat::ESCAPE . "n" |
const | MATERIAL_DIAMOND = TextFormat::ESCAPE . "s" |
const | MATERIAL_EMERALD = TextFormat::ESCAPE . "q" |
const | MATERIAL_GOLD = TextFormat::ESCAPE . "p" |
const | MATERIAL_IRON = TextFormat::ESCAPE . "i" |
const | MATERIAL_LAPIS = TextFormat::ESCAPE . "t" |
const | MATERIAL_NETHERITE = TextFormat::ESCAPE . "j" |
const | MATERIAL_QUARTZ = TextFormat::ESCAPE . "h" |
const | MATERIAL_REDSTONE = TextFormat::ESCAPE . "m" |
const | MATERIAL_RESIN = TextFormat::ESCAPE . "v" |
const | MINECOIN_GOLD = TextFormat::ESCAPE . "g" |
const | OBFUSCATED = TextFormat::ESCAPE . "k" |
const | RED = TextFormat::ESCAPE . "c" |
const | RESET = TextFormat::ESCAPE . "r" |
const | WHITE = TextFormat::ESCAPE . "f" |
const | YELLOW = TextFormat::ESCAPE . "e" |
Class used to handle Minecraft chat format, and convert it to other formats like HTML
Definition at line 45 of file TextFormat.php.
|
static |
Adds base formatting to the string. The given format codes will be inserted directly after any RESET (§r) codes.
This is useful for log messages, where a RESET code should return to the log message's original colour (e.g. blue for NOTICE), rather than whatever the terminal's base text colour is (usually some off-white colour).
Example behaviour:
Note: Adding base formatting to the output string a second time will result in a combination of formats from both calls. This is not by design, but simply a consequence of the way the function is implemented.
Definition at line 192 of file TextFormat.php.
|
static |
Cleans the string from Minecraft codes, ANSI Escape Codes and invalid UTF-8 characters
Definition at line 161 of file TextFormat.php.
|
static |
Replaces placeholders of § with the correct character. Only valid codes (as in the constants of the TextFormat class) will be converted.
string | $placeholder | default "&" |
Definition at line 175 of file TextFormat.php.
|
static |
Converts any Java formatting codes in the given string to Bedrock.
As of 1.21.50, strikethrough (§m) and underline (§n) are not supported by Bedrock, and these symbols are instead used to represent additional colours in Bedrock. To avoid unintended formatting, this function currently strips those formatting codes to prevent unintended colour display in formatted text.
If Bedrock starts to support these formats in the future, this function will be updated to translate them rather than removing them.
Definition at line 214 of file TextFormat.php.
|
static |
Returns an HTML-formatted string with colors/markup
Definition at line 221 of file TextFormat.php.
|
static |
const pocketmine\utils\TextFormat::AQUA = TextFormat::ESCAPE . "b" |
Definition at line 60 of file TextFormat.php.
const pocketmine\utils\TextFormat::BLACK = TextFormat::ESCAPE . "0" |
Definition at line 49 of file TextFormat.php.
const pocketmine\utils\TextFormat::BLUE = TextFormat::ESCAPE . "9" |
Definition at line 58 of file TextFormat.php.
const pocketmine\utils\TextFormat::BOLD = TextFormat::ESCAPE . "l" |
Definition at line 110 of file TextFormat.php.
const pocketmine\utils\TextFormat::COLORS |
Definition at line 78 of file TextFormat.php.
const pocketmine\utils\TextFormat::DARK_AQUA = TextFormat::ESCAPE . "3" |
Definition at line 52 of file TextFormat.php.
const pocketmine\utils\TextFormat::DARK_BLUE = TextFormat::ESCAPE . "1" |
Definition at line 50 of file TextFormat.php.
const pocketmine\utils\TextFormat::DARK_GRAY = TextFormat::ESCAPE . "8" |
Definition at line 57 of file TextFormat.php.
const pocketmine\utils\TextFormat::DARK_GREEN = TextFormat::ESCAPE . "2" |
Definition at line 51 of file TextFormat.php.
const pocketmine\utils\TextFormat::DARK_PURPLE = TextFormat::ESCAPE . "5" |
Definition at line 54 of file TextFormat.php.
const pocketmine\utils\TextFormat::DARK_RED = TextFormat::ESCAPE . "4" |
Definition at line 53 of file TextFormat.php.
const pocketmine\utils\TextFormat::EOL = "\n" |
Definition at line 47 of file TextFormat.php.
const pocketmine\utils\TextFormat::ESCAPE = "\xc2\xa7" |
Definition at line 46 of file TextFormat.php.
const pocketmine\utils\TextFormat::FORMATS |
Definition at line 113 of file TextFormat.php.
const pocketmine\utils\TextFormat::GOLD = TextFormat::ESCAPE . "6" |
Definition at line 55 of file TextFormat.php.
const pocketmine\utils\TextFormat::GRAY = TextFormat::ESCAPE . "7" |
Definition at line 56 of file TextFormat.php.
const pocketmine\utils\TextFormat::GREEN = TextFormat::ESCAPE . "a" |
Definition at line 59 of file TextFormat.php.
const pocketmine\utils\TextFormat::ITALIC = TextFormat::ESCAPE . "o" |
Definition at line 111 of file TextFormat.php.
const pocketmine\utils\TextFormat::LIGHT_PURPLE = TextFormat::ESCAPE . "d" |
Definition at line 62 of file TextFormat.php.
const pocketmine\utils\TextFormat::MATERIAL_AMETHYST = TextFormat::ESCAPE . "u" |
Definition at line 75 of file TextFormat.php.
const pocketmine\utils\TextFormat::MATERIAL_COPPER = TextFormat::ESCAPE . "n" |
Definition at line 70 of file TextFormat.php.
const pocketmine\utils\TextFormat::MATERIAL_DIAMOND = TextFormat::ESCAPE . "s" |
Definition at line 73 of file TextFormat.php.
const pocketmine\utils\TextFormat::MATERIAL_EMERALD = TextFormat::ESCAPE . "q" |
Definition at line 72 of file TextFormat.php.
const pocketmine\utils\TextFormat::MATERIAL_GOLD = TextFormat::ESCAPE . "p" |
Definition at line 71 of file TextFormat.php.
const pocketmine\utils\TextFormat::MATERIAL_IRON = TextFormat::ESCAPE . "i" |
Definition at line 67 of file TextFormat.php.
const pocketmine\utils\TextFormat::MATERIAL_LAPIS = TextFormat::ESCAPE . "t" |
Definition at line 74 of file TextFormat.php.
const pocketmine\utils\TextFormat::MATERIAL_NETHERITE = TextFormat::ESCAPE . "j" |
Definition at line 68 of file TextFormat.php.
const pocketmine\utils\TextFormat::MATERIAL_QUARTZ = TextFormat::ESCAPE . "h" |
Definition at line 66 of file TextFormat.php.
const pocketmine\utils\TextFormat::MATERIAL_REDSTONE = TextFormat::ESCAPE . "m" |
Definition at line 69 of file TextFormat.php.
const pocketmine\utils\TextFormat::MATERIAL_RESIN = TextFormat::ESCAPE . "v" |
Definition at line 76 of file TextFormat.php.
const pocketmine\utils\TextFormat::MINECOIN_GOLD = TextFormat::ESCAPE . "g" |
Definition at line 65 of file TextFormat.php.
const pocketmine\utils\TextFormat::OBFUSCATED = TextFormat::ESCAPE . "k" |
Definition at line 109 of file TextFormat.php.
const pocketmine\utils\TextFormat::RED = TextFormat::ESCAPE . "c" |
Definition at line 61 of file TextFormat.php.
const pocketmine\utils\TextFormat::RESET = TextFormat::ESCAPE . "r" |
Definition at line 119 of file TextFormat.php.
const pocketmine\utils\TextFormat::WHITE = TextFormat::ESCAPE . "f" |
Definition at line 64 of file TextFormat.php.
const pocketmine\utils\TextFormat::YELLOW = TextFormat::ESCAPE . "e" |
Definition at line 63 of file TextFormat.php.