Merge branch 'stable' into next-minor

This commit is contained in:
Dylan K. Taylor 2022-09-15 12:44:53 +01:00
commit 441b06f6c7
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
26 changed files with 171 additions and 190 deletions

View File

@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
image: [ubuntu-20.04]
php: [8.0.22, 8.1.9]
php: [8.0.23, 8.1.10]
steps:
- name: Build and prepare PHP cache
@ -31,7 +31,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.22, 8.1.9]
php: [8.0.23, 8.1.10]
steps:
- uses: actions/checkout@v3
@ -69,7 +69,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.22, 8.1.9]
php: [8.0.23, 8.1.10]
steps:
- uses: actions/checkout@v3
@ -107,7 +107,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.22, 8.1.9]
php: [8.0.23, 8.1.10]
steps:
- uses: actions/checkout@v3
@ -147,7 +147,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.22, 8.1.9]
php: [8.0.23, 8.1.10]
steps:
- uses: actions/checkout@v3
@ -198,7 +198,7 @@ jobs:
uses: shivammathur/setup-php@2.21.2
with:
php-version: 8.0
tools: php-cs-fixer:3.8
tools: php-cs-fixer:3.11
- name: Run PHP-CS-Fixer
run: php-cs-fixer fix --dry-run --diff --ansi

View File

