Merge remote-tracking branch 'origin/stable'

# Conflicts:
#	composer.json
#	composer.lock
#	resources/vanilla
#	src/CrashDump.php
#	src/PocketMine.php
#	src/pocketmine/Server.php
#	src/pocketmine/item/Bucket.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/Chunk.php
#	src/pocketmine/level/format/io/leveldb/LevelDB.php
#	src/pocketmine/level/format/io/region/McRegion.php
#	src/pocketmine/network/mcpe/protocol/BatchPacket.php
#	src/pocketmine/tile/Furnace.php
#	src/pocketmine/utils/UUID.php
#	src/utils/ServerKiller.php
This commit is contained in:
Dylan K. Taylor 2020-12-20 20:54:13 +00:00
commit 9228f006d4
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
18 changed files with 221 additions and 127 deletions

View File

@ -24,13 +24,11 @@ jobs:
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: "./bin" path: "./bin"
key: "php-build-generic-${{ hashFiles('./build/php/compile.sh') }}" key: "php-build-generic-${{ hashFiles('./tests/gh-actions/build.sh') }}"
- name: Compile PHP - name: Compile PHP
if: steps.php-build-cache.outputs.cache-hit != 'true' if: steps.php-build-cache.outputs.cache-hit != 'true'
run: | run: ./tests/gh-actions/build.sh
sudo apt update && sudo apt install -y re2c libtool libtool-bin
march=x86-64 ./build/php/compile.sh -j8
- name: Prefix PHP to PATH - name: Prefix PHP to PATH
run: echo "$(pwd)/bin/php7/bin" >> $GITHUB_PATH run: echo "$(pwd)/bin/php7/bin" >> $GITHUB_PATH

View File

