Merge branch 'next-major' into modern-world-support

This commit is contained in:
Dylan K. Taylor
2022-05-24 14:19:34 +01:00
3 changed files with 13 additions and 8 deletions

View File

@@ -1380,6 +1380,11 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
public function chat(string $message) : bool{
$this->removeCurrentWindow();
if($this->messageCounter <= 0){
//the check below would take care of this (0 * (maxlen + 1) = 0), but it's better be explicit
return false;
}
//Fast length check, to make sure we don't get hung trying to explode MBs of string ...
$maxTotalLength = $this->messageCounter * (self::MAX_CHAT_BYTE_LENGTH + 1);
if(strlen($message) > $maxTotalLength){