@ -41,7 +41,7 @@
"pocketmine/classloader": "^0.2.0",
"pocketmine/color": "^0.2.0",
"pocketmine/errorhandler": "^0.6.0",
"pocketmine/locale-data": "~2.8.0",
"pocketmine/locale-data": "~2.8.0 <2.8.9",
"pocketmine/log": "^0.4.0",
"pocketmine/log-pthreads": "^0.4.0",
"pocketmine/math": "^0.4.0",
@ -53,7 +53,7 @@
"webmozart/path-util": "^2.3"
},
"require-dev": {
"phpstan/phpstan": "1.8.2",
"phpstan/phpstan": "1.8.5",
"phpstan/phpstan-phpunit": "^1.1.0",
"phpstan/phpstan-strict-rules": "^1.2.0",
"phpunit/phpunit": "^9.2"

177
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "72bfad1350c97a3df225577163d702ea",
"content-hash": "82c3c4f98020c30f8ba31f11211abdc3",
"packages": [
{
"name": "adhocore/json-comment",
@ -63,16 +63,16 @@
},
{
"name": "brick/math",
"version": "0.10.1",
"version": "0.10.2",
"source": {
"type": "git",
"url": "https://github.com/brick/math.git",
"reference": "de846578401f4e58f911b3afeb62ced56365ed87"
"reference": "459f2781e1a08d52ee56b0b1444086e038561e3f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/brick/math/zipball/de846578401f4e58f911b3afeb62ced56365ed87",
"reference": "de846578401f4e58f911b3afeb62ced56365ed87",
"url": "https://api.github.com/repos/brick/math/zipball/459f2781e1a08d52ee56b0b1444086e038561e3f",
"reference": "459f2781e1a08d52ee56b0b1444086e038561e3f",
"shasum": ""
},
"require": {
@ -107,7 +107,7 @@
],
"support": {
"issues": "https://github.com/brick/math/issues",
"source": "https://github.com/brick/math/tree/0.10.1"
"source": "https://github.com/brick/math/tree/0.10.2"
},
"funding": [
{
@ -115,7 +115,7 @@
"type": "github"
}
],
"time": "2022-08-01T22:54:31+00:00"
"time": "2022-08-10T22:54:19+00:00"
},
{
"name": "fgrosse/phpasn1",
@ -640,16 +640,16 @@
},
{
"name": "pocketmine/math",
"version": "0.4.2",
"version": "0.4.3",
"source": {
"type": "git",
"url": "https://github.com/pmmp/Math.git",
"reference": "aacc3759a508a69dfa5bc4dfa770ab733c5c94bf"
"reference": "47a243d320b01c8099d65309967934c188111549"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/Math/zipball/aacc3759a508a69dfa5bc4dfa770ab733c5c94bf",
"reference": "aacc3759a508a69dfa5bc4dfa770ab733c5c94bf",
"url": "https://api.github.com/repos/pmmp/Math/zipball/47a243d320b01c8099d65309967934c188111549",
"reference": "47a243d320b01c8099d65309967934c188111549",
"shasum": ""
},
"require": {
@ -658,7 +658,7 @@
},
"require-dev": {
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "1.2.0",
"phpstan/phpstan": "1.8.2",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": "^8.5 || ^9.5"
},
@ -675,9 +675,9 @@
"description": "PHP library containing math related code used in PocketMine-MP",
"support": {
"issues": "https://github.com/pmmp/Math/issues",
"source": "https://github.com/pmmp/Math/tree/0.4.2"
"source": "https://github.com/pmmp/Math/tree/0.4.3"
},
"time": "2021-12-05T01:15:17+00:00"
"time": "2022-08-25T18:43:37+00:00"
},
{
"name": "pocketmine/nbt",
@ -723,16 +723,16 @@
},
{
"name": "pocketmine/raklib",
"version": "0.14.4",
"version": "0.14.5",
"source": {
"type": "git",
"url": "https://github.com/pmmp/RakLib.git",
"reference": "1ea8e3b95a1b6bf785dc27d76578657be4185f42"
"reference": "85b4e5cb7117d37e010eeadb3ff53b21276c6f48"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/1ea8e3b95a1b6bf785dc27d76578657be4185f42",
"reference": "1ea8e3b95a1b6bf785dc27d76578657be4185f42",
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/85b4e5cb7117d37e010eeadb3ff53b21276c6f48",
"reference": "85b4e5cb7117d37e010eeadb3ff53b21276c6f48",
"shasum": ""
},
"require": {
@ -744,7 +744,7 @@
"pocketmine/log": "^0.3.0 || ^0.4.0"
},
"require-dev": {
"phpstan/phpstan": "1.5.4",
"phpstan/phpstan": "1.7.7",
"phpstan/phpstan-strict-rules": "^1.0"
},
"type": "library",
@ -760,9 +760,9 @@
"description": "A RakNet server implementation written in PHP",
"support": {
"issues": "https://github.com/pmmp/RakLib/issues",
"source": "https://github.com/pmmp/RakLib/tree/0.14.4"
"source": "https://github.com/pmmp/RakLib/tree/0.14.5"
},
"time": "2022-04-17T18:42:17+00:00"
"time": "2022-08-25T16:16:44+00:00"
},
{
"name": "pocketmine/raklib-ipc",
@ -926,20 +926,20 @@
},
{
"name": "ramsey/uuid",
"version": "4.4.0",
"version": "4.5.0",
"source": {
"type": "git",
"url": "https://github.com/ramsey/uuid.git",
"reference": "373f7bacfcf3de038778ff27dcce5672ddbf4c8a"
"reference": "ef842484ba57f163c6d465ab744bfecb872a11d4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ramsey/uuid/zipball/373f7bacfcf3de038778ff27dcce5672ddbf4c8a",
"reference": "373f7bacfcf3de038778ff27dcce5672ddbf4c8a",
"url": "https://api.github.com/repos/ramsey/uuid/zipball/ef842484ba57f163c6d465ab744bfecb872a11d4",
"reference": "ef842484ba57f163c6d465ab744bfecb872a11d4",
"shasum": ""
},
"require": {
"brick/math": "^0.8 || ^0.9 || ^0.10",
"brick/math": "^0.8.8 || ^0.9 || ^0.10",
"ext-ctype": "*",
"ext-json": "*",
"php": "^8.0",
@ -960,12 +960,13 @@
"php-mock/php-mock-mockery": "^1.3",
"php-parallel-lint/php-parallel-lint": "^1.1",
"phpbench/phpbench": "^1.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-mockery": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-mockery": "^1.1",
"phpstan/phpstan-phpunit": "^1.1",
"phpunit/phpunit": "^8.5 || ^9",
"slevomat/coding-standard": "^7.0",
"ramsey/composer-repl": "^1.4",
"slevomat/coding-standard": "^8.4",
"squizlabs/php_codesniffer": "^3.5",
"vimeo/psalm": "^4.9"
},
@ -1003,7 +1004,7 @@
],
"support": {
"issues": "https://github.com/ramsey/uuid/issues",
"source": "https://github.com/ramsey/uuid/tree/4.4.0"
"source": "https://github.com/ramsey/uuid/tree/4.5.0"
},
"funding": [
{
@ -1015,7 +1016,7 @@
"type": "tidelift"
}
],
"time": "2022-08-05T17:58:37+00:00"
"time": "2022-09-15T01:44:53+00:00"
},
{
"name": "symfony/polyfill-php81",
@ -1338,16 +1339,16 @@
},
{
"name": "nikic/php-parser",
"version": "v4.14.0",
"version": "v4.15.1",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1"
"reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1",
"reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900",
"reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900",
"shasum": ""
},
"require": {
@ -1388,9 +1389,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0"
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1"
},
"time": "2022-05-31T20:59:12+00:00"
"time": "2022-09-04T07:30:47+00:00"
},
{
"name": "phar-io/manifest",
@ -1505,16 +1506,16 @@
},
{
"name": "phpstan/phpstan",
"version": "1.8.2",
"version": "1.8.5",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c"
"reference": "f6598a5ff12ca4499a836815e08b4d77a2ddeb20"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/c53312ecc575caf07b0e90dee43883fdf90ca67c",
"reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/f6598a5ff12ca4499a836815e08b4d77a2ddeb20",
"reference": "f6598a5ff12ca4499a836815e08b4d77a2ddeb20",
"shasum": ""
},
"require": {
@ -1538,9 +1539,13 @@
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"keywords": [
"dev",
"static analysis"
],
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.8.2"
"source": "https://github.com/phpstan/phpstan/tree/1.8.5"
},
"funding": [
{
@ -1551,16 +1556,12 @@
"url": "https://github.com/phpstan",
"type": "github"
},
{
"url": "https://www.patreon.com/phpstan",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
"type": "tidelift"
}
],
"time": "2022-07-20T09:57:31+00:00"
"time": "2022-09-07T16:05:32+00:00"
},
{
"name": "phpstan/phpstan-phpunit",
@ -1616,21 +1617,21 @@
},
{
"name": "phpstan/phpstan-strict-rules",
"version": "1.3.0",
"version": "1.4.3",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-strict-rules.git",
"reference": "543675a9be82d4befb9ca0bd8cdc9d211665037f"
"reference": "431b3d6e8040075de196680cd5bc95735987b4ae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/543675a9be82d4befb9ca0bd8cdc9d211665037f",
"reference": "543675a9be82d4befb9ca0bd8cdc9d211665037f",
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/431b3d6e8040075de196680cd5bc95735987b4ae",
"reference": "431b3d6e8040075de196680cd5bc95735987b4ae",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.7.15"
"phpstan/phpstan": "^1.8.3"
},
"require-dev": {
"nikic/php-parser": "^4.13.0",
@ -1658,22 +1659,22 @@
"description": "Extra strict and opinionated rules for PHPStan",
"support": {
"issues": "https://github.com/phpstan/phpstan-strict-rules/issues",
"source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.3.0"
"source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.4.3"
},
"time": "2022-06-24T06:47:20+00:00"
"time": "2022-08-26T15:05:46+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.16",
"version": "9.2.17",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "2593003befdcc10db5e213f9f28814f5aa8ac073"
"reference": "aa94dc41e8661fe90c7316849907cba3007b10d8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2593003befdcc10db5e213f9f28814f5aa8ac073",
"reference": "2593003befdcc10db5e213f9f28814f5aa8ac073",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8",
"reference": "aa94dc41e8661fe90c7316849907cba3007b10d8",
"shasum": ""
},
"require": {
@ -1729,7 +1730,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.16"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17"
},
"funding": [
{
@ -1737,7 +1738,7 @@
"type": "github"
}
],
"time": "2022-08-20T05:26:47+00:00"
"time": "2022-08-30T12:24:04+00:00"
},
{
"name": "phpunit/php-file-iterator",
@ -1982,16 +1983,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.23",
"version": "9.5.24",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "888556852e7e9bbeeedb9656afe46118765ade34"
"reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/888556852e7e9bbeeedb9656afe46118765ade34",
"reference": "888556852e7e9bbeeedb9656afe46118765ade34",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0aa6097bef9fd42458a9b3c49da32c6ce6129c5",
"reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5",
"shasum": ""
},
"require": {
@ -2020,7 +2021,7 @@
"sebastian/global-state": "^5.0.1",
"sebastian/object-enumerator": "^4.0.3",
"sebastian/resource-operations": "^3.0.3",
"sebastian/type": "^3.0",
"sebastian/type": "^3.1",
"sebastian/version": "^3.0.2"
},
"suggest": {
@ -2064,7 +2065,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.23"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.24"
},
"funding": [
{
@ -2076,7 +2077,7 @@
"type": "github"
}
],
"time": "2022-08-22T14:01:36+00:00"
"time": "2022-08-30T07:42:16+00:00"
},
{
"name": "sebastian/cli-parser",
@ -2247,16 +2248,16 @@
},
{
"name": "sebastian/comparator",
"version": "4.0.6",
"version": "4.0.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "55f4261989e546dc112258c7a75935a81a7ce382"
"reference": "fa0f136dd2334583309d32b62544682ee972b51a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382",
"reference": "55f4261989e546dc112258c7a75935a81a7ce382",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a",
"reference": "fa0f136dd2334583309d32b62544682ee972b51a",
"shasum": ""
},
"require": {
@ -2309,7 +2310,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues",
"source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6"
"source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8"
},
"funding": [
{
@ -2317,7 +2318,7 @@
"type": "github"
}
],
"time": "2020-10-26T15:49:45+00:00"
"time": "2022-09-14T12:41:17+00:00"
},
{
"name": "sebastian/complexity",
@ -2507,16 +2508,16 @@
},
{
"name": "sebastian/exporter",
"version": "4.0.4",
"version": "4.0.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9"
"reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9",
"reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d",
"reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d",
"shasum": ""
},
"require": {
@ -2572,7 +2573,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4"
"source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5"
},
"funding": [
{
@ -2580,7 +2581,7 @@
"type": "github"
}
],
"time": "2021-11-11T14:18:36+00:00"
"time": "2022-09-14T06:03:37+00:00"
},
{
"name": "sebastian/global-state",
@ -2935,16 +2936,16 @@
},
{
"name": "sebastian/type",
"version": "3.0.0",
"version": "3.2.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/type.git",
"reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad"
"reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad",
"reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e",
"reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e",
"shasum": ""
},
"require": {
@ -2956,7 +2957,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
"dev-master": "3.2-dev"
}
},
"autoload": {
@ -2979,7 +2980,7 @@
"homepage": "https://github.com/sebastianbergmann/type",
"support": {
"issues": "https://github.com/sebastianbergmann/type/issues",
"source": "https://github.com/sebastianbergmann/type/tree/3.0.0"
"source": "https://github.com/sebastianbergmann/type/tree/3.2.0"
},
"funding": [
{
@ -2987,7 +2988,7 @@
"type": "github"
}
],
"time": "2022-03-15T09:54:48+00:00"
"time": "2022-09-12T14:47:03+00:00"
},
{
"name": "sebastian/version",

View File

@ -131,6 +131,7 @@ use function get_class;
use function ini_set;
use function is_array;
use function is_dir;
use function is_int;
use function is_object;
use function is_resource;
use function is_string;
@ -569,6 +570,7 @@ class Server{
$playerPos = null;
$spawn = $world->getSpawnLocation();
}
/** @phpstan-var PromiseResolver<Player> $playerPromiseResolver */
$playerPromiseResolver = new PromiseResolver();
$world->requestChunkPopulation($spawn->getFloorX() >> Chunk::COORD_BIT_SIZE, $spawn->getFloorZ() >> Chunk::COORD_BIT_SIZE, null)->onCompletion(
function() use ($playerPromiseResolver, $class, $session, $playerInfo, $authenticated, $world, $playerPos, $spawn, $offlinePlayerData) : void{
@ -1641,12 +1643,14 @@ class Server{
], 10, [], $postUrlError);
if($reply !== null && is_object($data = json_decode($reply->getBody()))){
if(isset($data->crashId) && isset($data->crashUrl)){
if(isset($data->crashId) && is_int($data->crashId) && isset($data->crashUrl) && is_string($data->crashUrl)){
$reportId = $data->crashId;
$reportUrl = $data->crashUrl;
$this->logger->emergency($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_crash_archive($reportUrl, (string) $reportId)));
}elseif(isset($data->error)){
}elseif(isset($data->error) && is_string($data->error)){
$this->logger->emergency("Automatic crash report submission failed: $data->error");
}else{
$this->logger->emergency("Invalid JSON response received from crash archive: " . $reply->getBody());
}
}else{
$this->logger->emergency("Failed to communicate with crash archive: $postUrlError");

View File

@ -523,12 +523,6 @@ class BlockFactory{
$this->registerAllMeta(...$leaves);
$this->registerAllMeta(...$allSidedLogs);
static $sandstoneTypes = [
Meta::SANDSTONE_NORMAL => "",
Meta::SANDSTONE_CHISELED => "Chiseled ",
Meta::SANDSTONE_CUT => "Cut ",
Meta::SANDSTONE_SMOOTH => "Smooth "
];
$sandstoneBreakInfo = new BreakInfo(0.8, ToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel());
$this->registerAllMeta(new Stair(new BID(Ids::RED_SANDSTONE_STAIRS, 0), "Red Sandstone Stairs", $sandstoneBreakInfo));
$this->registerAllMeta(new Stair(new BID(Ids::SMOOTH_RED_SANDSTONE_STAIRS, 0), "Smooth Red Sandstone Stairs", $sandstoneBreakInfo));
@ -536,7 +530,12 @@ class BlockFactory{
$this->registerAllMeta(new Stair(new BID(Ids::SMOOTH_SANDSTONE_STAIRS, 0), "Smooth Sandstone Stairs", $sandstoneBreakInfo));
$sandstones = [];
$redSandstones = [];
foreach($sandstoneTypes as $variant => $prefix){
foreach([
Meta::SANDSTONE_NORMAL => "",
Meta::SANDSTONE_CHISELED => "Chiseled ",
Meta::SANDSTONE_CUT => "Cut ",
Meta::SANDSTONE_SMOOTH => "Smooth "
] as $variant => $prefix){
$sandstones[] = new Opaque(new BID(Ids::SANDSTONE, $variant), $prefix . "Sandstone", $sandstoneBreakInfo);
$redSandstones[] = new Opaque(new BID(Ids::RED_SANDSTONE, $variant), $prefix . "Red Sandstone", $sandstoneBreakInfo);
}

View File

@ -72,7 +72,7 @@ class Cactus extends Transparent{
* @return AxisAlignedBB[]
*/
protected function recalculateCollisionBoxes() : array{
static $shrinkSize = 1 / 16;
$shrinkSize = 1 / 16;
return [AxisAlignedBB::one()->contract($shrinkSize, 0, $shrinkSize)->trim(Facing::UP, $shrinkSize)];
}

View File

@ -69,7 +69,6 @@ class Lever extends Flowable{
5 => LeverFacing::UP_AXIS_Z(),
6 => LeverFacing::UP_AXIS_X(),
7 => LeverFacing::DOWN_AXIS_Z(),
default => throw new AssumptionFailedError("0x07 mask should make this impossible"), //phpstan doesn't understand :(
};
$this->activated = ($stateMeta & BlockLegacyMetadata::LEVER_FLAG_POWERED) !== 0;

View File

@ -585,6 +585,7 @@ final class VanillaBlocks{
/**
* @return Block[]
* @phpstan-return array<string, Block>
*/
public static function getAll() : array{
//phpstan doesn't support generic traits yet :(

View File

@ -237,11 +237,10 @@ class ExperienceManager{
}
public function onPickupXp(int $xpValue) : void{
static $mainHandIndex = -1;
static $offHandIndex = -2;
$mainHandIndex = -1;
$offHandIndex = -2;
//TODO: replace this with a more generic equipment getting/setting interface
/** @var Durable[] $equipment */
$equipment = [];
if(($item = $this->entity->getInventory()->getItemInHand()) instanceof Durable && $item->hasEnchantment(VanillaEnchantments::MENDING())){

View File

@ -38,7 +38,6 @@ class Effect{
* @param Translatable|string $name Translation key used for effect name
* @param Color $color Color of bubbles given by this effect
* @param bool $bad Whether the effect is harmful
* @param int $defaultDuration
* @param bool $hasBubbles Whether the effect has potion bubbles. Some do not (e.g. Instant Damage has its own particles instead of bubbles)
*/
public function __construct(

View File

@ -101,6 +101,7 @@ final class VanillaEffects{
/**
* @return Effect[]
* @phpstan-return array<string, Effect>
*/
public static function getAll() : array{
//phpstan doesn't support generic traits yet :(

View File

@ -76,11 +76,13 @@ abstract class BaseInventory implements Inventory{
/**
* @param Item[] $items
* @phpstan-param array<int, Item> $items
*/
abstract protected function internalSetContents(array $items) : void;
/**
* @param Item[] $items
* @phpstan-param array<int, Item> $items
*/
public function setContents(array $items) : void{
if(count($items) > $this->getSize()){
@ -132,6 +134,7 @@ abstract class BaseInventory implements Inventory{
return $slots;
}
public function first(Item $item, bool $exact = false) : int{
$count = $exact ? $item->getCount() : max(1, $item->getCount());
$checkDamage = $exact || !$item->hasAnyDamageValue();

View File

@ -47,12 +47,20 @@ interface Inventory{
public function setItem(int $index, Item $item) : void;
/**
* Returns an array of all the itemstacks in the inventory, indexed by their slot number.
* Empty slots are not included unless includeEmpty is true.
*
* @return Item[]
* @phpstan-return array<int, Item>
*/
public function getContents(bool $includeEmpty = false) : array;
/**
* Sets the contents of the inventory. Non-numeric offsets or offsets larger than the size of the inventory are
* ignored.
*
* @param Item[] $items
* @phpstan-param array<int, Item> $items
*/
public function setContents(array $items) : void;
@ -85,8 +93,10 @@ interface Inventory{
/**
* Will return all the Items that has the same id and metadata (if not null).
* Won't check amount
* The returned array is indexed by slot number.
*
* @return Item[]
* @phpstan-return array<int, Item>
*/
public function all(Item $item) : array;

View File

@ -58,6 +58,7 @@ class SimpleInventory extends BaseInventory{
/**
* @return Item[]
* @phpstan-return array<int, Item>
*/
public function getContents(bool $includeEmpty = false) : array{
$contents = [];

View File

@ -384,6 +384,7 @@ final class VanillaItems{
/**
* @return Item[]
* @phpstan-return array<string, Item>
*/
public static function getAll() : array{
//phpstan doesn't support generic traits yet :(

View File

@ -27,6 +27,7 @@ use pocketmine\utils\Utils;
use Webmozart\PathUtil\Path;
use function array_filter;
use function array_map;
use function count;
use function explode;
use function file_exists;
use function is_dir;
@ -67,10 +68,14 @@ class Language{
$result = [];
foreach($files as $file){
$code = explode(".", $file)[0];
$strings = self::loadLang($path, $code);
if(isset($strings["language.name"])){
$result[$code] = $strings["language.name"];
try{
$code = explode(".", $file)[0];
$strings = self::loadLang($path, $code);
if(isset($strings["language.name"])){
$result[$code] = $strings["language.name"];
}
}catch(LanguageNotFoundException $e){
// no-op
}
}
@ -124,7 +129,10 @@ class Language{
protected static function loadLang(string $path, string $languageCode) : array{
$file = Path::join($path, $languageCode . ".ini");
if(file_exists($file)){
return array_map('\stripcslashes', Utils::assumeNotFalse(parse_ini_file($file, false, INI_SCANNER_RAW), "Missing or inaccessible required resource files"));
$strings = array_map('stripcslashes', Utils::assumeNotFalse(parse_ini_file($file, false, INI_SCANNER_RAW), "Missing or inaccessible required resource files"));
if(count($strings) > 0){
return $strings;
}
}
throw new LanguageNotFoundException("Language \"$languageCode\" not found");

View File

@ -43,8 +43,6 @@ class ChunkCache implements ChunkListener{
/**
* Fetches the ChunkCache instance for the given world. This lazily creates cache systems as needed.
*
* @return ChunkCache
*/
public static function getInstance(World $world, Compressor $compressor) : self{
$worldId = spl_object_id($world);

View File

@ -48,6 +48,7 @@ trait EnumTrait{
* This is overridden to change the return typehint.
*
* @return self[]
* @phpstan-return array<string, self>
*/
public static function getAll() : array{
//phpstan doesn't support generic traits yet :(

View File

@ -29,7 +29,10 @@ use function mb_strtoupper;
use function preg_match;
trait RegistryTrait{
/** @var object[] */
/**
* @var object[]
* @phpstan-var array<string, object>
*/
private static $members = null;
private static function verifyName(string $name) : void{
@ -107,6 +110,7 @@ trait RegistryTrait{
/**
* @return object[]
* @phpstan-return array<string, object>
*/
private static function _registryGetAll() : array{
self::checkInit();

View File

@ -109,6 +109,7 @@ final class Utils{
private static ?string $os = null;
private static ?UuidInterface $serverUniqueId = null;
private static ?int $cpuCores = null;
/**
* Returns a readable identifier for the given Closure, including file and line.
@ -296,14 +297,11 @@ final class Utils{
}
public static function getCoreCount(bool $recalculate = false) : int{
static $processors = 0;
if($processors > 0 && !$recalculate){
return $processors;
}else{
$processors = 0;
if(self::$cpuCores !== null && !$recalculate){
return self::$cpuCores;
}
$processors = 0;
switch(Utils::getOS()){
case Utils::OS_LINUX:
case Utils::OS_ANDROID:
@ -327,7 +325,7 @@ final class Utils{
$processors = (int) getenv("NUMBER_OF_PROCESSORS");
break;
}
return $processors;
return self::$cpuCores = $processors;
}
/**
@ -366,12 +364,6 @@ final class Utils{
$ord -= 0x100;
}
$hash = 31 * $hash + $ord;
while($hash > 0x7FFFFFFF){
$hash -= 0x100000000;
}
while($hash < -0x80000000){
$hash += 0x100000000;
}
$hash &= 0xFFFFFFFF;
}
return $hash;

View File

@ -171,6 +171,8 @@ class World implements ChunkManager{
/** @var Entity[] */
public $updateEntities = [];
private bool $inDynamicStateRecalculation = false;
/** @var Block[][] */
private array $blockCache = [];
@ -1536,17 +1538,15 @@ class World implements ChunkManager{
$block->position($this, $x, $y, $z);
static $dynamicStateRead = false;
if($dynamicStateRead){
if($this->inDynamicStateRecalculation){
//this call was generated by a parent getBlock() call calculating dynamic stateinfo
//don't calculate dynamic state and don't add to block cache (since it won't have dynamic state calculated).
//this ensures that it's impossible for dynamic state properties to recursively depend on each other.
$addToCache = false;
}else{
$dynamicStateRead = true;
$this->inDynamicStateRecalculation = true;
$block->readStateFromWorld();
$dynamicStateRead = false;
$this->inDynamicStateRecalculation = false;
}
if($addToCache && $relativeBlockHash !== null){

View File

@ -775,18 +775,8 @@ parameters:
count: 1
path: ../../../src/plugin/PluginBase.php
-
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
count: 1
path: ../../../src/plugin/PluginDescription.php
-
message: "#^Cannot cast mixed to string\\.$#"
count: 5
path: ../../../src/plugin/PluginDescription.php
-
message: "#^Parameter \\#1 \\$data of static method pocketmine\\\\permission\\\\PermissionParser\\:\\:loadPermissions\\(\\) expects array\\<string, array\\<string, mixed\\>\\>, mixed given\\.$#"
count: 1
path: ../../../src/plugin/PluginDescription.php
@ -795,11 +785,6 @@ parameters:
count: 1
path: ../../../src/plugin/PluginDescription.php
-
message: "#^Parameter \\#1 \\$name of static method pocketmine\\\\plugin\\\\PluginEnableOrder\\:\\:fromString\\(\\) expects string, mixed given\\.$#"
count: 1
path: ../../../src/plugin/PluginDescription.php
-
message: "#^Parameter \\#2 \\$subject of function preg_match expects string, mixed given\\.$#"
count: 1
@ -810,26 +795,6 @@ parameters:
count: 1
path: ../../../src/plugin/PluginDescription.php
-
message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$authors \\(array\\<string\\>\\) does not accept array\\.$#"
count: 1
path: ../../../src/plugin/PluginDescription.php
-
message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$authors \\(array\\<string\\>\\) does not accept array\\<mixed\\>\\.$#"
count: 1
path: ../../../src/plugin/PluginDescription.php
-
message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$depend \\(array\\<string\\>\\) does not accept array\\.$#"
count: 1
path: ../../../src/plugin/PluginDescription.php
-
message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$loadBefore \\(array\\<string\\>\\) does not accept array\\.$#"
count: 1
path: ../../../src/plugin/PluginDescription.php
-
message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$main \\(string\\) does not accept mixed\\.$#"
count: 1
@ -840,16 +805,6 @@ parameters:
count: 1
path: ../../../src/plugin/PluginDescription.php
-
message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$softDepend \\(array\\<string\\>\\) does not accept array\\.$#"
count: 1
path: ../../../src/plugin/PluginDescription.php
-
message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$srcNamespacePrefix \\(string\\) does not accept mixed\\.$#"
count: 1
path: ../../../src/plugin/PluginDescription.php
-
message: "#^Cannot call method addChild\\(\\) on pocketmine\\\\permission\\\\Permission\\|null\\.$#"
count: 4

View File

@ -10,8 +10,3 @@ parameters:
count: 1
path: ../../../src/event/RegisteredListener.php
-
message: "#^Property pocketmine\\\\event\\\\RegisteredListener\\:\\:\\$handler type has no signature specified for Closure\\.$#"
count: 1
path: ../../../src/event/RegisteredListener.php

View File

@ -1,7 +1,6 @@
parameters:
ignoreErrors:
-
message: "#^Property pocketmine\\\\network\\\\mcpe\\\\handler\\\\StupidJsonDecodeTest\\:\\:\\$stupidJsonDecodeFunc \\(Closure\\(string, bool\\)\\: mixed\\) does not accept Closure\\|null\\.$#"
message: "#^Property pocketmine\\\\network\\\\mcpe\\\\handler\\\\StupidJsonDecodeTest\\:\\:\\$stupidJsonDecodeFunc \\(Closure\\(string, bool=\\)\\: mixed\\) does not accept Closure\\|null\\.$#"
count: 1
path: ../../phpunit/network/mcpe/handler/StupidJsonDecodeTest.php

View File

@ -55,6 +55,11 @@ parameters:
count: 1
path: ../../../src/plugin/PluginManager.php
-
message: "#^Offset \\(int\\|string\\) on non\\-empty\\-array\\<pocketmine\\\\plugin\\\\Plugin\\> in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: ../../../src/plugin/PluginManager.php
-
message: "#^Static property pocketmine\\\\scheduler\\\\AsyncTask\\:\\:\\$threadLocalStorage \\(ArrayObject\\<int, array\\<string, mixed\\>\\>\\|null\\) does not accept non\\-empty\\-array\\<int, non\\-empty\\-array\\<string, mixed\\>\\>\\|ArrayObject\\<int, array\\<string, mixed\\>\\>\\.$#"
count: 1
@ -70,6 +75,11 @@ parameters:
count: 1
path: ../../../src/thread/Worker.php
-
message: "#^Offset \\(int\\|string\\) on non\\-empty\\-array\\<pocketmine\\\\world\\\\World\\> in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: ../../../src/world/WorldManager.php
-
message: "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#"
count: 2

View File

@ -25,6 +25,7 @@ namespace pocketmine\block;
use PHPUnit\Framework\TestCase;
use pocketmine\block\utils\BrewingStandSlot;
use function array_values;
use function count;
class BrewingStandTest extends TestCase{
@ -33,7 +34,7 @@ class BrewingStandTest extends TestCase{
* @phpstan-return \Generator<int, array{list<BrewingStandSlot>}, void, void>
*/
public function slotsProvider() : \Generator{
yield [BrewingStandSlot::getAll()];
yield [array_values(BrewingStandSlot::getAll())];
yield [[BrewingStandSlot::EAST()]];
yield [[BrewingStandSlot::EAST(), BrewingStandSlot::NORTHWEST()]];
}