@ -3,7 +3,7 @@
<b>A highly customisable, open source server software for Minecraft: Bedrock Edition written in PHP</b> <b>A highly customisable, open source server software for Minecraft: Bedrock Edition written in PHP</b>
</p> </p>
[![Build Status](https://travis-ci.com/pmmp/PocketMine-MP.svg?branch=master)](https://travis-ci.com/pmmp/PocketMine-MP) ![CI](https://github.com/pmmp/PocketMine-MP/workflows/CI/badge.svg)
## Getting started ## Getting started
- [Documentation](http://pmmp.readthedocs.org/) - [Documentation](http://pmmp.readthedocs.org/)

View File

@ -7,7 +7,6 @@
"require": { "require": {
"php": ">=7.3.0", "php": ">=7.3.0",
"php-64bit": "*", "php-64bit": "*",
"ext-bcmath": "*",
"ext-chunkutils2": "^0.1.0", "ext-chunkutils2": "^0.1.0",
"ext-curl": "*", "ext-curl": "*",
"ext-crypto": "^0.3.1", "ext-crypto": "^0.3.1",
@ -51,7 +50,7 @@
"composer-runtime-api": "^2.0" "composer-runtime-api": "^2.0"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "0.12.59", "phpstan/phpstan": "0.12.63",
"phpstan/phpstan-phpunit": "^0.12.6", "phpstan/phpstan-phpunit": "^0.12.6",
"phpstan/phpstan-strict-rules": "^0.12.2", "phpstan/phpstan-strict-rules": "^0.12.2",
"phpunit/phpunit": "^9.2" "phpunit/phpunit": "^9.2"

199
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": "59cfedb6b07a8e13ae3a77a6ea8e18d8", "content-hash": "9ffd33446ed14804ca22c92c04a39796",
"packages": [ "packages": [
{ {
"name": "adhocore/json-comment", "name": "adhocore/json-comment",
@ -262,12 +262,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/pmmp/BinaryUtils.git", "url": "https://github.com/pmmp/BinaryUtils.git",
"reference": "0e25f4baab948cfb88de94375d04df20330957d7" "reference": "7fbdf706e29dced2611eb4d01cd4ca60b4138f5a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/pmmp/BinaryUtils/zipball/0e25f4baab948cfb88de94375d04df20330957d7", "url": "https://api.github.com/repos/pmmp/BinaryUtils/zipball/7fbdf706e29dced2611eb4d01cd4ca60b4138f5a",
"reference": "0e25f4baab948cfb88de94375d04df20330957d7", "reference": "7fbdf706e29dced2611eb4d01cd4ca60b4138f5a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -276,7 +276,7 @@
}, },
"require-dev": { "require-dev": {
"phpstan/extension-installer": "^1.0", "phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.40", "phpstan/phpstan": "0.12.63",
"phpstan/phpstan-strict-rules": "^0.12.4" "phpstan/phpstan-strict-rules": "^0.12.4"
}, },
"type": "library", "type": "library",
@ -294,32 +294,32 @@
"issues": "https://github.com/pmmp/BinaryUtils/issues", "issues": "https://github.com/pmmp/BinaryUtils/issues",
"source": "https://github.com/pmmp/BinaryUtils/tree/master" "source": "https://github.com/pmmp/BinaryUtils/tree/master"
}, },
"time": "2020-08-28T20:45:19+00:00" "time": "2020-12-17T17:42:11+00:00"
}, },
{ {
"name": "pocketmine/callback-validator", "name": "pocketmine/callback-validator",
"version": "1.0.2", "version": "1.0.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "git@github.com:pmmp/CallbackValidator.git", "url": "https://github.com/pmmp/CallbackValidator.git",
"reference": "8321aa3ccfe63639b0d08f0cbf270755cfc99fe2" "reference": "64787469766bcaa7e5885242e85c23c25e8c55a2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/pmmp/CallbackValidator/zipball/8321aa3ccfe63639b0d08f0cbf270755cfc99fe2", "url": "https://api.github.com/repos/pmmp/CallbackValidator/zipball/64787469766bcaa7e5885242e85c23c25e8c55a2",
"reference": "8321aa3ccfe63639b0d08f0cbf270755cfc99fe2", "reference": "64787469766bcaa7e5885242e85c23c25e8c55a2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-reflection": "*", "ext-reflection": "*",
"php": ">=7.1" "php": "^7.1 || ^8.0"
}, },
"replace": { "replace": {
"daverandom/callback-validator": "*" "daverandom/callback-validator": "*"
}, },
"require-dev": { "require-dev": {
"phpstan/extension-installer": "^1.0", "phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.38", "phpstan/phpstan": "0.12.59",
"phpstan/phpstan-strict-rules": "^0.12.4", "phpstan/phpstan-strict-rules": "^0.12.4",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0"
}, },
@ -340,7 +340,11 @@
} }
], ],
"description": "Fork of daverandom/callback-validator - Tools for validating callback signatures", "description": "Fork of daverandom/callback-validator - Tools for validating callback signatures",
"time": "2020-08-21T19:51:42+00:00" "support": {
"issues": "https://github.com/pmmp/CallbackValidator/issues",
"source": "https://github.com/pmmp/CallbackValidator/tree/1.0.3"
},
"time": "2020-12-11T01:45:37+00:00"
}, },
{ {
"name": "pocketmine/classloader", "name": "pocketmine/classloader",
@ -348,12 +352,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/pmmp/ClassLoader.git", "url": "https://github.com/pmmp/ClassLoader.git",
"reference": "14871a77ac5a7c4c0571391ad404b89bc15a3513" "reference": "67ad4a426f00bca9f1361d8e4bc99188fbfbf9d9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/pmmp/ClassLoader/zipball/14871a77ac5a7c4c0571391ad404b89bc15a3513", "url": "https://api.github.com/repos/pmmp/ClassLoader/zipball/67ad4a426f00bca9f1361d8e4bc99188fbfbf9d9",
"reference": "14871a77ac5a7c4c0571391ad404b89bc15a3513", "reference": "67ad4a426f00bca9f1361d8e4bc99188fbfbf9d9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -366,10 +370,9 @@
}, },
"require-dev": { "require-dev": {
"phpstan/extension-installer": "^1.0", "phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.40", "phpstan/phpstan": "0.12.63",
"phpstan/phpstan-strict-rules": "^0.12.4" "phpstan/phpstan-strict-rules": "^0.12.4"
}, },
"default-branch": true,
"type": "library", "type": "library",
"autoload": { "autoload": {
"classmap": [ "classmap": [
@ -385,7 +388,7 @@
"issues": "https://github.com/pmmp/ClassLoader/issues", "issues": "https://github.com/pmmp/ClassLoader/issues",
"source": "https://github.com/pmmp/ClassLoader/tree/master" "source": "https://github.com/pmmp/ClassLoader/tree/master"
}, },
"time": "2020-08-27T11:43:41+00:00" "time": "2020-12-17T17:02:45+00:00"
}, },
{ {
"name": "pocketmine/color", "name": "pocketmine/color",
@ -469,12 +472,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/pmmp/Log.git", "url": "https://github.com/pmmp/Log.git",
"reference": "cfac4a3ba23efa2f94802868787cf6f449255082" "reference": "b8509a5f30c6317db42a8511785b781b41c5cdd5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/pmmp/Log/zipball/cfac4a3ba23efa2f94802868787cf6f449255082", "url": "https://api.github.com/repos/pmmp/Log/zipball/b8509a5f30c6317db42a8511785b781b41c5cdd5",
"reference": "cfac4a3ba23efa2f94802868787cf6f449255082", "reference": "b8509a5f30c6317db42a8511785b781b41c5cdd5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -484,7 +487,7 @@
"pocketmine/spl": "<0.4" "pocketmine/spl": "<0.4"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "0.12.40", "phpstan/phpstan": "0.12.59",
"phpstan/phpstan-strict-rules": "^0.12.2" "phpstan/phpstan-strict-rules": "^0.12.2"
}, },
"type": "library", "type": "library",
@ -502,7 +505,7 @@
"issues": "https://github.com/pmmp/Log/issues", "issues": "https://github.com/pmmp/Log/issues",
"source": "https://github.com/pmmp/Log/tree/master" "source": "https://github.com/pmmp/Log/tree/master"
}, },
"time": "2020-08-28T20:50:44+00:00" "time": "2020-12-11T00:10:43+00:00"
}, },
{ {
"name": "pocketmine/log-pthreads", "name": "pocketmine/log-pthreads",
@ -510,12 +513,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/pmmp/LogPthreads.git", "url": "https://github.com/pmmp/LogPthreads.git",
"reference": "343333f45a1041641de36d9f9285fbc5349a2571" "reference": "a01bd5dd4ea09c0c921c1f2cd74a75e26e69eb75"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/pmmp/LogPthreads/zipball/343333f45a1041641de36d9f9285fbc5349a2571", "url": "https://api.github.com/repos/pmmp/LogPthreads/zipball/a01bd5dd4ea09c0c921c1f2cd74a75e26e69eb75",
"reference": "343333f45a1041641de36d9f9285fbc5349a2571", "reference": "a01bd5dd4ea09c0c921c1f2cd74a75e26e69eb75",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -528,7 +531,7 @@
}, },
"require-dev": { "require-dev": {
"phpstan/extension-installer": "^1.0", "phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.38", "phpstan/phpstan": "0.12.63",
"phpstan/phpstan-strict-rules": "^0.12.4" "phpstan/phpstan-strict-rules": "^0.12.4"
}, },
"type": "library", "type": "library",
@ -546,7 +549,7 @@
"issues": "https://github.com/pmmp/LogPthreads/issues", "issues": "https://github.com/pmmp/LogPthreads/issues",
"source": "https://github.com/pmmp/LogPthreads/tree/master" "source": "https://github.com/pmmp/LogPthreads/tree/master"
}, },
"time": "2020-08-22T12:07:54+00:00" "time": "2020-12-17T16:35:10+00:00"
}, },
{ {
"name": "pocketmine/math", "name": "pocketmine/math",
@ -554,12 +557,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/pmmp/Math.git", "url": "https://github.com/pmmp/Math.git",
"reference": "fd3a016cfee1939869e6f0bc320a7c99bd2f440d" "reference": "58ffaef47bc269b65c4cf6f0c85f563510c2a91d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/pmmp/Math/zipball/fd3a016cfee1939869e6f0bc320a7c99bd2f440d", "url": "https://api.github.com/repos/pmmp/Math/zipball/58ffaef47bc269b65c4cf6f0c85f563510c2a91d",
"reference": "fd3a016cfee1939869e6f0bc320a7c99bd2f440d", "reference": "58ffaef47bc269b65c4cf6f0c85f563510c2a91d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -567,9 +570,9 @@
"php-64bit": "*" "php-64bit": "*"
}, },
"require-dev": { "require-dev": {
"irstea/phpunit-shim": "^7.5", "irstea/phpunit-shim": "^8.5 || ^9.5",
"phpstan/extension-installer": "^1.0", "phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.44", "phpstan/phpstan": "0.12.59",
"phpstan/phpstan-strict-rules": "^0.12.4" "phpstan/phpstan-strict-rules": "^0.12.4"
}, },
"type": "library", "type": "library",
@ -587,7 +590,7 @@
"issues": "https://github.com/pmmp/Math/issues", "issues": "https://github.com/pmmp/Math/issues",
"source": "https://github.com/pmmp/Math/tree/master" "source": "https://github.com/pmmp/Math/tree/master"
}, },
"time": "2020-09-25T17:32:58+00:00" "time": "2020-12-11T00:18:45+00:00"
}, },
{ {
"name": "pocketmine/nbt", "name": "pocketmine/nbt",
@ -595,12 +598,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/pmmp/NBT.git", "url": "https://github.com/pmmp/NBT.git",
"reference": "7f715bd87e42a9b44cf5a8022e66a4a05280602d" "reference": "460b7f21e80323387197e030b1727c2aef12ec1c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/pmmp/NBT/zipball/7f715bd87e42a9b44cf5a8022e66a4a05280602d", "url": "https://api.github.com/repos/pmmp/NBT/zipball/460b7f21e80323387197e030b1727c2aef12ec1c",
"reference": "7f715bd87e42a9b44cf5a8022e66a4a05280602d", "reference": "460b7f21e80323387197e030b1727c2aef12ec1c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -611,7 +614,7 @@
"require-dev": { "require-dev": {
"irstea/phpunit-shim": "^7.5 || ^8.0", "irstea/phpunit-shim": "^7.5 || ^8.0",
"phpstan/extension-installer": "^1.0", "phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.40", "phpstan/phpstan": "0.12.63",
"phpstan/phpstan-strict-rules": "^0.12.4" "phpstan/phpstan-strict-rules": "^0.12.4"
}, },
"type": "library", "type": "library",
@ -629,7 +632,7 @@
"issues": "https://github.com/pmmp/NBT/issues", "issues": "https://github.com/pmmp/NBT/issues",
"source": "https://github.com/pmmp/NBT/tree/master" "source": "https://github.com/pmmp/NBT/tree/master"
}, },
"time": "2020-08-28T21:02:57+00:00" "time": "2020-12-17T17:17:37+00:00"
}, },
{ {
"name": "pocketmine/raklib", "name": "pocketmine/raklib",
@ -637,12 +640,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/pmmp/RakLib.git", "url": "https://github.com/pmmp/RakLib.git",
"reference": "31e513ee53adf8e32cabad072a50f8572f6dfb12" "reference": "bd21d30af4f3b0d9a83e697922cd57dbefeb146f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/31e513ee53adf8e32cabad072a50f8572f6dfb12", "url": "https://api.github.com/repos/pmmp/RakLib/zipball/bd21d30af4f3b0d9a83e697922cd57dbefeb146f",
"reference": "31e513ee53adf8e32cabad072a50f8572f6dfb12", "reference": "bd21d30af4f3b0d9a83e697922cd57dbefeb146f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -654,7 +657,7 @@
"pocketmine/log": "dev-master" "pocketmine/log": "dev-master"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "0.12.59", "phpstan/phpstan": "0.12.63",
"phpstan/phpstan-strict-rules": "^0.12.2" "phpstan/phpstan-strict-rules": "^0.12.2"
}, },
"type": "library", "type": "library",
@ -672,7 +675,7 @@
"issues": "https://github.com/pmmp/RakLib/issues", "issues": "https://github.com/pmmp/RakLib/issues",
"source": "https://github.com/pmmp/RakLib/tree/master" "source": "https://github.com/pmmp/RakLib/tree/master"
}, },
"time": "2020-12-12T19:33:03+00:00" "time": "2020-12-17T17:49:46+00:00"
}, },
{ {
"name": "pocketmine/snooze", "name": "pocketmine/snooze",
@ -1126,16 +1129,16 @@
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
"version": "v4.10.3", "version": "v4.10.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nikic/PHP-Parser.git", "url": "https://github.com/nikic/PHP-Parser.git",
"reference": "dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984" "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984", "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e",
"reference": "dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984", "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1176,9 +1179,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/nikic/PHP-Parser/issues", "issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.10.3" "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4"
}, },
"time": "2020-12-03T17:45:45+00:00" "time": "2020-12-20T10:01:03+00:00"
}, },
{ {
"name": "phar-io/manifest", "name": "phar-io/manifest",
@ -1242,16 +1245,16 @@
}, },
{ {
"name": "phar-io/version", "name": "phar-io/version",
"version": "3.0.3", "version": "3.0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phar-io/version.git", "url": "https://github.com/phar-io/version.git",
"reference": "726c026815142e4f8677b7cb7f2249c9ffb7ecae" "reference": "e4782611070e50613683d2b9a57730e9a3ba5451"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phar-io/version/zipball/726c026815142e4f8677b7cb7f2249c9ffb7ecae", "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451",
"reference": "726c026815142e4f8677b7cb7f2249c9ffb7ecae", "reference": "e4782611070e50613683d2b9a57730e9a3ba5451",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1287,9 +1290,9 @@
"description": "Library for handling version information and constraints", "description": "Library for handling version information and constraints",
"support": { "support": {
"issues": "https://github.com/phar-io/version/issues", "issues": "https://github.com/phar-io/version/issues",
"source": "https://github.com/phar-io/version/tree/3.0.3" "source": "https://github.com/phar-io/version/tree/3.0.4"
}, },
"time": "2020-11-30T09:21:21+00:00" "time": "2020-12-13T23:18:30+00:00"
}, },
{ {
"name": "phpdocumentor/reflection-common", "name": "phpdocumentor/reflection-common",
@ -1451,16 +1454,16 @@
}, },
{ {
"name": "phpspec/prophecy", "name": "phpspec/prophecy",
"version": "1.12.1", "version": "1.12.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpspec/prophecy.git", "url": "https://github.com/phpspec/prophecy.git",
"reference": "8ce87516be71aae9b956f81906aaf0338e0d8a2d" "reference": "245710e971a030f42e08f4912863805570f23d39"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/8ce87516be71aae9b956f81906aaf0338e0d8a2d", "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39",
"reference": "8ce87516be71aae9b956f81906aaf0338e0d8a2d", "reference": "245710e971a030f42e08f4912863805570f23d39",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1472,7 +1475,7 @@
}, },
"require-dev": { "require-dev": {
"phpspec/phpspec": "^6.0", "phpspec/phpspec": "^6.0",
"phpunit/phpunit": "^8.0 || ^9.0 <9.3" "phpunit/phpunit": "^8.0 || ^9.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -1512,22 +1515,22 @@
], ],
"support": { "support": {
"issues": "https://github.com/phpspec/prophecy/issues", "issues": "https://github.com/phpspec/prophecy/issues",
"source": "https://github.com/phpspec/prophecy/tree/1.12.1" "source": "https://github.com/phpspec/prophecy/tree/1.12.2"
}, },
"time": "2020-09-29T09:10:42+00:00" "time": "2020-12-19T10:15:11+00:00"
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "0.12.59", "version": "0.12.63",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "cf4107257c8ca2ad967efdd6a00f12b21acbb779" "reference": "c97ec4754bd53099a06c24847bd2870b99966b6a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/cf4107257c8ca2ad967efdd6a00f12b21acbb779", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c97ec4754bd53099a06c24847bd2870b99966b6a",
"reference": "cf4107257c8ca2ad967efdd6a00f12b21acbb779", "reference": "c97ec4754bd53099a06c24847bd2870b99966b6a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1558,7 +1561,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/0.12.59" "source": "https://github.com/phpstan/phpstan/tree/0.12.63"
}, },
"funding": [ "funding": [
{ {
@ -1574,39 +1577,34 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2020-12-07T14:46:03+00:00" "time": "2020-12-15T16:37:16+00:00"
}, },
{ {
"name": "phpstan/phpstan-phpunit", "name": "phpstan/phpstan-phpunit",
"version": "0.12.16", "version": "0.12.17",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-phpunit.git", "url": "https://github.com/phpstan/phpstan-phpunit.git",
"reference": "1dd916d181b0539dea5cd37e91546afb8b107e17" "reference": "432575b41cf2d4f44e460234acaf56119ed97d36"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/1dd916d181b0539dea5cd37e91546afb8b107e17", "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/432575b41cf2d4f44e460234acaf56119ed97d36",
"reference": "1dd916d181b0539dea5cd37e91546afb8b107e17", "reference": "432575b41cf2d4f44e460234acaf56119ed97d36",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.1 || ^8.0", "php": "^7.1 || ^8.0",
"phpstan/phpstan": "^0.12.33" "phpstan/phpstan": "^0.12.60"
}, },
"conflict": { "conflict": {
"phpunit/phpunit": "<7.0" "phpunit/phpunit": "<7.0"
}, },
"require-dev": { "require-dev": {
"consistence/coding-standard": "^3.5", "phing/phing": "^2.16.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "php-parallel-lint/php-parallel-lint": "^1.2",
"ergebnis/composer-normalize": "^2.0.2", "phpstan/phpstan-strict-rules": "^0.12.6",
"jakub-onderka/php-parallel-lint": "^1.0", "phpunit/phpunit": "^7.5.20"
"phing/phing": "^2.16.0",
"phpstan/phpstan-strict-rules": "^0.12",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"satooshi/php-coveralls": "^1.0",
"slevomat/coding-standard": "^4.7.2"
}, },
"type": "phpstan-extension", "type": "phpstan-extension",
"extra": { "extra": {
@ -1632,37 +1630,33 @@
"description": "PHPUnit extensions and rules for PHPStan", "description": "PHPUnit extensions and rules for PHPStan",
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan-phpunit/issues", "issues": "https://github.com/phpstan/phpstan-phpunit/issues",
"source": "https://github.com/phpstan/phpstan-phpunit/tree/0.12.16" "source": "https://github.com/phpstan/phpstan-phpunit/tree/0.12.17"
}, },
"time": "2020-08-05T13:28:50+00:00" "time": "2020-12-13T12:12:51+00:00"
}, },
{ {
"name": "phpstan/phpstan-strict-rules", "name": "phpstan/phpstan-strict-rules",
"version": "0.12.5", "version": "0.12.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-strict-rules.git", "url": "https://github.com/phpstan/phpstan-strict-rules.git",
"reference": "334898a32217e4605e0f9cfa3d3fc3101bda26be" "reference": "03807e3410747ec18cd5f05a6342384adcc423bf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/334898a32217e4605e0f9cfa3d3fc3101bda26be", "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/03807e3410747ec18cd5f05a6342384adcc423bf",
"reference": "334898a32217e4605e0f9cfa3d3fc3101bda26be", "reference": "03807e3410747ec18cd5f05a6342384adcc423bf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.1 || ^8.0", "php": "^7.1 || ^8.0",
"phpstan/phpstan": "^0.12.33" "phpstan/phpstan": "^0.12.60"
}, },
"require-dev": { "require-dev": {
"consistence/coding-standard": "^3.0.1", "phing/phing": "^2.16.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "php-parallel-lint/php-parallel-lint": "^1.2",
"ergebnis/composer-normalize": "^2.0.2", "phpstan/phpstan-phpunit": "^0.12.16",
"jakub-onderka/php-parallel-lint": "^1.0", "phpunit/phpunit": "^7.5.20"
"phing/phing": "^2.16.0",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^7.0",
"slevomat/coding-standard": "^4.5.2"
}, },
"type": "phpstan-extension", "type": "phpstan-extension",
"extra": { "extra": {
@ -1687,9 +1681,9 @@
"description": "Extra strict and opinionated rules for PHPStan", "description": "Extra strict and opinionated rules for PHPStan",
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan-strict-rules/issues", "issues": "https://github.com/phpstan/phpstan-strict-rules/issues",
"source": "https://github.com/phpstan/phpstan-strict-rules/tree/master" "source": "https://github.com/phpstan/phpstan-strict-rules/tree/0.12.7"
}, },
"time": "2020-08-30T15:42:06+00:00" "time": "2020-12-13T13:27:14+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
@ -3276,7 +3270,6 @@
"platform": { "platform": {
"php": ">=7.3.0", "php": ">=7.3.0",
"php-64bit": "*", "php-64bit": "*",
"ext-bcmath": "*",
"ext-chunkutils2": "^0.1.0", "ext-chunkutils2": "^0.1.0",
"ext-curl": "*", "ext-curl": "*",
"ext-crypto": "^0.3.1", "ext-crypto": "^0.3.1",

View File

@ -28,6 +28,7 @@ use pocketmine\errorhandler\ErrorTypeToStringMap;
use pocketmine\network\mcpe\protocol\ProtocolInfo; use pocketmine\network\mcpe\protocol\ProtocolInfo;
use pocketmine\plugin\PluginBase; use pocketmine\plugin\PluginBase;
use pocketmine\plugin\PluginManager; use pocketmine\plugin\PluginManager;
use pocketmine\utils\AssumptionFailedError;
use pocketmine\utils\Filesystem; use pocketmine\utils\Filesystem;
use pocketmine\utils\Utils; use pocketmine\utils\Utils;
use function base64_encode; use function base64_encode;
@ -149,7 +150,8 @@ class CrashDump{
if($json === false){ if($json === false){
throw new \RuntimeException("Failed to encode crashdump JSON: " . json_last_error_msg()); throw new \RuntimeException("Failed to encode crashdump JSON: " . json_last_error_msg());
} }
$this->encodedData = zlib_encode($json, ZLIB_ENCODING_DEFLATE, 9); $zlibEncoded = zlib_encode($json, ZLIB_ENCODING_DEFLATE, 9);
if($zlibEncoded === false) throw new AssumptionFailedError("ZLIB compression failed");
foreach(str_split(base64_encode($this->encodedData), 76) as $line){ foreach(str_split(base64_encode($this->encodedData), 76) as $line){
$this->addLine($line); $this->addLine($line);
} }

View File

@ -73,7 +73,6 @@ namespace pocketmine {
} }
$extensions = [ $extensions = [
"bcmath" => "BC Math",
"chunkutils2" => "PocketMine ChunkUtils v2", "chunkutils2" => "PocketMine ChunkUtils v2",
"curl" => "cURL", "curl" => "cURL",
"crypto" => "php-crypto", "crypto" => "php-crypto",
@ -254,7 +253,7 @@ namespace pocketmine {
if(ThreadManager::getInstance()->stopAll() > 0){ if(ThreadManager::getInstance()->stopAll() > 0){
$logger->debug("Some threads could not be stopped, performing a force-kill"); $logger->debug("Some threads could not be stopped, performing a force-kill");
Process::kill(getmypid()); Process::kill(Process::pid());
} }
}while(false); }while(false);

View File

@ -112,7 +112,6 @@ use function file_get_contents;
use function file_put_contents; use function file_put_contents;
use function filemtime; use function filemtime;
use function get_class; use function get_class;
use function getmypid;
use function implode; use function implode;
use function ini_set; use function ini_set;
use function is_a; use function is_a;
@ -1383,7 +1382,7 @@ class Server{
}catch(\Throwable $e){ }catch(\Throwable $e){
$this->logger->logException($e); $this->logger->logException($e);
$this->logger->emergency("Crashed while crashing, killing process"); $this->logger->emergency("Crashed while crashing, killing process");
@Process::kill(getmypid()); @Process::kill(Process::pid());
} }
} }
@ -1516,7 +1515,7 @@ class Server{
echo "--- Waiting $spacing seconds to throttle automatic restart (you can kill the process safely now) ---" . PHP_EOL; echo "--- Waiting $spacing seconds to throttle automatic restart (you can kill the process safely now) ---" . PHP_EOL;
sleep($spacing); sleep($spacing);
} }
@Process::kill(getmypid()); @Process::kill(Process::pid());
exit(1); exit(1);
} }

