Compare commits

...

20 Commits

Author SHA1 Message Date
b54854529f Release 3.24.0 2021-10-09 20:20:37 +01:00
974d08efd6 Bump PHP minimum requirement to 8.0
PHPStan failed on 7.4 after updating to 0.12.99, and I figured it was less hassle to just do this than fix the build. In any case, we stopped shipping 7.4 months ago, and warned at 3.22 release that 7.4 support would soon be dropped.
2021-10-09 20:09:42 +01:00
289553fa46 CS again 2021-10-09 19:50:07 +01:00
e38866c4ba phpstan 0.12.99 2021-10-09 19:33:43 +01:00
58a95f8836 Updated transitive composer dependencies 2021-10-09 19:18:32 +01:00
e032b8fe20 Server: fixed stats reporting checking a nonexistent pocketmine.yml property
this was originally worked around by 47f7af6739. However, that commit was just duct tape, and I never bothered to investigate if the config was being checked somewhere else.
Here's to a years-old bug finally getting fixed.
2021-10-06 22:23:41 +01:00
a27c14c00c phpstan: exclude build/php from analysis
in case I built PHP in there, I don't want the install_data getting analysed and screwing up the analysis.
2021-10-05 00:14:44 +00:00
003c002208 Bump phpunit/phpunit from 9.5.9 to 9.5.10 (#4482)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.9 to 9.5.10.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.9...9.5.10)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-28 21:04:11 +01:00
d417b1e2f5 Projectile: fixed move() not using the given parameters (#4481)
it was using this->motion instead, which usually would be the same, but maybe not.
2021-09-28 21:03:03 +01:00
65e468e3c2 Updated build/php submodule to pmmp/php-build-scripts@6aac46e500 2021-09-28 21:00:13 +01:00
a11cf8c296 Update PHP versions used by GitHub Actions 2021-09-28 20:52:40 +01:00
d455188d03 3.23.2 is next 2021-09-22 01:00:50 +01:00
14fba36636 Release 3.23.1 2021-09-22 01:00:50 +01:00
43ac3fbf3e actions: use newer PHP versions 2021-09-22 00:51:06 +01:00
352162a6e6 Fixed PHP 7.4 build 2021-09-22 00:50:00 +01:00
b3601c9390 Regenerate PHPStan baselines 2021-09-22 00:45:07 +01:00
817fec9e3d EducationSettingsPacket: safeguard against purity issue reported by PHPStan
while annoying, PHPStan is right to complain about this, because putBool() is impure, meaning that these fields could have been mutated in the call.
We know they didn't, but PHPStan doesn't, and we can't mark the method as pure because .. well .. it isn't.
2021-09-22 00:44:52 +01:00
ceeef7c729 3.23.1 is next 2021-09-22 00:29:24 +01:00
7f1b2a0ee5 Release 3.23.0 2021-09-22 00:29:24 +01:00
27324a3aeb Protocol changes for 1.17.30 2021-09-22 00:26:39 +01:00
51 changed files with 990 additions and 325 deletions

View File

@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
image: [ubuntu-20.04]
php: [7.4.22, 8.0.9]
php: [8.0.11]
steps:
- uses: actions/checkout@v2 #needed for build.sh
@ -36,13 +36,8 @@ jobs:
strategy:
fail-fast: false
matrix:
include:
- php: 8.0.9
config: phpstan.neon.dist
image: ubuntu-20.04
- php: 7.4.22
config: phpstan.php7.neon
image: ubuntu-20.04
image: [ubuntu-20.04]
php: [8.0.11]
steps:
- uses: actions/checkout@v2
@ -82,7 +77,7 @@ jobs:
run: php composer.phar install --prefer-dist --no-interaction
- name: Run PHPStan
run: ./vendor/bin/phpstan analyze --no-progress --memory-limit=2G -c ${{ matrix.config }}
run: ./vendor/bin/phpstan analyze --no-progress --memory-limit=2G
phpunit:
name: PHPUnit tests
@ -92,7 +87,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [7.4.22, 8.0.9]
php: [8.0.11]
steps:
- uses: actions/checkout@v2
@ -142,7 +137,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [7.4.22, 8.0.9]
php: [8.0.11]
steps:
- uses: actions/checkout@v2
@ -194,7 +189,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [7.4.22, 8.0.9]
php: [8.0.11]
steps:
- uses: actions/checkout@v2

View File

@ -22,8 +22,6 @@
declare(strict_types=1);
const VERSIONS = [
"7.3",
"7.4",
"8.0"
];

View File

@ -2,13 +2,13 @@
## Pre-requisites
- A bash shell (git bash is sufficient for Windows)
- [`git`](https://git-scm.com) available in your shell
- PHP 7.4 or newer available in your shell
- PHP 8.0 or newer available in your shell
- [`composer`](https://getcomposer.org) available in your shell
## Custom PHP binaries
Because PocketMine-MP requires several non-standard PHP extensions and configuration, PMMP provides scripts to build custom binaries for running PocketMine-MP, as well as prebuilt binaries.
- [Prebuilt binaries](https://jenkins.pmmp.io/job/PHP-7.4-Aggregate)
- [Prebuilt binaries](https://jenkins.pmmp.io/job/PHP-8.0-Aggregate)
- [Compile scripts](https://github.com/pmmp/php-build-scripts) are provided as a submodule in the path `build/php`
If you use a custom binary, you'll need to replace `composer` usages in this guide with `path/to/your/php path/to/your/composer.phar`.
@ -38,7 +38,7 @@ There is a bug in PHP that might cause an error which looks like this:
```
Fatal error: Uncaught BadMethodCallException: unable to create temporary file in PocketMine-MP/build/server-phar.php:119
```
You can work around it by setting `ulimit -n` to some bigger number, e.g. `8192`, or by updating your PHP version to at least 7.4.16 or 8.0.3.
You can work around it by setting `ulimit -n` to some bigger number, e.g. `8192`, or by updating your PHP version to at least 8.0.3.
## Running PocketMine-MP from source code
Run `src/pocketmine/PocketMine.php` using your preferred PHP binary.

14
changelogs/3.23.md Normal file
View File

@ -0,0 +1,14 @@
**For Minecraft: Bedrock Edition 1.17.30**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.23.0
- Added support for Minecraft: Bedrock Edition 1.17.30.
- Removed compatibility with earlier versions.
# 3.23.1
- Fixed broken build of 3.23.0.

12
changelogs/3.24.md Normal file
View File

@ -0,0 +1,12 @@
**For Minecraft: Bedrock Edition 1.17.30**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.24.0
- PHP 8.0 is now required as a minimum.
- Fixed stats reporting checking the wrong `pocketmine.yml` property.
- Fixed `Projectile->move()` not respecting the given `dx`/`dy`/`dz` and using its own motion instead.

View File

@ -5,7 +5,7 @@
"homepage": "https://pmmp.io",
"license": "LGPL-3.0",
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.0",
"php-64bit": "*",
"ext-ctype": "*",
"ext-curl": "*",
@ -38,7 +38,7 @@
"pocketmine/spl": "^0.4.0"
},
"require-dev": {
"phpstan/phpstan": "0.12.98",
"phpstan/phpstan": "0.12.99",
"phpstan/phpstan-phpunit": "^0.12.6",
"phpstan/phpstan-strict-rules": "^0.12.2",
"phpunit/phpunit": "^9.2"
@ -60,7 +60,7 @@
},
"config": {
"platform": {
"php": "7.4.0"
"php": "8.0.0"
},
"sort-packages": true
},

92
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": "8fc787ba6d9029fb6daa3e8c112b76c5",
"content-hash": "cfba71d2ad0dd961ed00520b5d52e4d7",
"packages": [
{
"name": "adhocore/json-comment",
@ -617,16 +617,16 @@
},
{
"name": "nikic/php-parser",
"version": "v4.12.0",
"version": "v4.13.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "6608f01670c3cc5079e18c1dab1104e002579143"
"reference": "50953a2691a922aa1769461637869a0a2faa3f53"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143",
"reference": "6608f01670c3cc5079e18c1dab1104e002579143",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53",
"reference": "50953a2691a922aa1769461637869a0a2faa3f53",
"shasum": ""
},
"require": {
@ -667,9 +667,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.12.0"
"source": "https://github.com/nikic/PHP-Parser/tree/v4.13.0"
},
"time": "2021-07-21T10:44:31+00:00"
"time": "2021-09-20T12:20:58+00:00"
},
{
"name": "phar-io/manifest",
@ -893,16 +893,16 @@
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.4.0",
"version": "1.5.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0"
"reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0",
"reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae",
"reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae",
"shasum": ""
},
"require": {
@ -910,7 +910,8 @@
"phpdocumentor/reflection-common": "^2.0"
},
"require-dev": {
"ext-tokenizer": "*"
"ext-tokenizer": "*",
"psalm/phar": "^4.8"
},
"type": "library",
"extra": {
@ -936,39 +937,39 @@
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0"
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1"
},
"time": "2020-09-17T18:55:26+00:00"
"time": "2021-10-02T14:08:47+00:00"
},
{
"name": "phpspec/prophecy",
"version": "1.13.0",
"version": "1.14.0",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "be1996ed8adc35c3fd795488a653f4b518be70ea"
"reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea",
"reference": "be1996ed8adc35c3fd795488a653f4b518be70ea",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e",
"reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.2",
"php": "^7.2 || ~8.0, <8.1",
"php": "^7.2 || ~8.0, <8.2",
"phpdocumentor/reflection-docblock": "^5.2",
"sebastian/comparator": "^3.0 || ^4.0",
"sebastian/recursion-context": "^3.0 || ^4.0"
},
"require-dev": {
"phpspec/phpspec": "^6.0",
"phpspec/phpspec": "^6.0 || ^7.0",
"phpunit/phpunit": "^8.0 || ^9.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.11.x-dev"
"dev-master": "1.x-dev"
}
},
"autoload": {
@ -1003,22 +1004,22 @@
],
"support": {
"issues": "https://github.com/phpspec/prophecy/issues",
"source": "https://github.com/phpspec/prophecy/tree/1.13.0"
"source": "https://github.com/phpspec/prophecy/tree/1.14.0"
},
"time": "2021-03-17T13:42:18+00:00"
"time": "2021-09-10T09:02:12+00:00"
},
{
"name": "phpstan/phpstan",
"version": "0.12.98",
"version": "0.12.99",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "3bb7cc246c057405dd5e290c3ecc62ab51d57e00"
"reference": "b4d40f1d759942f523be267a1bab6884f46ca3f7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/3bb7cc246c057405dd5e290c3ecc62ab51d57e00",
"reference": "3bb7cc246c057405dd5e290c3ecc62ab51d57e00",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/b4d40f1d759942f523be267a1bab6884f46ca3f7",
"reference": "b4d40f1d759942f523be267a1bab6884f46ca3f7",
"shasum": ""
},
"require": {
@ -1049,7 +1050,7 @@
"description": "PHPStan - PHP Static Analysis Tool",
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/0.12.98"
"source": "https://github.com/phpstan/phpstan/tree/0.12.99"
},
"funding": [
{
@ -1069,7 +1070,7 @@
"type": "tidelift"
}
],
"time": "2021-09-02T12:33:01+00:00"
"time": "2021-09-12T20:09:55+00:00"
},
{
"name": "phpstan/phpstan-phpunit",
@ -1177,23 +1178,23 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.6",
"version": "9.2.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "f6293e1b30a2354e8428e004689671b83871edde"
"reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f6293e1b30a2354e8428e004689671b83871edde",
"reference": "f6293e1b30a2354e8428e004689671b83871edde",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218",
"reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"ext-xmlwriter": "*",
"nikic/php-parser": "^4.10.2",
"nikic/php-parser": "^4.12.0",
"php": ">=7.3",
"phpunit/php-file-iterator": "^3.0.3",
"phpunit/php-text-template": "^2.0.2",
@ -1242,7 +1243,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.6"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7"
},
"funding": [
{
@ -1250,7 +1251,7 @@
"type": "github"
}
],
"time": "2021-03-28T07:26:59+00:00"
"time": "2021-09-17T05:39:03+00:00"
},
{
"name": "phpunit/php-file-iterator",
@ -1495,16 +1496,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.9",
"version": "9.5.10",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b"
"reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b",
"reference": "ea8c2dfb1065eb35a79b3681eee6e6fb0a6f273b",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a",
"reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a",
"shasum": ""
},
"require": {
@ -1520,7 +1521,7 @@
"phar-io/version": "^3.0.2",
"php": ">=7.3",
"phpspec/prophecy": "^1.12.1",
"phpunit/php-code-coverage": "^9.2.3",
"phpunit/php-code-coverage": "^9.2.7",
"phpunit/php-file-iterator": "^3.0.5",
"phpunit/php-invoker": "^3.1.1",
"phpunit/php-text-template": "^2.0.3",
@ -1582,7 +1583,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.9"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10"
},
"funding": [
{
@ -1594,7 +1595,7 @@
"type": "github"
}
],
"time": "2021-08-31T06:47:40+00:00"
"time": "2021-09-25T07:38:51+00:00"
},
{
"name": "sebastian/cli-parser",
@ -2449,7 +2450,6 @@
"type": "github"
}
],
"abandoned": true,
"time": "2020-09-28T06:45:17+00:00"
},
{
@ -2755,7 +2755,7 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": "^7.4 || ^8.0",
"php": "^8.0",
"php-64bit": "*",
"ext-ctype": "*",
"ext-curl": "*",
@ -2778,7 +2778,7 @@
},
"platform-dev": [],
"platform-overrides": {
"php": "7.4.0"
"php": "8.0.0"
},
"plugin-api-version": "2.1.0"
}

