Player: fixed maximum message size limits to match vanilla bugrock

This commit is contained in:
Dylan K. Taylor 2021-12-27 16:50:46 +00:00
parent 0da29beb1d
commit 8943d8a2a7
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -134,6 +134,7 @@ use function floor;
use function get_class;
use function is_int;
use function max;
use function mb_strlen;
use function microtime;
use function min;
use function preg_match;
@ -1320,7 +1321,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
$message = TextFormat::clean($message, false);
foreach(explode("\n", $message) as $messagePart){
if(trim($messagePart) !== "" and strlen($messagePart) <= 255 and $this->messageCounter-- > 0){
if(trim($messagePart) !== "" and mb_strlen($messagePart, 'UTF-8') <= 512 and $this->messageCounter-- > 0){
if(strpos($messagePart, './') === 0){
$messagePart = substr($messagePart, 1);
}