34 Commits

Author SHA1 Message Date
Dylan K. Taylor
6f36fa504b TextFormat: make clean() less confusing, deduplicate some regex 2019-02-14 16:52:39 +00:00
Dylan K. Taylor
c433fad0a7 another /u modifier 2019-02-14 13:50:56 +00:00
Dylan K. Taylor
8fad5a6e30 TextFormat: use mb_scrub() in clean()
this redacts invalid characters to prevent them appearing in places that might break the client.
2019-02-13 20:01:36 +00:00
Dylan K. Taylor
7a6f279825 TextFormat: fixed clean() not being unicode-aware 2019-02-13 17:06:44 +00:00
Dylan K. Taylor
4b9a142a5d Import global functions and constants for enhanced performance
This is better for performance because these then don't need to be reevaluated every time they are called.

When encountering an unqualified function or constant reference, PHP will first try to locate a symbol in the current namespace by that name, and then fall back to the global namespace.
This short-circuits the check, which has substantial performance effects in some cases - in particular, ord(), chr() and strlen() show ~1500x faster calls when they are fully qualified.

However, this doesn't mean that PM is getting a massive amount faster. In real world terms, this translates to about 10-15% performance improvement.
But before anyone gets excited, you should know that the CodeOptimizer in the PreProcessor repo has been applying fully-qualified symbol optimizations to Jenkins builds for years, which is one of the reasons why Jenkins builds have better performance than home-built or source installations.
We're choosing to do this for the sake of future SafePHP integration and also to be able to get rid of the buggy CodeOptimizer, so that phar and source are more consistent.
2019-01-04 20:43:15 +00:00
Dylan K. Taylor
ac5a91b67e Cleaned up bool comparison mess 2018-03-19 14:10:55 +00:00
Dylan K. Taylor
b445825467 TextFormat: Moved toANSI() to Terminal, close #1995
This also removes a cyclic dependency between TextFormat and Terminal, meaning that TextFormat is now standalone without any external dependencies.

This is also an API break. Beware all ye who wander here, master = bleeding-edge!
2018-02-11 19:11:51 +00:00
Dylan K. Taylor
dbac2abafb TextFormat: make colour matching regex less absurd 2018-02-07 11:31:49 +00:00
SOFe
af7aef70db Implemented TextFormat::colorize() (#1837)
Implemented TextFormat::colorize()
See 4c46087ffccc7f26835a1fc5bbf2ac60397884f9 for the initial discussion
2017-12-30 16:51:04 +00:00
Dylan K. Taylor
4c46087ffc TextFormat: Added EOL constant (for MCPE)
MCPE always uses LF for line endings. PHP_EOL might be LF, CRLF, or CR depending on the platform, so it should not be used for (for example) sending messages to players containing newlines.
2017-12-17 14:58:37 +00:00
Dylan K. Taylor
74b074753f Bulk addition of constant visibilities
thanks PhpStorm inspections plugin for annoying the shit out of me until
I did this.
2017-11-21 14:44:10 +00:00
Dylan K. Taylor
dbb92096e4 More typehints, documentation fixes and static analysis cleanup 2017-07-15 12:12:06 +01:00
Dylan K. Taylor
c3b8be3f60 and more typehints 2017-07-14 10:56:51 +01:00
Dylan K. Taylor
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
Dylan K. Taylor
9004417456 Fixed file headers (#255) 2017-01-13 16:57:05 +00:00
SOFe
58ff381557 PhpStorm automated formatting (#11)
* PhpStorm reformatting

* Tuned PhpStorm reformatting

* Improved ItemIds and BlockIds formatting

* Tuned more PhpStorm reformatting

* Improved string concatenation
2016-10-03 19:05:48 +08:00
SOF3
e913b16804
Fixed some lines indented with 4 spaces rather than tabs 2016-10-03 00:58:34 +08:00
Shoghi Cervantes
2ea8835b12 Removed possible crash on RakLibInterface 2015-04-22 15:45:04 +02:00
Shoghi Cervantes
15b4cd8fb3 Improved format constants, fixed cake eating when max health is > 20 2015-04-20 17:25:58 +02:00
Shoghi Cervantes
1d1766a876 Removed format characters correctly :) 2015-04-14 14:04:10 +02:00
Shoghi Cervantes
1666602652
Improved memory output, logging, removed locks 2015-03-22 03:20:48 +01:00
Shoghi Cervantes
ebc8928c21
Implemented effect colors 2015-03-20 02:31:54 +01:00
Shoghi Cervantes
f9361aa931
Use new colors in terminal 2015-03-15 18:32:36 +01:00
Shoghi Cervantes
b0f8c14640
Added Terminal class, Improved normal generator speed 2015-03-15 00:15:24 +01:00
Shoghi Cervantes
4b442a9d7c Renamed LoginStatusPacket to PlayStatusPacket, added spawn status, new colors 2015-03-12 11:43:50 +01:00
Shoghi Cervantes
645c00b2f7 Added TextWrapper 2014-10-11 00:01:53 +02:00
Shoghi Cervantes
eab86f5f90 Replaced array() with [] 2014-08-28 17:04:22 +02:00
Shoghi Cervantes
de5e9df82b Fixes for chat formatting 2014-06-25 22:32:57 +02:00
Shoghi Cervantes
b506ab349f Fixed TextFormat::toJSON() on nested formatting 2014-06-25 22:20:50 +02:00
Shoghi Cervantes
e2f7cf61e3 Added TextFormat::toJSON() 2014-06-25 21:57:34 +02:00
Shoghi Cervantes
53749483c3 Implemented new Inventory windows on Player, Chest and Furnace 2014-05-23 20:53:06 +02:00
Shoghi Cervantes
27fcf0286e Fixed terminal colors 2014-04-03 04:10:20 +02:00
Shoghi Cervantes
11356b68ba Added RCON 2014-04-02 19:33:49 +02:00
Shoghi Cervantes
dd17652aca Fixed wrong paths 2014-04-01 05:06:12 +02:00