View File

@ -5,7 +5,6 @@ includes:
- tests/phpstan/configs/l7-baseline.neon
- tests/phpstan/configs/l8-baseline.neon
- tests/phpstan/configs/php-bugs.neon
- tests/phpstan/configs/php74-compat.neon
- tests/phpstan/configs/phpstan-bugs.neon
- tests/phpstan/configs/phpunit-wiring-tests.neon
- tests/phpstan/configs/pthreads-bugs.neon
@ -33,6 +32,7 @@ parameters:
- tests/plugins/TesterPlugin
excludePaths:
analyseAndScan:
- build/php
- build/preprocessor
dynamicConstantNames:
- pocketmine\DEBUG
@ -48,7 +48,5 @@ parameters:
#variadics don't work for this - mixed probably shouldn't work either, but for now it does
#what we actually need is something that accepts an infinite number of parameters, but in the absence of that,
#we'll just fill it with 10 - it's very unlikely to encounter a callable with 10 parameters anyway.
anyCallable: 'callable(mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed) : mixed'
anyClosure: '\Closure(mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed) : mixed'
PhpSocket: '\Socket'
PhpCurlHandle: '\CurlHandle'
anyCallable: 'callable(never, never, never, never, never, never, never, never, never, never) : mixed'
anyClosure: '\Closure(never, never, never, never, never, never, never, never, never, never) : mixed'

View File

@ -1,9 +0,0 @@
includes:
- phpstan.neon.dist
- tests/phpstan/configs/php7.neon
parameters:
phpVersion: 70400
typeAliases:
PhpSocket: resource
PhpCurlHandle: resource

View File

