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

This commit is contained in:
Dylan K. Taylor 2022-05-24 14:19:34 +01:00
commit 567bd8e330
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
3 changed files with 13 additions and 8 deletions

View File

@ -54,7 +54,7 @@
"webmozart/path-util": "^2.3" "webmozart/path-util": "^2.3"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "1.6.8", "phpstan/phpstan": "1.7.1",
"phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-phpunit": "^1.1.0",
"phpstan/phpstan-strict-rules": "^1.2.0", "phpstan/phpstan-strict-rules": "^1.2.0",
"phpunit/phpunit": "^9.2" "phpunit/phpunit": "^9.2"

14
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "f9bd717430394f8e47f421ce1aecaf32", "content-hash": "17e7814a247ffefd8c9cee9530263eb4",
"packages": [ "packages": [
{ {
"name": "adhocore/json-comment", "name": "adhocore/json-comment",
@ -1846,16 +1846,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.6.8", "version": "1.7.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "d76498c5531232cb8386ceb6004f7e013138d3ba" "reference": "e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/d76498c5531232cb8386ceb6004f7e013138d3ba", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719",
"reference": "d76498c5531232cb8386ceb6004f7e013138d3ba", "reference": "e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1881,7 +1881,7 @@
"description": "PHPStan - PHP Static Analysis Tool", "description": "PHPStan - PHP Static Analysis Tool",
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan/issues", "issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.6.8" "source": "https://github.com/phpstan/phpstan/tree/1.7.1"
}, },
"funding": [ "funding": [
{ {
@ -1901,7 +1901,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-05-10T06:54:21+00:00" "time": "2022-05-24T09:05:09+00:00"
}, },
{ {
"name": "phpstan/phpstan-phpunit", "name": "phpstan/phpstan-phpunit",

View File

@ -1380,6 +1380,11 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
public function chat(string $message) : bool{ public function chat(string $message) : bool{
$this->removeCurrentWindow(); $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 ... //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); $maxTotalLength = $this->messageCounter * (self::MAX_CHAT_BYTE_LENGTH + 1);
if(strlen($message) > $maxTotalLength){ if(strlen($message) > $maxTotalLength){