View File

@ -132,8 +132,7 @@ class Furnace extends Spawnable implements Container, Nameable{
} }
if($this->remainingFuelTime > 0 and $ev->isBurning()){ if($this->remainingFuelTime > 0 and $ev->isBurning()){
$fuel->pop(); $this->inventory->setFuel($fuel->getFuelResidue());
$this->inventory->setFuel($fuel);
} }
} }

View File

@ -460,6 +460,16 @@ class Item implements \JsonSerializable{
return 0; return 0;
} }
/**
* Returns an item after burning fuel
*/
public function getFuelResidue() : Item{
$item = clone $this;
$item->pop();
return $item;
}
/** /**
* Returns how many points of damage this item will deal to an entity when used as a weapon. * Returns how many points of damage this item will deal to an entity when used as a weapon.
*/ */

View File

@ -52,6 +52,10 @@ class LiquidBucket extends Item{
return 0; return 0;
} }
public function getFuelResidue() : Item{
return VanillaItems::BUCKET();
}
public function onInteractBlock(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{ public function onInteractBlock(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{
if(!$blockReplace->canBeReplaced()){ if(!$blockReplace->canBeReplaced()){
return ItemUseResult::NONE(); return ItemUseResult::NONE();

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\network\mcpe\compression; namespace pocketmine\network\mcpe\compression;
use pocketmine\utils\AssumptionFailedError;
use pocketmine\utils\SingletonTrait; use pocketmine\utils\SingletonTrait;
use function function_exists; use function function_exists;
use function libdeflate_deflate_compress; use function libdeflate_deflate_compress;
@ -73,12 +74,18 @@ final class ZlibCompressor implements Compressor{
return $result; return $result;
} }
private static function zlib_encode(string $data, int $level) : string{
$result = zlib_encode($data, ZLIB_ENCODING_RAW, $level);
if($result === false) throw new AssumptionFailedError("ZLIB compression failed");
return $result;
}
public function compress(string $payload) : string{ public function compress(string $payload) : string{
if(function_exists('libdeflate_deflate_compress')){ if(function_exists('libdeflate_deflate_compress')){
return $this->willCompress($payload) ? return $this->willCompress($payload) ?
libdeflate_deflate_compress($payload, $this->level) : libdeflate_deflate_compress($payload, $this->level) :
zlib_encode($payload, ZLIB_ENCODING_RAW, 0); self::zlib_encode($payload, 0);
} }
return zlib_encode($payload, ZLIB_ENCODING_RAW, $this->willCompress($payload) ? $this->level : 0); return self::zlib_encode($payload, $this->willCompress($payload) ? $this->level : 0);
} }
} }

View File

@ -87,7 +87,7 @@ trait EnumTrait{
} }
$this->enumName = $enumName; $this->enumName = $enumName;
if(self::$nextId === null){ if(self::$nextId === null){
self::$nextId = getmypid(); //this provides enough base entropy to prevent hardcoding self::$nextId = Process::pid(); //this provides enough base entropy to prevent hardcoding
} }
$this->runtimeId = self::$nextId++; $this->runtimeId = self::$nextId++;
} }