@ -1976,17 +1976,19 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
base64_decode($packet->clientData["CapeData"] ?? "", true)
),
base64_decode($packet->clientData["SkinGeometryData"] ?? "", true),
base64_decode($packet->clientData["SkinGeometryDataEngineVersion"], true),
base64_decode($packet->clientData["SkinAnimationData"] ?? "", true),
$packet->clientData["PremiumSkin"] ?? false,
$packet->clientData["PersonaSkin"] ?? false,
$packet->clientData["CapeOnClassicSkin"] ?? false,
$packet->clientData["CapeId"] ?? "",
null,
$packet->clientData["ArmSize"] ?? SkinData::ARM_SIZE_WIDE,
$packet->clientData["SkinColor"] ?? "",
$personaPieces,
$pieceTintColors,
true
true,
$packet->clientData["PremiumSkin"] ?? false,
$packet->clientData["PersonaSkin"] ?? false,
$packet->clientData["CapeOnClassicSkin"] ?? false,
true, //assume this is true? there's no field for it ...
);
try{

View File

@ -36,7 +36,7 @@ namespace pocketmine {
require_once __DIR__ . '/VersionInfo.php';
const MIN_PHP_VERSION = "7.4.0";
const MIN_PHP_VERSION = "8.0.0";
/**
* @param string $message

View File

@ -1961,7 +1961,7 @@ class Server{
$this->network->blockAddress($entry->getName(), -1);
}
if((bool) $this->getProperty("settings.send-usage", true)){
if((bool) $this->getProperty("anonymous-statistics.enabled", true)){
$this->sendUsageTicker = 6000;
$this->sendUsage(SendUsageTask::TYPE_OPEN);
}

View File

@ -33,7 +33,7 @@ if(defined('pocketmine\_VERSION_INFO_INCLUDED')){
const _VERSION_INFO_INCLUDED = true;
const NAME = "PocketMine-MP";
const BASE_VERSION = "3.22.6";
const IS_DEVELOPMENT_BUILD = true;
const BASE_VERSION = "3.24.0";
const IS_DEVELOPMENT_BUILD = false;
const BUILD_NUMBER = 0;
const BUILD_CHANNEL = "";
const BUILD_CHANNEL = "stable";

View File

@ -180,7 +180,7 @@ abstract class Projectile extends Entity{
Timings::$entityMoveTimer->startTiming();
$start = $this->asVector3();
$end = $start->add($this->motion);
$end = $start->add($dx, $dy, $dz);
$blockHit = null;
$entityHit = null;

View File

@ -105,10 +105,8 @@ class NetworkBinaryStream extends BinaryStream{
}
$capeData = $this->getSkinImage();
$geometryData = $this->getString();
$geometryDataVersion = $this->getString();
$animationData = $this->getString();
$premium = $this->getBool();
$persona = $this->getBool();
$capeOnClassic = $this->getBool();
$capeId = $this->getString();
$fullSkinId = $this->getString();
$armSize = $this->getString();
@ -137,8 +135,12 @@ class NetworkBinaryStream extends BinaryStream{
$colors
);
}
$premium = $this->getBool();
$persona = $this->getBool();
$capeOnClassic = $this->getBool();
$isPrimaryUser = $this->getBool();
return new SkinData($skinId, $skinPlayFabId, $skinResourcePatch, $skinData, $animations, $capeData, $geometryData, $animationData, $premium, $persona, $capeOnClassic, $capeId, $fullSkinId, $armSize, $skinColor, $personaPieces, $pieceTintColors);
return new SkinData($skinId, $skinPlayFabId, $skinResourcePatch, $skinData, $animations, $capeData, $geometryData, $geometryDataVersion, $animationData, $capeId, $fullSkinId, $armSize, $skinColor, $personaPieces, $pieceTintColors, true, $premium, $persona, $capeOnClassic, $isPrimaryUser);
}
/**
@ -158,10 +160,8 @@ class NetworkBinaryStream extends BinaryStream{
}
$this->putSkinImage($skin->getCapeImage());
$this->putString($skin->getGeometryData());
$this->putString($skin->getGeometryDataEngineVersion());
$this->putString($skin->getAnimationData());
$this->putBool($skin->isPremium());
$this->putBool($skin->isPersona());
$this->putBool($skin->isPersonaCapeOnClassic());
$this->putString($skin->getCapeId());
$this->putString($skin->getFullSkinId());
$this->putString($skin->getArmSize());
@ -182,6 +182,10 @@ class NetworkBinaryStream extends BinaryStream{
$this->putString($color);
}
}
$this->putBool($skin->isPremium());
$this->putBool($skin->isPersona());
$this->putBool($skin->isPersonaCapeOnClassic());
$this->putBool($skin->isPrimaryUser());
}
private function getSkinImage() : SkinImage{

View File

@ -66,11 +66,13 @@ use pocketmine\network\mcpe\protocol\ContainerSetDataPacket;
use pocketmine\network\mcpe\protocol\CorrectPlayerMovePredictionPacket;
use pocketmine\network\mcpe\protocol\CraftingDataPacket;
use pocketmine\network\mcpe\protocol\CraftingEventPacket;
use pocketmine\network\mcpe\protocol\CreatePhotoPacket;
use pocketmine\network\mcpe\protocol\CreativeContentPacket;
use pocketmine\network\mcpe\protocol\DataPacket;
use pocketmine\network\mcpe\protocol\DebugInfoPacket;
use pocketmine\network\mcpe\protocol\DisconnectPacket;
use pocketmine\network\mcpe\protocol\EducationSettingsPacket;
use pocketmine\network\mcpe\protocol\EduUriResourcePacket;
use pocketmine\network\mcpe\protocol\EmoteListPacket;
use pocketmine\network\mcpe\protocol\EmotePacket;
use pocketmine\network\mcpe\protocol\EventPacket;
@ -114,6 +116,7 @@ use pocketmine\network\mcpe\protocol\NpcDialoguePacket;
use pocketmine\network\mcpe\protocol\NpcRequestPacket;
use pocketmine\network\mcpe\protocol\OnScreenTextureAnimationPacket;
use pocketmine\network\mcpe\protocol\PacketViolationWarningPacket;
use pocketmine\network\mcpe\protocol\PhotoInfoRequestPacket;
use pocketmine\network\mcpe\protocol\PhotoTransferPacket;
use pocketmine\network\mcpe\protocol\PlayerActionPacket;
use pocketmine\network\mcpe\protocol\PlayerArmorDamagePacket;
@ -187,6 +190,7 @@ use pocketmine\network\mcpe\protocol\UpdateBlockSyncedPacket;
use pocketmine\network\mcpe\protocol\UpdateEquipPacket;
use pocketmine\network\mcpe\protocol\UpdatePlayerGameTypePacket;
use pocketmine\network\mcpe\protocol\UpdateSoftEnumPacket;
use pocketmine\network\mcpe\protocol\UpdateSubChunkBlocksPacket;
use pocketmine\network\mcpe\protocol\UpdateTradePacket;
abstract class NetworkSession{
@ -851,4 +855,20 @@ abstract class NetworkSession{
public function handleNpcDialogue(NpcDialoguePacket $packet) : bool{
return false;
}
public function handleEduUriResource(EduUriResourcePacket $packet) : bool{
return false;
}
public function handleCreatePhoto(CreatePhotoPacket $packet) : bool{
return false;
}
public function handleUpdateSubChunkBlocks(UpdateSubChunkBlocksPacket $packet) : bool{
return false;
}
public function handlePhotoInfoRequest(PhotoInfoRequestPacket $packet) : bool{
return false;
}
}

View File

@ -34,15 +34,19 @@ class ActorPickRequestPacket extends DataPacket{
public $entityUniqueId;
/** @var int */
public $hotbarSlot;
/** @var bool */
public $addUserData;
protected function decodePayload(){
$this->entityUniqueId = $this->getLLong();
$this->hotbarSlot = $this->getByte();
$this->addUserData = $this->getBool();
}
protected function encodePayload(){
$this->putLLong($this->entityUniqueId);
$this->putByte($this->hotbarSlot);
$this->putBool($this->addUserData);
}
public function handle(NetworkSession $session) : bool{

View File

@ -36,11 +36,14 @@ class AddVolumeEntityPacket extends DataPacket{
private $entityNetId;
/** @var CompoundTag */
private $data;
/** @var string */
private $engineVersion;
public static function create(int $entityNetId, CompoundTag $data) : self{
public static function create(int $entityNetId, CompoundTag $data, string $engineVersion) : self{
$result = new self;
$result->entityNetId = $entityNetId;
$result->data = $data;
$result->engineVersion = $engineVersion;
return $result;
}
@ -48,14 +51,18 @@ class AddVolumeEntityPacket extends DataPacket{
public function getData() : CompoundTag{ return $this->data; }
public function getEngineVersion() : string{ return $this->engineVersion; }
protected function decodePayload() : void{
$this->entityNetId = $this->getUnsignedVarInt();
$this->data = $this->getNbtCompoundRoot();
$this->engineVersion = $this->getString();
}
protected function encodePayload() : void{
$this->putUnsignedVarInt($this->entityNetId);
$this->put((new NetworkLittleEndianNBTStream())->write($this->data));
$this->putString($this->engineVersion);
}
public function handle(NetworkSession $handler) : bool{

View File

@ -37,6 +37,8 @@ class AnimateEntityPacket extends DataPacket/* implements ClientboundPacket*/{
private $nextState;
/** @var string */
private $stopExpression;
/** @var int */
private $stopExpressionVersion;
/** @var string */
private $controller;
/** @var float */
@ -51,11 +53,12 @@ class AnimateEntityPacket extends DataPacket/* implements ClientboundPacket*/{
* @param int[] $actorRuntimeIds
* @phpstan-param list<int> $actorRuntimeIds
*/
public static function create(string $animation, string $nextState, string $stopExpression, string $controller, float $blendOutTime, array $actorRuntimeIds) : self{
public static function create(string $animation, string $nextState, string $stopExpression, int $stopExpressionVersion, string $controller, float $blendOutTime, array $actorRuntimeIds) : self{
$result = new self;
$result->animation = $animation;
$result->nextState = $nextState;
$result->stopExpression = $stopExpression;
$result->stopExpressionVersion = $stopExpressionVersion;
$result->controller = $controller;
$result->blendOutTime = $blendOutTime;
$result->actorRuntimeIds = $actorRuntimeIds;
@ -68,6 +71,8 @@ class AnimateEntityPacket extends DataPacket/* implements ClientboundPacket*/{
public function getStopExpression() : string{ return $this->stopExpression; }
public function getStopExpressionVersion() : int{ return $this->stopExpressionVersion; }
public function getController() : string{ return $this->controller; }
public function getBlendOutTime() : float{ return $this->blendOutTime; }
@ -82,6 +87,7 @@ class AnimateEntityPacket extends DataPacket/* implements ClientboundPacket*/{
$this->animation = $this->getString();
$this->nextState = $this->getString();
$this->stopExpression = $this->getString();
$this->stopExpressionVersion = $this->getLInt();
$this->controller = $this->getString();
$this->blendOutTime = $this->getLFloat();
$this->actorRuntimeIds = [];
@ -94,6 +100,7 @@ class AnimateEntityPacket extends DataPacket/* implements ClientboundPacket*/{
$this->putString($this->animation);
$this->putString($this->nextState);
$this->putString($this->stopExpression);
$this->putLInt($this->stopExpressionVersion);
$this->putString($this->controller);
$this->putLFloat($this->blendOutTime);
$this->putUnsignedVarInt(count($this->actorRuntimeIds));

View File

@ -32,6 +32,8 @@ use pocketmine\item\ItemFactory;
use pocketmine\network\mcpe\convert\ItemTranslator;
use pocketmine\network\mcpe\NetworkBinaryStream;
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\types\MaterialReducerRecipe;
use pocketmine\network\mcpe\protocol\types\MaterialReducerRecipeOutput;
use pocketmine\network\mcpe\protocol\types\PotionContainerChangeRecipe;
use pocketmine\network\mcpe\protocol\types\PotionTypeRecipe;
#ifndef COMPILE
@ -58,6 +60,8 @@ class CraftingDataPacket extends DataPacket{
public $potionTypeRecipes = [];
/** @var PotionContainerChangeRecipe[] */
public $potionContainerRecipes = [];
/** @var MaterialReducerRecipe[] */
public $materialReducerRecipes = [];
/** @var bool */
public $cleanRecipes = false;
@ -169,6 +173,17 @@ class CraftingDataPacket extends DataPacket{
[$output, ] = ItemTranslator::getInstance()->fromNetworkId($outputIdNet, 0);
$this->potionContainerRecipes[] = new PotionContainerChangeRecipe($input, $ingredient, $output);
}
for($i = 0, $count = $this->getUnsignedVarInt(); $i < $count; ++$i){
$inputIdAndData = $this->getVarInt();
[$inputId, $inputMeta] = [$inputIdAndData >> 16, $inputIdAndData & 0x7fff];
$outputs = [];
for($j = 0, $outputCount = $this->getUnsignedVarInt(); $j < $outputCount; ++$j){
$outputItemId = $this->getVarInt();
$outputItemCount = $this->getVarInt();
$outputs[] = new MaterialReducerRecipeOutput($outputItemId, $outputItemCount);
}
$this->materialReducerRecipes[] = new MaterialReducerRecipe($inputId, $inputMeta, $outputs);
}
$this->cleanRecipes = $this->getBool();
}
@ -301,6 +316,15 @@ class CraftingDataPacket extends DataPacket{
$this->putVarInt($recipe->getIngredientItemId());
$this->putVarInt($recipe->getOutputItemId());
}
$this->putUnsignedVarInt(count($this->materialReducerRecipes));
foreach($this->materialReducerRecipes as $recipe){
$this->putVarInt(($recipe->getInputItemId() << 16) | $recipe->getInputItemMeta());
$this->putUnsignedVarInt(count($recipe->getOutputs()));
foreach($recipe->getOutputs() as $output){
$this->putVarInt($output->getItemId());
$this->putVarInt($output->getCount());
}
}
$this->putBool($this->cleanRecipes);
}

View File

@ -0,0 +1,69 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\NetworkSession;
class CreatePhotoPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::CREATE_PHOTO_PACKET;
private int $entityUniqueId;
private string $photoName;
private string $photoItemName;
public static function create(int $actorUniqueId, string $photoName, string $photoItemName) : self{
$result = new self;
$result->entityUniqueId = $actorUniqueId;
$result->photoName = $photoName;
$result->photoItemName = $photoItemName;
return $result;
}
/**
* TODO: rename this to getEntityUniqueId() on PM4 (shit architecture, thanks shoghi)
*/
public function getEntityUniqueIdField() : int{ return $this->entityUniqueId; }
public function getPhotoName() : string{ return $this->photoName; }
public function getPhotoItemName() : string{ return $this->photoItemName; }
protected function decodePayload() : void{
$this->entityUniqueId = $this->getLLong(); //why be consistent mojang ?????
$this->photoName = $this->getString();
$this->photoItemName = $this->getString();
}
protected function encodePayload() : void{
$this->putLLong($this->entityUniqueId);
$this->putString($this->photoName);
$this->putString($this->photoItemName);
}
public function handle(NetworkSession $handler) : bool{
return $handler->handleCreatePhoto($this);
}
}

View File

@ -0,0 +1,55 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\types\EducationUriResource;
class EduUriResourcePacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::EDU_URI_RESOURCE_PACKET;
private EducationUriResource $resource;
public static function create(EducationUriResource $resource) : self{
$result = new self;
$result->resource = $resource;
return $result;
}
public function getResource() : EducationUriResource{ return $this->resource; }
protected function decodePayload() : void{
$this->resource = EducationUriResource::read($this);
}
protected function encodePayload() : void{
$this->resource->write($this);
}
public function handle(NetworkSession $handler) : bool{
return $handler->handleEduUriResource($this);
}
}

View File

@ -26,6 +26,8 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\types\EducationSettingsAgentCapabilities;
use pocketmine\network\mcpe\protocol\types\EducationSettingsExternalLinkSettings;
class EducationSettingsPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::EDUCATION_SETTINGS_PACKET;
@ -36,18 +38,44 @@ class EducationSettingsPacket extends DataPacket{
private $codeBuilderTitle;
/** @var bool */
private $canResizeCodeBuilder;
/** @var bool */
private $disableLegacyTitleBar;
/** @var string */
private $postProcessFilter;
/** @var string */
private $screenshotBorderResourcePath;
/** @var EducationSettingsAgentCapabilities|null */
private $agentCapabilities;
/** @var string|null */
private $codeBuilderOverrideUri;
/** @var bool */
private $hasQuiz;
/** @var EducationSettingsExternalLinkSettings|null */
private $linkSettings;
public static function create(string $codeBuilderDefaultUri, string $codeBuilderTitle, bool $canResizeCodeBuilder, ?string $codeBuilderOverrideUri, bool $hasQuiz) : self{
public static function create(
string $codeBuilderDefaultUri,
string $codeBuilderTitle,
bool $canResizeCodeBuilder,
bool $disableLegacyTitleBar,
string $postProcessFilter,
string $screenshotBorderResourcePath,
?EducationSettingsAgentCapabilities $agentCapabilities,
?string $codeBuilderOverrideUri,
bool $hasQuiz,
?EducationSettingsExternalLinkSettings $linkSettings
) : self{
$result = new self;
$result->codeBuilderDefaultUri = $codeBuilderDefaultUri;
$result->codeBuilderTitle = $codeBuilderTitle;
$result->canResizeCodeBuilder = $canResizeCodeBuilder;
$result->disableLegacyTitleBar = $disableLegacyTitleBar;
$result->postProcessFilter = $postProcessFilter;
$result->screenshotBorderResourcePath = $screenshotBorderResourcePath;
$result->agentCapabilities = $agentCapabilities;
$result->codeBuilderOverrideUri = $codeBuilderOverrideUri;
$result->hasQuiz = $hasQuiz;
$result->linkSettings = $linkSettings;
return $result;
}
@ -63,6 +91,14 @@ class EducationSettingsPacket extends DataPacket{
return $this->canResizeCodeBuilder;
}
public function disableLegacyTitleBar() : bool{ return $this->disableLegacyTitleBar; }
public function getPostProcessFilter() : string{ return $this->postProcessFilter; }
public function getScreenshotBorderResourcePath() : string{ return $this->screenshotBorderResourcePath; }
public function getAgentCapabilities() : ?EducationSettingsAgentCapabilities{ return $this->agentCapabilities; }
public function getCodeBuilderOverrideUri() : ?string{
return $this->codeBuilderOverrideUri;
}
@ -71,27 +107,51 @@ class EducationSettingsPacket extends DataPacket{
return $this->hasQuiz;
}
public function getLinkSettings() : ?EducationSettingsExternalLinkSettings{ return $this->linkSettings; }
protected function decodePayload() : void{
$this->codeBuilderDefaultUri = $this->getString();
$this->codeBuilderTitle = $this->getString();
$this->canResizeCodeBuilder = $this->getBool();
$this->disableLegacyTitleBar = $this->getBool();
$this->postProcessFilter = $this->getString();
$this->screenshotBorderResourcePath = $this->getString();
$this->agentCapabilities = $this->getBool() ? EducationSettingsAgentCapabilities::read($this) : null;
if($this->getBool()){
$this->codeBuilderOverrideUri = $this->getString();
}else{
$this->codeBuilderOverrideUri = null;
}
$this->hasQuiz = $this->getBool();
$this->linkSettings = $this->getBool() ? EducationSettingsExternalLinkSettings::read($this) : null;
}
protected function encodePayload() : void{
$this->putString($this->codeBuilderDefaultUri);
$this->putString($this->codeBuilderTitle);
$this->putBool($this->canResizeCodeBuilder);
$this->putBool($this->disableLegacyTitleBar);
$this->putString($this->postProcessFilter);
$this->putString($this->screenshotBorderResourcePath);
$agentCapabilities = $this->agentCapabilities;
if($agentCapabilities !== null){
$this->putBool(true);
$agentCapabilities->write($this);
}else{
$this->putBool(false);
}
$this->putBool($this->codeBuilderOverrideUri !== null);
if($this->codeBuilderOverrideUri !== null){
$this->putString($this->codeBuilderOverrideUri);
}
$this->putBool($this->hasQuiz);
$linkSettings = $this->linkSettings;
if($linkSettings !== null){
$this->putBool(true);
$linkSettings->write($this);
}else{
$this->putBool(false);
}
}
public function handle(NetworkSession $handler) : bool{

View File

@ -34,15 +34,19 @@ class HurtArmorPacket extends DataPacket{
public $cause;
/** @var int */
public $health;
/** @var int */
public $armorSlotFlags;
protected function decodePayload(){
$this->cause = $this->getVarInt();
$this->health = $this->getVarInt();
$this->armorSlotFlags = $this->getUnsignedVarLong();
}
protected function encodePayload(){
$this->putVarInt($this->cause);
$this->putVarInt($this->health);
$this->putUnsignedVarLong($this->armorSlotFlags);
}
public function handle(NetworkSession $session) : bool{

View File

@ -200,6 +200,10 @@ class PacketPool{
static::registerPacket(new RemoveVolumeEntityPacket());
static::registerPacket(new SimulationTypePacket());
static::registerPacket(new NpcDialoguePacket());
static::registerPacket(new EduUriResourcePacket());
static::registerPacket(new CreatePhotoPacket());
static::registerPacket(new UpdateSubChunkBlocksPacket());
static::registerPacket(new PhotoInfoRequestPacket());
}
/**

View File

@ -0,0 +1,52 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\NetworkSession;
class PhotoInfoRequestPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::PHOTO_INFO_REQUEST_PACKET;
private int $photoId;
public static function create(int $photoId) : self{
$result = new self;
$result->photoId = $photoId;
return $result;
}
protected function decodePayload() : void{
$this->photoId = $this->getEntityUniqueId();
}
protected function encodePayload() : void{
$this->putEntityUniqueId($this->photoId);
}
public function handle(NetworkSession $handler) : bool{
return $handler->handlePhotoInfoRequest($this);
}
}

View File

@ -36,17 +36,33 @@ class PhotoTransferPacket extends DataPacket{
public $photoData;
/** @var string */
public $bookId; //photos are stored in a sibling directory to the games folder (screenshots/(some UUID)/bookID/example.png)
/** @var int */
public $type;
/** @var int */
public $sourceType;
/** @var int */
public $ownerEntityUniqueId;
/** @var string */
public $newPhotoName; //???
protected function decodePayload(){
$this->photoName = $this->getString();
$this->photoData = $this->getString();
$this->bookId = $this->getString();
$this->type = $this->getByte();
$this->sourceType = $this->getByte();
$this->ownerEntityUniqueId = $this->getLLong(); //...............
$this->newPhotoName = $this->getString();
}
protected function encodePayload(){
$this->putString($this->photoName);
$this->putString($this->photoData);
$this->putString($this->bookId);
$this->putByte($this->type);
$this->putByte($this->sourceType);
$this->putLLong($this->ownerEntityUniqueId);
$this->putString($this->newPhotoName);
}
public function handle(NetworkSession $session) : bool{

View File

@ -37,11 +37,11 @@ interface ProtocolInfo{
*/
/** Actual Minecraft: PE protocol version */
public const CURRENT_PROTOCOL = 448;
public const CURRENT_PROTOCOL = 465;
/** Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */
public const MINECRAFT_VERSION = 'v1.17.10';
public const MINECRAFT_VERSION = 'v1.17.30';
/** Version number sent to clients in ping responses. */
public const MINECRAFT_VERSION_NETWORK = '1.17.10';
public const MINECRAFT_VERSION_NETWORK = '1.17.30';
public const LOGIN_PACKET = 0x01;
public const PLAY_STATUS_PACKET = 0x02;
@ -212,5 +212,9 @@ interface ProtocolInfo{
public const REMOVE_VOLUME_ENTITY_PACKET = 0xa7;
public const SIMULATION_TYPE_PACKET = 0xa8;
public const NPC_DIALOGUE_PACKET = 0xa9;
public const EDU_URI_RESOURCE_PACKET = 0xaa;
public const CREATE_PHOTO_PACKET = 0xab;
public const UPDATE_SUB_CHUNK_BLOCKS_PACKET = 0xac;
public const PHOTO_INFO_REQUEST_PACKET = 0xad;
}

View File

@ -30,6 +30,7 @@ use pocketmine\nbt\NetworkLittleEndianNBTStream;
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\types\BlockPaletteEntry;
use pocketmine\network\mcpe\protocol\types\EducationEditionOffer;
use pocketmine\network\mcpe\protocol\types\EducationUriResource;
use pocketmine\network\mcpe\protocol\types\Experiments;
use pocketmine\network\mcpe\protocol\types\GameRuleType;
use pocketmine\network\mcpe\protocol\types\GeneratorType;
@ -143,6 +144,8 @@ class StartGamePacket extends DataPacket{
public $limitedWorldLength = 0;
/** @var bool */
public $isNewNether = true;
/** @var EducationUriResource|null */
public $eduSharedUriResource = null;
/** @var bool|null */
public $experimentalGameplayOverride = null;
@ -227,6 +230,7 @@ class StartGamePacket extends DataPacket{
$this->limitedWorldWidth = $this->getLInt();
$this->limitedWorldLength = $this->getLInt();
$this->isNewNether = $this->getBool();
$this->eduSharedUriResource = EducationUriResource::read($this);
if($this->getBool()){
$this->experimentalGameplayOverride = $this->getBool();
}else{
@ -311,6 +315,7 @@ class StartGamePacket extends DataPacket{
$this->putLInt($this->limitedWorldWidth);
$this->putLInt($this->limitedWorldLength);
$this->putBool($this->isNewNether);
($this->eduSharedUriResource ?? new EducationUriResource("", ""))->write($this);
$this->putBool($this->experimentalGameplayOverride !== null);
if($this->experimentalGameplayOverride !== null){
$this->putBool($this->experimentalGameplayOverride);

View File

@ -0,0 +1,97 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\types\UpdateSubChunkBlocksPacketEntry;
use function count;
class UpdateSubChunkBlocksPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::UPDATE_SUB_CHUNK_BLOCKS_PACKET;
private int $subChunkX;
private int $subChunkY;
private int $subChunkZ;
/** @var UpdateSubChunkBlocksPacketEntry[] */
private array $layer0Updates;
/** @var UpdateSubChunkBlocksPacketEntry[] */
private array $layer1Updates;
/**
* @param UpdateSubChunkBlocksPacketEntry[] $layer0
* @param UpdateSubChunkBlocksPacketEntry[] $layer1
*/
public static function create(int $subChunkX, int $subChunkY, int $subChunkZ, array $layer0, array $layer1) : self{
$result = new self;
$result->subChunkX = $subChunkX;
$result->subChunkY = $subChunkY;
$result->subChunkZ = $subChunkZ;
$result->layer0Updates = $layer0;
$result->layer1Updates = $layer1;
return $result;
}
public function getSubChunkX() : int{ return $this->subChunkX; }
public function getSubChunkY() : int{ return $this->subChunkY; }
public function getSubChunkZ() : int{ return $this->subChunkZ; }
/** @return UpdateSubChunkBlocksPacketEntry[] */
public function getLayer0Updates() : array{ return $this->layer0Updates; }
/** @return UpdateSubChunkBlocksPacketEntry[] */
public function getLayer1Updates() : array{ return $this->layer1Updates; }
protected function decodePayload() : void{
$this->subChunkX = $this->subChunkY = $this->subChunkZ = 0;
$this->getBlockPosition($this->subChunkX, $this->subChunkY, $this->subChunkZ);
$this->layer0Updates = [];
for($i = 0, $count = $this->getUnsignedVarInt(); $i < $count; ++$i){
$this->layer0Updates[] = UpdateSubChunkBlocksPacketEntry::read($this);
}
for($i = 0, $count = $this->getUnsignedVarInt(); $i < $count; ++$i){
$this->layer1Updates[] = UpdateSubChunkBlocksPacketEntry::read($this);
}
}
protected function encodePayload() : void{
$this->putBlockPosition($this->subChunkX, $this->subChunkY, $this->subChunkZ);
$this->putUnsignedVarInt(count($this->layer0Updates));
foreach($this->layer0Updates as $update){
$update->write($this);
}
$this->putUnsignedVarInt(count($this->layer1Updates));
foreach($this->layer1Updates as $update){
$update->write($this);
}
}
public function handle(NetworkSession $handler) : bool{
return $handler->handleUpdateSubChunkBlocks($this);
}
}

View File

@ -0,0 +1,51 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol\types;
use pocketmine\network\mcpe\NetworkBinaryStream;
final class EducationSettingsAgentCapabilities{
private ?bool $canModifyBlocks;
public function __construct(?bool $canModifyBlocks){
$this->canModifyBlocks = $canModifyBlocks;
}
public function getCanModifyBlocks() : ?bool{ return $this->canModifyBlocks; }
public static function read(NetworkBinaryStream $in) : self{
$canModifyBlocks = $in->getBool() ? $in->getBool() : null;
return new self($canModifyBlocks);
}
public function write(NetworkBinaryStream $out) : void{
if($this->canModifyBlocks !== null){
$out->putBool(true);
$out->putBool($this->canModifyBlocks);
}else{
$out->putBool(false);
}
}
}

View File

@ -0,0 +1,52 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol\types;
use pocketmine\network\mcpe\NetworkBinaryStream;
final class EducationSettingsExternalLinkSettings{
private string $displayName;
private string $url;
public function __construct(string $url, string $displayName){
$this->displayName = $displayName;
$this->url = $url;
}
public function getUrl() : string{ return $this->url; }
public function getDisplayName() : string{ return $this->displayName; }
public static function read(NetworkBinaryStream $in) : self{
$url = $in->getString();
$displayName = $in->getString();
return new self($displayName, $url);
}
public function write(NetworkBinaryStream $out) : void{
$out->putString($this->url);
$out->putString($this->displayName);
}
}

View File

@ -0,0 +1,51 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol\types;
use pocketmine\network\mcpe\NetworkBinaryStream;
final class EducationUriResource{
private string $buttonName;
private string $linkUri;
public function __construct(string $buttonName, string $linkUri){
$this->buttonName = $buttonName;
$this->linkUri = $linkUri;
}
public function getButtonName() : string{ return $this->buttonName; }
public function getLinkUri() : string{ return $this->linkUri; }
public static function read(NetworkBinaryStream $in) : self{
$buttonName = $in->getString();
$linkUri = $in->getString();
return new self($buttonName, $linkUri);
}
public function write(NetworkBinaryStream $out) : void{
$out->putString($this->buttonName);
$out->putString($this->linkUri);
}
}

View File

@ -0,0 +1,52 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol\types;
final class MaterialReducerRecipe{
private int $inputItemId;
private int $inputItemMeta;
/**
* @var MaterialReducerRecipeOutput[]
* @phpstan-var list<MaterialReducerRecipeOutput>
*/
private array $outputs;
/**
* @param MaterialReducerRecipeOutput[] $outputs
* @phpstan-param list<MaterialReducerRecipeOutput> $outputs
*/
public function __construct(int $inputItemId, int $inputItemMeta, array $outputs){
$this->inputItemId = $inputItemId;
$this->inputItemMeta = $inputItemMeta;
$this->outputs = $outputs;
}
public function getInputItemId() : int{ return $this->inputItemId; }
public function getInputItemMeta() : int{ return $this->inputItemMeta; }
/** @return MaterialReducerRecipeOutput[] */
public function getOutputs() : array{ return $this->outputs; }
}

View File

@ -0,0 +1,39 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol\types;
final class MaterialReducerRecipeOutput{
private int $itemId;
private int $count;
public function __construct(int $itemId, int $count){
$this->itemId = $itemId;
$this->count = $count;
}
public function getItemId() : int{ return $this->itemId; }
public function getCount() : int{ return $this->count; }
}

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol\types;
use pocketmine\network\mcpe\protocol\ProtocolInfo;
use pocketmine\utils\UUID;
class SkinData{
@ -44,14 +45,9 @@ class SkinData{
private $capeImage;
/** @var string */
private $geometryData;
private string $geometryDataEngineVersion;
/** @var string */
private $animationData;
/** @var bool */
private $persona;
/** @var bool */
private $premium;
/** @var bool */
private $personaCapeOnClassic;
/** @var string */
private $capeId;
/** @var string */
@ -66,13 +62,21 @@ class SkinData{
private $pieceTintColors;
/** @var bool */
private $isVerified;
/** @var bool */
private $persona;
/** @var bool */
private $premium;
/** @var bool */
private $personaCapeOnClassic;
/** @var bool */
private $isPrimaryUser;
/**
* @param SkinAnimation[] $animations
* @param PersonaSkinPiece[] $personaPieces
* @param PersonaPieceTintColor[] $pieceTintColors
*/
public function __construct(string $skinId, string $playFabId, string $resourcePatch, SkinImage $skinImage, array $animations = [], SkinImage $capeImage = null, string $geometryData = "", string $animationData = "", bool $premium = false, bool $persona = false, bool $personaCapeOnClassic = false, string $capeId = "", ?string $fullSkinId = null, string $armSize = self::ARM_SIZE_WIDE, string $skinColor = "", array $personaPieces = [], array $pieceTintColors = [], bool $isVerified = true){
public function __construct(string $skinId, string $playFabId, string $resourcePatch, SkinImage $skinImage, array $animations = [], SkinImage $capeImage = null, string $geometryData = "", string $geometryDataEngineVersion = ProtocolInfo::MINECRAFT_VERSION_NETWORK, string $animationData = "", string $capeId = "", ?string $fullSkinId = null, string $armSize = self::ARM_SIZE_WIDE, string $skinColor = "", array $personaPieces = [], array $pieceTintColors = [], bool $isVerified = true, bool $premium = false, bool $persona = false, bool $personaCapeOnClassic = false, bool $isPrimaryUser = true){
$this->skinId = $skinId;
$this->playFabId = $playFabId;
$this->resourcePatch = $resourcePatch;
@ -80,10 +84,8 @@ class SkinData{
$this->animations = $animations;
$this->capeImage = $capeImage ?? new SkinImage(0, 0, "");
$this->geometryData = $geometryData;
$this->geometryDataEngineVersion = $geometryDataEngineVersion;
$this->animationData = $animationData;
$this->premium = $premium;
$this->persona = $persona;
$this->personaCapeOnClassic = $personaCapeOnClassic;
$this->capeId = $capeId;
//this has to be unique or the client will do stupid things
$this->fullSkinId = $fullSkinId ?? UUID::fromRandom()->toString();
@ -92,6 +94,10 @@ class SkinData{
$this->personaPieces = $personaPieces;
$this->pieceTintColors = $pieceTintColors;
$this->isVerified = $isVerified;
$this->premium = $premium;
$this->persona = $persona;
$this->personaCapeOnClassic = $personaCapeOnClassic;
$this->isPrimaryUser = $isPrimaryUser;
}
public function getSkinId() : string{
@ -123,22 +129,12 @@ class SkinData{
return $this->geometryData;
}
public function getGeometryDataEngineVersion() : string{ return $this->geometryDataEngineVersion; }
public function getAnimationData() : string{
return $this->animationData;
}
public function isPersona() : bool{
return $this->persona;
}
public function isPremium() : bool{
return $this->premium;
}
public function isPersonaCapeOnClassic() : bool{
return $this->personaCapeOnClassic;
}
public function getCapeId() : string{
return $this->capeId;
}
@ -169,6 +165,20 @@ class SkinData{
return $this->pieceTintColors;
}
public function isPersona() : bool{
return $this->persona;
}
public function isPremium() : bool{
return $this->premium;
}
public function isPersonaCapeOnClassic() : bool{
return $this->personaCapeOnClassic;
}
public function isPrimaryUser() : bool{ return $this->isPrimaryUser; }
public function isVerified() : bool{
return $this->isVerified;
}

View File

@ -0,0 +1,88 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol\types;
use pocketmine\network\mcpe\NetworkBinaryStream;
use pocketmine\network\mcpe\protocol\UpdateBlockPacket;
final class UpdateSubChunkBlocksPacketEntry{
private int $x;
private int $y;
private int $z;
private int $blockRuntimeId;
private int $flags;
//These two fields are useless 99.9% of the time; they are here to allow this packet to provide UpdateBlockSyncedPacket functionality.
private int $syncedUpdateEntityUniqueId;
private int $syncedUpdateType;
public function __construct(int $x, int $y, int $z, int $blockRuntimeId, int $flags, int $syncedUpdateEntityUniqueId, int $syncedUpdateType){
$this->x = $x;
$this->y = $y;
$this->z = $z;
$this->blockRuntimeId = $blockRuntimeId;
$this->flags = $flags;
$this->syncedUpdateEntityUniqueId = $syncedUpdateEntityUniqueId;
$this->syncedUpdateType = $syncedUpdateType;
}
public static function simple(int $x, int $y, int $z, int $blockRuntimeId) : self{
return new self($x, $y, $z, $blockRuntimeId, UpdateBlockPacket::FLAG_NETWORK, 0, 0);
}
public function getX() : int{ return $this->x; }
public function getY() : int{ return $this->y; }
public function getZ() : int{ return $this->z; }
public function getBlockRuntimeId() : int{ return $this->blockRuntimeId; }
public function getFlags() : int{ return $this->flags; }
public function getSyncedUpdateEntityUniqueId() : int{ return $this->syncedUpdateEntityUniqueId; }
public function getSyncedUpdateType() : int{ return $this->syncedUpdateType; }
public static function read(NetworkBinaryStream $in) : self{
$x = $y = $z = 0;
$in->getBlockPosition($x, $y, $z);
$blockRuntimeId = $in->getUnsignedVarInt();
$updateFlags = $in->getUnsignedVarInt();
$syncedUpdateEntityUniqueId = $in->getUnsignedVarLong(); //this can't use the standard method because it's unsigned as opposed to the usual signed... !!!!!!
$syncedUpdateType = $in->getUnsignedVarInt(); //this isn't even consistent with UpdateBlockSyncedPacket?!
return new self($x, $y, $z, $blockRuntimeId, $updateFlags, $syncedUpdateEntityUniqueId, $syncedUpdateType);
}
public function write(NetworkBinaryStream $out) : void{
$out->putBlockPosition($this->x, $this->y, $this->z);
$out->putUnsignedVarInt($this->blockRuntimeId);
$out->putUnsignedVarInt($this->flags);
$out->putUnsignedVarLong($this->syncedUpdateEntityUniqueId);
$out->putUnsignedVarInt($this->syncedUpdateType);
}
}

View File

@ -57,24 +57,15 @@ use const SOL_TCP;
class RCON{
/** @var Server */
private $server;
/**
* @var \Socket|resource
* @phpstan-var PhpSocket
*/
/** @var \Socket */
private $socket;
/** @var RCONInstance */
private $instance;
/**
* @var \Socket|resource
* @phpstan-var PhpSocket
*/
/** @var \Socket */
private $ipcMainSocket;
/**
* @var resource
* @phpstan-var PhpSocket
*/
/** @var \Socket */
private $ipcThreadSocket;
public function __construct(Server $server, string $password, int $port = 19132, string $interface = "0.0.0.0", int $maxClients = 50){

View File

@ -60,10 +60,7 @@ class RCONInstance extends Thread{
/** @var bool */
private $stop;
/**
* @var \Socket|resource
* @phpstan-var PhpSocket
*/
/** @var \Socket */
private $socket;
/** @var string */
private $password;
@ -71,21 +68,12 @@ class RCONInstance extends Thread{
private $maxClients;
/** @var \ThreadedLogger */
private $logger;
/**
* @var \Socket|resource
* @phpstan-var PhpSocket
*/
/** @var \Socket */
private $ipcSocket;
/** @var SleeperNotifier|null */
private $notifier;
/**
* @param \Socket|resource $socket
* @param \Socket|resource $ipcSocket
* @phpstan-param PhpSocket $socket
* @phpstan-param PhpSocket $ipcSocket
*/
public function __construct($socket, string $password, int $maxClients, \ThreadedLogger $logger, $ipcSocket, ?SleeperNotifier $notifier){
public function __construct(\Socket $socket, string $password, int $maxClients, \ThreadedLogger $logger, \Socket $ipcSocket, ?SleeperNotifier $notifier){
$this->stop = false;
$this->cmd = "";
$this->response = "";
@ -100,12 +88,9 @@ class RCONInstance extends Thread{
}
/**
* @param \Socket|resource $client
* @phpstan-param PhpSocket $client
*
* @return int|false
*/
private function writePacket($client, int $requestID, int $packetType, string $payload){
private function writePacket(\Socket $client, int $requestID, int $packetType, string $payload){
$pk = Binary::writeLInt($requestID)
. Binary::writeLInt($packetType)
. $payload
@ -114,15 +99,13 @@ class RCONInstance extends Thread{
}
/**
* @param \Socket|resource $client
* @param int $requestID reference parameter
* @param int $packetType reference parameter
* @param string $payload reference parameter
* @phpstan-param PhpSocket $client
*
* @return bool
*/
private function readPacket($client, ?int &$requestID, ?int &$packetType, ?string &$payload){
private function readPacket(\Socket $client, ?int &$requestID, ?int &$packetType, ?string &$payload){
$d = @socket_read($client, 4);
socket_getpeername($client, $ip, $port);
@ -176,8 +159,8 @@ class RCONInstance extends Thread{
$this->registerClassLoader();
/**
* @var \Socket[]|resource[] $clients
* @phpstan-var array<int, PhpSocket> $clients
* @var \Socket[] $clients
* @phpstan-var array<int, \Socket> $clients
*/
$clients = [];
/** @var bool[] $authenticated */
@ -277,11 +260,7 @@ class RCONInstance extends Thread{
}
}
/**
* @param \Socket|resource $client
* @phpstan-param PhpSocket $client
*/
private function disconnectClient($client) : void{
private function disconnectClient(\Socket $client) : void{
socket_getpeername($client, $ip, $port);
@socket_set_option($client, SOL_SOCKET, SO_LINGER, ["l_onoff" => 1, "l_linger" => 1]);
@socket_shutdown($client, 2);

View File

@ -31,6 +31,7 @@ use function curl_getinfo;
use function curl_init;
use function curl_setopt_array;
use function explode;
use function is_int;
use function is_string;
use function preg_match;
use function socket_close;
@ -196,7 +197,7 @@ class Internet{
* @param callable|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle.
* @phpstan-param array<int, mixed> $extraOpts
* @phpstan-param list<string> $extraHeaders
* @phpstan-param (callable(PhpCurlHandle) : void)|null $onSuccess
* @phpstan-param (callable(\CurlHandle) : void)|null $onSuccess
*
* @return array a plain array of three [result body : string, headers : string[][], HTTP response code : int]. Headers are grouped by requests with strtolower(header name) as keys and header value as values
* @phpstan-return array{string, list<array<string, string>>, int}
@ -233,6 +234,7 @@ class Internet{
}
if(!is_string($raw)) throw new AssumptionFailedError("curl_exec() should return string|false when CURLOPT_RETURNTRANSFER is set");
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if(!is_int($httpCode)) throw new AssumptionFailedError("curl_getinfo(CURLINFO_HTTP_CODE) always returns int");
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$rawHeaders = substr($raw, 0, $headerSize);
$body = substr($raw, $headerSize);

View File

@ -201,9 +201,6 @@ abstract class Timezone{
}
$parsed = date_parse($offset);
if($parsed === false){
return false;
}
$offset = $parsed['hour'] * 3600 + $parsed['minute'] * 60 + $parsed['second'];
//After date_parse is done, put the sign back

View File

@ -454,7 +454,7 @@ class Utils{
* @param callable|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle.
* @phpstan-param array<int, mixed> $extraOpts
* @phpstan-param list<string> $extraHeaders
* @phpstan-param (callable(PhpCurlHandle) : void)|null $onSuccess
* @phpstan-param (callable(\CurlHandle) : void)|null $onSuccess
*
* @return array a plain array of three [result body : string, headers : string[][], HTTP response code : int]. Headers are grouped by requests with strtolower(header name) as keys and header value as values
* @phpstan-return array{string, list<array<string, string>>, int}
@ -642,7 +642,6 @@ class Utils{
preg_match_all('/(*ANYCRLF)^[\t ]*(?:\* )?@([a-zA-Z]+)(?:[\t ]+(.+?))?[\t ]*$/m', $rawDocComment, $matches);
$result = array_combine($matches[1], $matches[2]);
if($result === false) throw new AssumptionFailedError("array_combine() doesn't return false with two equal-sized arrays");
return $result;
}

View File

@ -17,7 +17,7 @@ INSTALL_DIR="$(pwd)/bin/php7"
export CFLAGS="$CFLAGS -march=x86-64"
export CXXFLAGS="$CXXFLAGS -march=x86-64"
git clone https://github.com/php-build/php-build.git
git clone https://github.com/pmmp/php-build.git
cd php-build
./install-dependencies.sh
echo '"pthreads",,"https://github.com/pmmp/pthreads.git",,,"extension",' >> share/php-build/extension/definition

View File

@ -42,7 +42,7 @@ parameters:
-
message: "#^Parameter \\#1 \\$string of function base64_decode expects string, mixed given\\.$#"
count: 5
count: 6
path: ../../../src/pocketmine/Player.php
-
@ -51,27 +51,32 @@ parameters:
path: ../../../src/pocketmine/Player.php
-
message: "#^Parameter \\#10 \\$persona of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects bool, mixed given\\.$#"
message: "#^Parameter \\#10 \\$capeId of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects string, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/Player.php
-
message: "#^Parameter \\#11 \\$personaCapeOnClassic of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects bool, mixed given\\.$#"
message: "#^Parameter \\#12 \\$armSize of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects string, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/Player.php
-
message: "#^Parameter \\#12 \\$capeId of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects string, mixed given\\.$#"
message: "#^Parameter \\#13 \\$skinColor of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects string, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/Player.php
-
message: "#^Parameter \\#14 \\$armSize of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects string, mixed given\\.$#"
message: "#^Parameter \\#17 \\$premium of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects bool, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/Player.php
-
message: "#^Parameter \\#15 \\$skinColor of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects string, mixed given\\.$#"
message: "#^Parameter \\#18 \\$persona of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects bool, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/Player.php
-
message: "#^Parameter \\#19 \\$personaCapeOnClassic of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects bool, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/Player.php
@ -85,11 +90,6 @@ parameters:
count: 2
path: ../../../src/pocketmine/Player.php
-
message: "#^Parameter \\#9 \\$premium of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects bool, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/Player.php
-
message: "#^Cannot access offset 'git' on mixed\\.$#"
count: 2

View File

@ -41,7 +41,12 @@ parameters:
path: ../../../src/pocketmine/Player.php
-
message: "#^Parameter \\#8 \\$animationData of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects string, string\\|false given\\.$#"
message: "#^Parameter \\#8 \\$geometryDataEngineVersion of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects string, string\\|false given\\.$#"
count: 1
path: ../../../src/pocketmine/Player.php
-
message: "#^Parameter \\#9 \\$animationData of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects string, string\\|false given\\.$#"
count: 1
path: ../../../src/pocketmine/Player.php
@ -70,11 +75,6 @@ parameters:
count: 2
path: ../../../src/pocketmine/PocketMine.php
-
message: "#^Cannot cast array\\<int, mixed\\>\\|string\\|false to int\\.$#"
count: 1
path: ../../../src/pocketmine/Server.php
-
message: "#^Cannot cast array\\<int, mixed\\>\\|string\\|false to string\\.$#"
count: 1

View File

@ -260,11 +260,6 @@ parameters:
count: 1
path: ../../../src/pocketmine/block/BaseRail.php
-
message: "#^Parameter \\#1 \\$constraint of method pocketmine\\\\block\\\\BaseRail\\:\\:getPossibleConnectionDirectionsOneConstraint\\(\\) expects int, int\\|null given\\.$#"
count: 1
path: ../../../src/pocketmine/block/BaseRail.php
-
message: "#^Only numeric types are allowed in \\-, int\\|null given on the left side\\.$#"
count: 1

View File

@ -1,112 +0,0 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#"
count: 1
path: ../../../src/pocketmine/MemoryManager.php
-
message: "#^Parameter \\#1 \\$fp of function fwrite expects resource, resource\\|false given\\.$#"
count: 1
path: ../../../src/pocketmine/MemoryManager.php
-
message: "#^Parameter \\#1 \\$str of function base64_decode expects string, mixed given\\.$#"
count: 5
path: ../../../src/pocketmine/Player.php
-
message: "#^Parameter \\#1 \\$input of function array_filter expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: ../../../src/pocketmine/Server.php
-
message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/Server.php
-
message: "#^Parameter \\#1 \\$number of function round expects float, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/command/defaults/StatusCommand.php
-
message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#"
count: 2
path: ../../../src/pocketmine/command/defaults/TimingsCommand.php
-
message: "#^Parameter \\#1 \\$fp of function fseek expects resource, resource\\|false given\\.$#"
count: 1
path: ../../../src/pocketmine/command/defaults/TimingsCommand.php
-
message: "#^Parameter \\#1 \\$source of function stream_get_contents expects resource, resource\\|false given\\.$#"
count: 1
path: ../../../src/pocketmine/command/defaults/TimingsCommand.php
-
message: "#^Parameter \\#1 \\$argument of class ReflectionClass constructor expects class\\-string\\<T of object\\>\\|T of object, string given\\.$#"
count: 1
path: ../../../src/pocketmine/event/HandlerList.php
-
message: "#^Parameter \\#2 \\$input1 of function array_map expects array, array\\|false given\\.$#"
count: 1
path: ../../../src/pocketmine/lang/BaseLang.php
-
message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/level/format/io/leveldb/LevelDB.php
-
message: "#^Parameter \\#1 \\$input of function array_filter expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: ../../../src/pocketmine/level/format/io/region/McRegion.php
-
message: "#^Parameter \\#1 \\$str of function str_split expects string, string\\|false given\\.$#"
count: 1
path: ../../../src/pocketmine/network/mcpe/VerifyLoginTask.php
-
message: "#^Parameter \\#1 \\$str of function mb_strtoupper expects string, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/plugin/PluginDescription.php
-
message: "#^Parameter \\#1 \\$variable_representation of function unserialize expects string, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/scheduler/AsyncTask.php
-
message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/updater/AutoUpdater.php
-
message: "#^Parameter \\#2 \\$timestamp of function date expects int, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/updater/AutoUpdater.php
-
message: "#^Parameter \\#2 \\$start of function substr expects int, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/utils/Internet.php
-
message: "#^Parameter \\#3 \\$length of function substr expects int, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/utils/Internet.php
-
message: "#^Parameter \\#2 \\$input1 of function array_map expects array, mixed given\\.$#"
count: 1
path: ../../../src/pocketmine/utils/Utils.php
-
message: "#^Method ReflectionMethod\\:\\:getClosure\\(\\) invoked with 0 parameters, 1 required\\.$#"
count: 1
path: ../../phpunit/network/mcpe/StupidJsonDecodeTest.php

View File

@ -1,11 +0,0 @@
parameters:
ignoreErrors:
-
message: "#^Strict comparison using \\=\\=\\= between array\\<string, mixed\\> and false will always evaluate to false\\.$#"
count: 1
path: ../../../src/pocketmine/utils/Timezone.php
-
message: "#^Strict comparison using \\=\\=\\= between array and false will always evaluate to false\\.$#"
count: 1
path: ../../../src/pocketmine/utils/Utils.php

View File

@ -1,15 +1,60 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(pocketmine\\\\Player\\)\\: bool given\\.$#"
count: 1
path: ../../../src/pocketmine/Server.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(string\\)\\: bool given\\.$#"
count: 1
path: ../../../src/pocketmine/Server.php
-
message: "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#"
count: 3
path: ../../../src/pocketmine/command/CommandReader.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(pocketmine\\\\Player\\)\\: bool given\\.$#"
count: 1
path: ../../../src/pocketmine/command/defaults/ListCommand.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(pocketmine\\\\entity\\\\Attribute\\)\\: bool given\\.$#"
count: 1
path: ../../../src/pocketmine/entity/AttributeMap.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(pocketmine\\\\item\\\\Item\\)\\: bool given\\.$#"
count: 1
path: ../../../src/pocketmine/entity/Human.php
-
message: "#^Call to function assert\\(\\) with false and 'unknown hit type' will always evaluate to false\\.$#"
count: 1
path: ../../../src/pocketmine/entity/projectile/Projectile.php
-
message: "#^Parameter \\#2 \\$callback of function usort expects callable\\(mixed, mixed\\)\\: int, array\\('pocketmine\\\\\\\\inventory\\\\\\\\CraftingManager', 'sort'\\) given\\.$#"
count: 1
path: ../../../src/pocketmine/inventory/CraftingManager.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(string\\)\\: bool given\\.$#"
count: 1
path: ../../../src/pocketmine/lang/BaseLang.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(pocketmine\\\\entity\\\\Entity\\)\\: bool given\\.$#"
count: 1
path: ../../../src/pocketmine/level/format/Chunk.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(string\\)\\: bool given\\.$#"
count: 1
path: ../../../src/pocketmine/level/format/io/region/McRegion.php
-
message: "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#"
count: 2
@ -25,11 +70,6 @@ parameters:
count: 1
path: ../../../src/pocketmine/network/mcpe/protocol/DataPacket.php
-
message: "#^Parameter \\#1 \\$ of closure expects TMemberType, TMemberType given\\.$#"
count: 1
path: ../../../src/pocketmine/utils/Utils.php
-
message: "#^Strict comparison using \\=\\=\\= between string and false will always evaluate to false\\.$#"
count: 1