26 Commits

Author SHA1 Message Date
Dylan K. Taylor
ba93665fe7
TextFormat: reduce hella duplicated code in toHTML() 2024-12-10 14:11:11 +00:00
Maxence
6817215683
TextFormat: Added new material colours for armor trims (#5838)
Unfortunately, these new formatting codes conflict with the Java strikethrough and underline, so we can't support these anymore.

A TextFormat::javaToBedrock() is provided to strip these codes, or (if these formats become supported via different codes) to convert them to Bedrock variants.

Co-authored-by: Dylan T. <dktapps@pmmp.io>
2024-12-10 13:40:03 +00:00
Dylan T
b87e4d8bd3
Introduce and use TextFormat::addBase() (#5268)
This function adds "base" format to a string. The given formats are inserted directly after any RESET code in the sequence.

An example of where this is needed is in the logger.

Without this change, the following code:
$logger->notice("I'm a " . TextFormat::RED . "special" . TextFormat::RESET . " cookie");

causes the "cookie" part of the message to show as grey, instead of the expected aqua for NOTICE level messages.

There are also many workarounds for this problem throughout the server, mostly in command outputs, being forced to use WHITE instead of RESET to avoid breaking the logger output.
2022-09-28 16:13:11 +01:00
Dylan K. Taylor
38d6284671
Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
xxAROX
193a1b3f4e
TextFormat: Added MINECOIN_GOLD (§g) color code support (#4670) 2021-12-30 23:53:05 +00:00
Dylan K. Taylor
e907c70160
... 2021-08-12 23:37:24 +01:00
Dylan K. Taylor
34309bc810
TextFormat: do not assume that an array given to toHTML() is actually a tokenized string
this is a far stretch, since the documentation doesn't mention that the string needs to be tokenized. Anyone passing an array in here is most likely doing so by mistake.
2021-08-12 23:37:00 +01:00
Dylan K. Taylor
4d683c63d8
TextFormat: remove toJSON()
this is not used in the PM core, and is only used by 1 plugin in the whole public ecosystem: BigBrother. It makes more sense to make BigBrother maintainers shoulder the responsibility of maintaining this code, since they are the only ones that need it - besides, if this changed in any MCJE update in the last 5y, nobody has updated it, and nobody has maintained it either due to not having a fucking clue what the thing is for (the documentation is basically nonexistent).
2021-08-12 13:43:58 +01:00
Dylan K. Taylor
eb24e040f3
TextFormat: add COLORS and FORMATS constants 2021-08-12 13:13:33 +01:00
Dylan K. Taylor
a35ca1fa71 Merge branch 'stable' into master 2020-08-15 20:32:14 +01:00
Dylan K. Taylor
fb059cda69 Merge commit 'a4e250a3e61cbf1e75fe2785e71158f16a4a9039'
# Conflicts:
#	resources/vanilla
2020-06-17 20:48:19 +01:00
Dylan K. Taylor
8d537eaae8 Merge commit '23b97d8e2dca50cca77061c1080911ab610fa708'
# Conflicts:
#	resources/vanilla
#	tests/phpstan/configs/l8-baseline.neon
2020-06-17 20:47:51 +01:00
Dylan K. Taylor
f9a587d40e imports cleanup 2020-04-28 17:27:38 +01:00
Dylan K. Taylor
163c3855eb Merge branch 'next-minor'
# Conflicts:
#	resources/vanilla
#	src/plugin/PluginBase.php
#	src/plugin/PluginDescription.php
#	src/pocketmine/Player.php
#	src/pocketmine/network/rcon/RCON.php
#	src/pocketmine/network/rcon/RCONInstance.php
#	src/pocketmine/scheduler/AsyncTask.php
#	src/pocketmine/tile/Spawnable.php
#	src/scheduler/AsyncPool.php
#	src/utils/Config.php
#	src/utils/Timezone.php
#	src/utils/UUID.php
#	src/utils/Utils.php
#	src/world/format/io/region/RegionLoader.php
2020-04-19 11:13:41 +01:00
Dylan K. Taylor
3a68f5e3d0 Merge commit 'da43ae82fe3b8839a4d153b0365f815cf9859d77'
# Conflicts:
#	resources/vanilla
#	src/utils/Config.php
#	src/utils/Timezone.php
#	src/utils/Utils.php
2020-01-31 20:02:39 +00:00
Dylan K. Taylor
67bcc1c0fb phpdoc armageddon for master, pass 1 2020-01-22 11:55:03 +00:00
Dylan K. Taylor
5499ac620c Removed pocketmine subdirectory, map PSR-4 style 2019-07-30 19:14:57 +01:00
Shoghi Cervantes
cbc64462e6 New directory structure. More powerful startup scripts 2014-03-08 04:41:43 +01:00
Shoghi Cervantes
993620341a Added Villager class and NPC interface 2014-03-06 23:33:35 +01:00
Shoghi Cervantes
c08bf3ef86 Removed code remove comments 2014-03-06 13:16:44 +01:00
Shoghi Cervantes
5ea31b57ce First step to namespaces 2014-03-05 23:43:16 +01:00
Shoghi Cervantes
23b8fc32ff removed DocBlock header for logo 2014-03-05 11:15:47 +01:00
Shoghi Cervantes
c904e8bc0e Remove ANSI characters on clean 2014-03-03 00:26:33 +01:00
Shoghi Cervantes
f1d6726615 Added TextFormat::toHTML() 2014-02-28 16:08:33 +01:00
Shoghi Cervantes
103d0bf2ea Updated TextFormat constants 2014-02-27 00:11:06 +01:00
Shoghi Cervantes
809076b7d7 Added new text formatting system for future updates [like vanilla PC] 2013-09-04 19:49:19 +02:00