View File

@ -30,6 +30,8 @@ use function fclose;
use function file; use function file;
use function file_get_contents; use function file_get_contents;
use function function_exists; use function function_exists;
use function getmypid;
use function getmyuid;
use function hexdec; use function hexdec;
use function memory_get_usage; use function memory_get_usage;
use function posix_kill; use function posix_kill;
@ -173,4 +175,20 @@ final class Process{
return proc_close($process); return proc_close($process);
} }
public static function pid() : int{
$result = getmypid();
if($result === false){
throw new \LogicException("getmypid() doesn't work on this platform");
}
return $result;
}
public static function uid() : int{
$result = getmyuid();
if($result === false){
throw new \LogicException("getmyuid() doesn't work on this platform");
}
return $result;
}
} }

View File

@ -24,7 +24,6 @@ declare(strict_types=1);
namespace pocketmine\utils; namespace pocketmine\utils;
use pocketmine\thread\Thread; use pocketmine\thread\Thread;
use function getmypid;
use function time; use function time;
class ServerKiller extends Thread{ class ServerKiller extends Thread{
@ -51,7 +50,7 @@ class ServerKiller extends Thread{
}); });
if(time() - $start >= $this->time){ if(time() - $start >= $this->time){
echo "\nTook too long to stop, server was killed forcefully!\n"; echo "\nTook too long to stop, server was killed forcefully!\n";
@Process::kill(getmypid()); @Process::kill(Process::pid());
} }
} }

View File

@ -183,7 +183,14 @@ final class Utils{
} }
$machine = php_uname("a"); $machine = php_uname("a");
$machine .= ($cpuinfo = @file("/proc/cpuinfo")) !== false ? implode(preg_grep("/(model name|Processor|Serial)/", $cpuinfo)) : ""; $cpuinfo = @file("/proc/cpuinfo");
if($cpuinfo !== false){
$cpuinfoLines = preg_grep("/(model name|Processor|Serial)/", $cpuinfo);
if($cpuinfoLines === false){
throw new AssumptionFailedError("Pattern is valid, so this shouldn't fail ...");
}
$machine .= implode("", $cpuinfoLines);
}
$machine .= sys_get_temp_dir(); $machine .= sys_get_temp_dir();
$machine .= $extra; $machine .= $extra;
$os = Utils::getOS(); $os = Utils::getOS();

View File

@ -126,7 +126,9 @@ final class FastChunkSerializer{
for($i = 0, $layerCount = $stream->getByte(); $i < $layerCount; ++$i){ for($i = 0, $layerCount = $stream->getByte(); $i < $layerCount; ++$i){
$bitsPerBlock = $stream->getByte(); $bitsPerBlock = $stream->getByte();
$words = $stream->get(PalettedBlockArray::getExpectedWordArraySize($bitsPerBlock)); $words = $stream->get(PalettedBlockArray::getExpectedWordArraySize($bitsPerBlock));
$palette = array_values(unpack("L*", $stream->get($stream->getInt()))); /** @var int[] $unpackedPalette */
$unpackedPalette = unpack("L*", $stream->get($stream->getInt())); //unpack() will never fail here
$palette = array_values($unpackedPalette);
$layers[] = PalettedBlockArray::fromData($bitsPerBlock, $words, $palette); $layers[] = PalettedBlockArray::fromData($bitsPerBlock, $words, $palette);
} }
@ -137,7 +139,9 @@ final class FastChunkSerializer{
$biomeIds = new BiomeArray($stream->get(256)); $biomeIds = new BiomeArray($stream->get(256));
if($lightPopulated){ if($lightPopulated){
$heightMap = new HeightArray(array_values(unpack("S*", $stream->get(512)))); /** @var int[] $unpackedHeightMap */
$unpackedHeightMap = unpack("S*", $stream->get(512)); //unpack() will never fail here
$heightMap = new HeightArray(array_values($unpackedHeightMap));
} }
$chunk = new Chunk($subChunks, null, null, $biomeIds, $heightMap); $chunk = new Chunk($subChunks, null, null, $biomeIds, $heightMap);

View File

@ -365,7 +365,9 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
try{ try{
$binaryStream->get(256); //heightmap, discard it $binaryStream->get(256); //heightmap, discard it
$biomeArray = new BiomeArray(ChunkUtils::convertBiomeColors(array_values(unpack("N*", $binaryStream->get(1024))))); //never throws /** @var int[] $unpackedBiomeArray */
$unpackedBiomeArray = unpack("N*", $binaryStream->get(1024)); //unpack() will never fail here
$biomeArray = new BiomeArray(ChunkUtils::convertBiomeColors(array_values($unpackedBiomeArray))); //never throws
}catch(BinaryDataException $e){ }catch(BinaryDataException $e){
throw new CorruptedChunkException($e->getMessage(), 0, $e); throw new CorruptedChunkException($e->getMessage(), 0, $e);
} }

54
tests/gh-actions/build.sh Executable file
View File

@ -0,0 +1,54 @@
VERSION=7.4.13
sudo apt update && sudo apt install -y \
re2c \
libtool \
libtool-bin \
zlib1g-dev \
libcurl4-openssl-dev \
libxml2-dev \
libyaml-dev \
libgmp-dev \
libzip-dev \
libssl-dev
curl -sSL https://www.php.net/distributions/php-$VERSION.tar.gz | tar -xz
INSTALL_DIR="$(pwd)/bin/php7"
cd php-$VERSION
cd ext/
curl -sSL https://github.com/pmmp/pthreads/archive/2bcd8b8c10395d58b8a9bc013e3a5328080c867f.tar.gz | tar -xz
curl -sSL https://github.com/php/pecl-file_formats-yaml/archive/2.2.0.tar.gz | tar -xz
cd ..
CFLAGS="$CFLAGS -march=x86-64"
CXXFLAGS="$CXXFLAGS -march=x86-64"
./buildconf --force
./configure \
--prefix="$INSTALL_DIR" \
--exec-prefix="$INSTALL_DIR" \
--enable-maintainer-zts \
--enable-cli \
--disable-cgi \
--disable-phpdbg \
--disable-session \
--without-pear \
--without-sqlite3 \
--disable-pdo \
--enable-pthreads \
--with-yaml \
--with-libxml \
--enable-xml \
--enable-simplexml \
--enable-xmlreader \
--enable-xmlwriter \
--enable-mbstring \
--disable-mbregex \
--enable-sockets \
--with-curl \
--with-zlib \
--with-zip \
--with-gmp \
--with-openssl
make -j8 install