Compare commits

..

89 Commits

Author SHA1 Message Date
9b6b3f50a1 Release 3.12.2 2020-05-18 10:17:02 +01:00
1fb0ba6fc0 travis: update PHP extension versions 2020-05-18 09:47:56 +01:00
f1d378468e updated build/php submodule to pmmp/php-build-scripts@a6ab41089e 2020-05-18 09:44:43 +01:00
25fb5140a2 Merge #3456: Added protocol DeviceOS constants
close #3456

since this is a protocol addition and not API, this belongs on stable so
that protocol changes can consistently use it without worrying about
branch compatibility.
2020-05-17 09:57:39 +01:00
f5a49b6d55 LightUpdate: improve quality of property type info 2020-05-17 09:33:18 +01:00
189f12a644 PermissionManager: fix timings not being stopped for default calculation (#3502) 2020-05-17 08:55:11 +01:00
5a8917f6f2 TaskScheduler: queue contains TaskHandler, not Task 2020-05-16 15:27:20 +01:00
f3e436592a ZippedResourcePack: detect location of manifest.json if it's not in the root
this isn't quite as bulletproof as I'd like it to be, but it should work...
2020-05-15 19:41:45 +01:00
35747874f6 Cocoa: fix drops, closes #3326
this doesn't really do a whole lot, but I want this issue off my tracker, it's worthless...
2020-05-14 00:56:39 +01:00
59445902b8 Entity: do not spawn to players who haven't received the target chunk yet, closes #3355
this might cause some delays on chunk resend as documented on master, but entities all get respawned on a resend, so this doesn't matter much. It's better than whatever side effects might come with spawning an entity in a chunk that the player doesn't have yet.
2020-05-14 00:46:54 +01:00
2eb62c85f6 Server: cast network.compression-level to int, closes #3393 2020-05-14 00:37:54 +01:00
ad2a39bf13 Merge #3489: fix spawn protection check for placement checking the wrong block, close #3488, close #3489 2020-05-14 00:30:11 +01:00
0847358070 SkinImage: fix inverted auto-detect height/width, closes #3490
it seems like the client doesn't care if the h/w are inverted for skins anyway, but this is still wrong anyway...
2020-05-14 00:22:12 +01:00
54f41dc145 3.12.2 is next 2020-05-13 13:10:25 +01:00
ded45bddfe Release 3.12.1 2020-05-13 13:10:10 +01:00
b044550475 Player: duct tape for yet another login sequence bug in the shitty net architecture 2020-05-13 12:59:43 +01:00
a70fa15690 phpstan 0.12.25, drop some bug-filtering error patterns 2020-05-13 12:51:52 +01:00
bd1d7b8d75 asserts 👏 are 👏 not 👏 error 👏 checking 2020-05-13 12:39:55 +01:00
1513a0e092 VerifyLoginTask: beware wrong number of parts when splitting JWT 2020-05-13 12:39:53 +01:00
c4150d4520 Bump phpstan/phpstan from 0.12.23 to 0.12.25 (#3486) 2020-05-11 20:19:30 +00:00
2f47597d75 BaseLevelProvider: stop crashing the server on invalid level.dat
broken userdata isn't a core bug, so it shouldn't be flooding our crash archives.
2020-05-11 15:34:53 +01:00
ef97c8f99e Utils: fix parsing of single-line doc comments, closes #3388 (#3469)
* Utils: fix parsing of single-line doc comments, closes #3388

* correctly handle the empty doc-comment case, add another test case

* ignore an extra phpstan bug
2020-05-06 14:17:08 +01:00
84932ce908 Bump phpstan/phpstan from 0.12.22 to 0.12.23 (#3468) 2020-05-05 15:59:22 +00:00
6bfc309a0a phpstan 0.12.22 2020-05-04 22:26:44 +01:00
06e8c6a3ad Entity: new data flags 2020-05-04 21:58:44 +01:00
71271a0e03 Use env to locate bash (#3439)
This change uses env to locate bash, instead of hard-coding it. This is necessary on FreeBSD. Tested on Linux as well.
2020-04-30 17:34:13 +01:00
b63ad032a9 phpstan 0.12.19 2020-04-26 00:08:41 +01:00
d9b0e373bb Populator: fix return type of populate() 2020-04-26 00:04:17 +01:00
32262d9bb5 Merge branch 'stable' of https://github.com/pmmp/pocketmine-mp into stable 2020-04-25 11:59:35 +01:00
4c1b10b24b restructure ignoreErrors to allow regenerating them file by file 2020-04-25 11:59:06 +01:00
61dc9d7f6b phpstan: split up phpstan-bugs and phpstan-bugs-generated configs 2020-04-25 11:26:54 +01:00
da9731ef59 phpstan: add stub defines to improve analysis 2020-04-25 11:07:05 +01:00
e6f64c609e bootstrap: avoid making COMPOSER_AUTOLOADER_PATH having a possible false type 2020-04-25 11:04:09 +01:00
8c7fbf379b Bump irstea/phpunit-shim from 8.5.3 to 8.5.4 (#3435) 2020-04-24 20:45:43 +00:00
34a3e0d8b1 Level: fix sneaking use-item logic (thanks @95CivicSi)
inspired by, but closes #3403
fixes #3401
fixes #2539
fixes #1904
2020-04-19 15:38:12 +01:00
d42217ff57 Bump phpstan/phpstan-phpunit from 0.12.6 to 0.12.8 (#3421) 2020-04-19 14:26:22 +00:00
39d02a67d2 3.12.1 is next 2020-04-17 18:39:20 +01:00
77d45bf116 Release 3.12.0 2020-04-17 18:39:15 +01:00
f79182852b Fixed typo in login handler (wrong variable to store persona pieces) (#3422) 2020-04-17 14:36:51 +01:00
a107ad7404 1.14.60 support (#3407) 2020-04-17 09:18:00 +01:00
7a072931df Merge branch 'stable' of https://github.com/pmmp/pocketmine-mp into stable 2020-04-17 01:58:26 +01:00
f428a9bf52 protocol: rename some useless fields 2020-04-17 01:58:06 +01:00
2e720b48d9 AnimatePacket: added a new constant 2020-04-17 01:57:20 +01:00
a6e79bedf5 ActorEventPacket: plug some gaps 2020-04-17 01:56:56 +01:00
a5ba570fdf StructureBlockUpdatePacket: Added encode/decode (#3148) 2020-04-17 01:11:16 +01:00
0d5164af02 LabTablePacket: updated type field and added constants 2020-04-16 22:03:36 +01:00
534af770f8 InteractPacket: new constant 2020-04-16 22:03:34 +01:00
79ed377c7a Bump pocketmine/nbt from 0.2.13 to 0.2.14 (#3406)
Bumps [pocketmine/nbt](https://github.com/pmmp/NBT) from 0.2.13 to 0.2.14.
- [Release notes](https://github.com/pmmp/NBT/releases)
- [Commits](https://github.com/pmmp/NBT/compare/0.2.13...0.2.14)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-15 13:45:52 +01:00
20f3030709 3.11.8 is next 2020-04-14 02:54:41 +01:00
3aa58f54dc Release 3.11.7 2020-04-14 02:54:40 +01:00
5c12a95151 phpstan: force static reflection for COM class
com_dotnet has crap reflection exports and the class name case doesn't match.
2020-04-14 01:43:02 +01:00
5f07c5df1c Bump irstea/phpunit-shim from 8.5.2 to 8.5.3 (#3384) 2020-04-12 03:40:14 +00:00
5f33ef35e3 build: allow providing a git hash 2020-04-09 21:13:54 +01:00
ec949840b2 Do not crash on failure to decompress region chunks
this could happen when a chunk was partially overwritten with one of the same sector size.
2020-04-01 21:30:25 +01:00
e45e84b236 Updated composer dependencies 2020-03-31 18:43:30 +01:00
dfe68c9788 Bump phpstan/phpstan from 0.12.17 to 0.12.18 (#3372)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.17 to 0.12.18.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.17...0.12.18)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-23 15:21:00 +00:00
35b8f0bf25 Bump phpstan/phpstan from 0.12.15 to 0.12.17 (#3363) 2020-03-18 13:06:14 +00:00
d4dc1c8a0c AttributeMap: be aware of possible NULL offset in ArrayAccess
reported by phpstan 0.12.17
2020-03-18 12:59:01 +00:00
517f9a3c3a Player: fix weapons not taking damage from attacks (bug introduced by #3348) 2020-03-18 12:51:05 +00:00
636c35dcf1 replace daverandom/callback-validator with pocketmine/callback-validator, closes #3359 2020-03-17 12:24:50 +00:00
d22f0da1de Bump phpstan/phpstan from 0.12.14 to 0.12.15 (#3362) 2020-03-17 12:20:55 +00:00
310de5a2b2 RCON: set SO_REUSEADDR to fix RCON start failure after restart (#3357) 2020-03-16 12:00:45 +00:00
f84abcd1fe sync composer.lock with 0dd68e587f 2020-03-14 13:36:35 +00:00
b5dd147ec7 PlayerQuitEvent: fix types of quitMessage 2020-03-14 13:24:40 +00:00
0dd68e587f require phpstan ^0.12.14 (for incremental analysis) 2020-03-13 16:30:35 +00:00
330e93e5e3 Player: do not handle inbound ActorEvents that are not for self 2020-03-13 15:15:20 +00:00
2020fcd18e updated build/php submodule 2020-03-12 11:47:15 +00:00
456d9a722a reduce some doc comments to single line 2020-03-10 12:36:19 +00:00
344c980cff GlobalConstants: add strict_types 2020-03-10 12:35:13 +00:00
167492087f Chunk: specify expected bounds for Y coordinates 2020-03-10 12:33:53 +00:00
db215283a2 Effect: add desc for color parameter 2020-03-10 12:28:44 +00:00
6a507bb149 further CS fixes 2020-03-10 12:18:16 +00:00
a72e6ee706 Player: be aware of held item changing during click-block
this caused bugs if the inventory was cleared while using a hoe.
2020-03-10 12:10:01 +00:00
89ea7f0a76 Player: Stop setting held item post entity attack if changed (#3348)
closes #3340
2020-03-10 10:09:31 +00:00
a6ca37429c Player: do not set held item post block-break if changed (#3345)
this usually happens when a plugin replaces the held item during BlockBreakEvent.
closes #2010
2020-03-09 13:45:58 +00:00
4bf9fb278b Bump phpstan/phpstan from 0.12.11 to 0.12.14 (#3338) 2020-03-09 13:31:23 +00:00
15d81154e6 PluginDescription: drop unenforceable type constraint on array keys
the data that comes through here isn't validated, and there's also no guarantee that all the keys will be strings in spite of our best efforts even if it was validated, because PHP is fucking stupid and casts int-like string keys to int keys.
2020-03-05 19:53:01 +00:00
93e5c80962 MultiplayerSettingsPacket is bothways, close #3331 2020-03-03 12:32:57 +00:00
7aa8bd18d3 Revert "Item: restrict bounds of count to 0-255"
This reverts commit 10317527e4.

this breaks user code which exceeds stack limits in legitimate
circumstances. For example, it should be OK to add 6000x diamond to a
player's inventory without being forced to manually split the count up
for addItem().
2020-02-25 20:42:03 +00:00
53067c26d7 BaseInventory: stop mutating item for no reason in canAddItem() 2020-02-25 20:30:37 +00:00
04581e2700 DataPacket: account for splitscreen header when decoding 2020-02-24 21:20:25 +00:00
93597dcd50 SkinData: fixed loss of data from packet decode 2020-02-24 20:48:03 +00:00
778814a35e changelog: fix typo 2020-02-24 20:18:47 +00:00
3cd1da196a UpdateTradePacket: fix order of fields, closes #3327 2020-02-24 20:16:07 +00:00
365d4a1592 better fix for 1.14.30 movement bug 2020-02-23 19:31:32 +00:00
2d7f37ac47 avoid direct mutation of Item->count field, use Item->pop() instead
I think this change was already applied on the master branch, but I don't remember for sure.
2020-02-23 17:37:25 +00:00
50fcdd6e7e Item: fixed documentation of pop() return type (it's not fluent) 2020-02-23 17:32:50 +00:00
10317527e4 Item: restrict bounds of count to 0-255 2020-02-23 17:23:53 +00:00
46ac4cbca1 3.11.7 is next 2020-02-21 19:18:48 +00:00
84 changed files with 1810 additions and 434 deletions

View File

@ -6,11 +6,10 @@ php:
before_script:
- phpenv config-rm xdebug.ini
# - pecl install channel://pecl.php.net/pthreads-3.1.6
- echo | pecl install channel://pecl.php.net/yaml-2.0.4
- echo | pecl install channel://pecl.php.net/yaml-2.1.0
- git clone https://github.com/pmmp/pthreads.git
- cd pthreads
- git checkout 1b7da492b944146fa9680f6399bd9c6c6c6095e0
- git checkout 646dac62ae0d48c1ada7b007e15575fb84f7d71d
- phpize
- ./configure
- make

View File

@ -130,9 +130,13 @@ function main() : void{
exit(1);
}
$opts = getopt("", ["out:"]);
$gitHash = Git::getRepositoryStatePretty(dirname(__DIR__));
echo "Git hash detected as $gitHash" . PHP_EOL;
$opts = getopt("", ["out:", "git:"]);
if(isset($opts["git"])){
$gitHash = $opts["git"];
}else{
$gitHash = Git::getRepositoryStatePretty(dirname(__DIR__));
echo "Git hash detected as $gitHash" . PHP_EOL;
}
foreach(buildPhar(
$opts["out"] ?? getcwd() . DIRECTORY_SEPARATOR . "PocketMine-MP.phar",
dirname(__DIR__) . DIRECTORY_SEPARATOR,

View File

@ -65,7 +65,7 @@ Plugin developers should **only** update their required API to this version if y
- `build/server-phar.php` now uses GZIP compression on created phars, providing a 75% size reduction.
- `ClientboundMapItemDataPacket` now uses `MapDecoration` objects for decorations instead of associative arrays.
- Updated Composer dependencies to get bug fixes in `pocketmine/nbt` and other libraries.
- Packages `pocketmine/classloader` and `pockegtmine/log` are now required; these provide classes previously part of `pocketmine/spl`. This change has no effect on API compatibility.
- Packages `pocketmine/classloader` and `pocketmine/log` are now required; these provide classes previously part of `pocketmine/spl`. This change has no effect on API compatibility.
# 3.11.6
- Core code, tests and build scripts are now analyzed using `phpstan-strict-rules` and `phpstan-phpunit` rules.
@ -79,3 +79,19 @@ Plugin developers should **only** update their required API to this version if y
- `ThreadManager` is now lazily initialized.
- Removed raw NBT storage from `Item` internals. The following methods are now deprecated:
- `Item::setCompoundTag()`
# 3.11.7
- Build system: Fixed crash reports of Jenkins builds being rejected by the crash archive as invalid.
- Introduced a new dependency on `pocketmine/log-pthreads`, which contains classes separated from `pocketmine/log`.
- Fixed minimum composer stability preventing any newer version of `pocketmine/pocketmine-mp` being installed than 3.3.4 by replacing `daverandom/callback-validator` with [`pocketmine/callback-validator`](https://github.com/pmmp/CallbackValidator).
- Fixed every player seeing eating particles when any player eats.
- Fixed setting held item not working during `BlockBreakEvent`, `PlayerInteractEvent` and `EntityDamageEvent`.
- Fixed some incorrect documented types in `PlayerQuitEvent` reported by PHPStan.
- Fixed documentation of `Item->pop()` return value.
- Fixed server crash on encountering corrupted compressed data stored in region files.
- Protocol: Split screen header is now properly accounted for during decoding. Note that split screen is still not supported natively, but their packets can be decoded properly now.
- Protocol: Fixed wrong order of fields in `UpdateTradePacket`.
- Protocol: Fixed loss of `fullSkinId` when decoding network skins.
- Fixed RCON not being able to bind to port after a fast server restart.

27
changelogs/3.12.md Normal file
View File

@ -0,0 +1,27 @@
**For Minecraft: Bedrock Edition 1.14.60**
### 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.12.0
- Added support for Minecraft: Bedrock Edition 1.14.60
- Removed compatibility with 1.14.0-1.14.30
# 3.12.1
- Fixed parsing of single-line doc comments for event handlers, e.g. `/** @ignoreCancelled */` should now work correctly.
- The server will no longer crash on failure to load `level.dat` contents, but will gracefully shutdown instead without producing a crashdump.
- Fixed some bugs in login verification that could cause undefined behaviour.
- Fixed item-use behaviour when sneaking - sneaking and clicking a block with an empty hand, and sneaking and using an item, both now follow vanilla behaviour.
- `start.sh` will now work on platforms where `/bin/bash` is not available, as long as `/usr/bin/env` knows where bash is.
# 3.12.2
- Fixed permission default timings not being reported in timings reports (they were never stopped, only started).
- Resource packs with a directory tree like `pack.zip/MyPack/manifest.json` are now supported. Note that the manifest closest to the root will be used.
- Fixed `SkinImage` height and width being inverted at the protocol layer.
- Fixed blocks being able to be placed inside the spawn protectionb radius by clicking the side of a block outside the radius.
- Fixed server crash when `network.compression-level` is overridden by a CLI parameter.
- Fixed moving entities spawning themselves to players registered on chunks when the players haven't received the chunk yet.
- Cocoa pods now drop cocoa beans when broken instead of the block itself.

View File

@ -31,12 +31,13 @@
"pocketmine/math": "^0.2.0",
"pocketmine/snooze": "^0.1.0",
"pocketmine/classloader": "^0.1.0",
"pocketmine/log": "^0.1.0",
"daverandom/callback-validator": "dev-master",
"pocketmine/log": "^0.2.0",
"pocketmine/log-pthreads": "^0.1.0",
"pocketmine/callback-validator": "^1.0.1",
"adhocore/json-comment": "^0.1.0"
},
"require-dev": {
"phpstan/phpstan": "^0.12.9",
"phpstan/phpstan": "^0.12.25",
"irstea/phpunit-shim": "^8.5",
"phpstan/phpstan-phpunit": "^0.12.6",
"phpstan/phpstan-strict-rules": "^0.12.2"

220
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": "e22866a7924c444da73ff31b831b30cb",
"content-hash": "f9441d6ef46bddf299b260c672bfa54b",
"packages": [
{
"name": "adhocore/json-comment",
@ -50,46 +50,6 @@
],
"time": "2020-01-03T13:51:23+00:00"
},
{
"name": "daverandom/callback-validator",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/DaveRandom/CallbackValidator.git",
"reference": "d87a08cddbc6099816ed01e50ce25cdfc43b542f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/DaveRandom/CallbackValidator/zipball/d87a08cddbc6099816ed01e50ce25cdfc43b542f",
"reference": "d87a08cddbc6099816ed01e50ce25cdfc43b542f",
"shasum": ""
},
"require": {
"ext-reflection": "*",
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
},
"type": "library",
"autoload": {
"psr-4": {
"DaveRandom\\CallbackValidator\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Chris Wright",
"email": "cw@daverandom.com"
}
],
"description": "Tools for validating callback signatures",
"time": "2017-04-03T15:22:41+00:00"
},
{
"name": "pocketmine/binaryutils",
"version": "0.1.11",
@ -124,6 +84,49 @@
"description": "Classes and methods for conveniently handling binary data",
"time": "2020-01-28T12:09:56+00:00"
},
{
"name": "pocketmine/callback-validator",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/pmmp/CallbackValidator.git",
"reference": "4aef6bb25f97d0b830ba0b4f66834b1a9c86fc9a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/CallbackValidator/zipball/4aef6bb25f97d0b830ba0b4f66834b1a9c86fc9a",
"reference": "4aef6bb25f97d0b830ba0b4f66834b1a9c86fc9a",
"shasum": ""
},
"require": {
"ext-reflection": "*",
"php": ">=7.1"
},
"replace": {
"daverandom/callback-validator": "*"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.0"
},
"type": "library",
"autoload": {
"psr-4": {
"DaveRandom\\CallbackValidator\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Chris Wright",
"email": "cw@daverandom.com"
}
],
"description": "Fork of daverandom/callback-validator - Tools for validating callback signatures",
"time": "2020-03-17T12:04:22+00:00"
},
{
"name": "pocketmine/classloader",
"version": "0.1.0",
@ -164,27 +167,27 @@
},
{
"name": "pocketmine/log",
"version": "0.1.0",
"version": "0.2.0",
"source": {
"type": "git",
"url": "https://github.com/pmmp/Log.git",
"reference": "62c1f0ea5a5c0ae4b308f9bd231fb11638ff866e"
"reference": "e59bedb5d4bbeb9a26647cb7c367cb2fa72addfa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/Log/zipball/62c1f0ea5a5c0ae4b308f9bd231fb11638ff866e",
"reference": "62c1f0ea5a5c0ae4b308f9bd231fb11638ff866e",
"url": "https://api.github.com/repos/pmmp/Log/zipball/e59bedb5d4bbeb9a26647cb7c367cb2fa72addfa",
"reference": "e59bedb5d4bbeb9a26647cb7c367cb2fa72addfa",
"shasum": ""
},
"require": {
"ext-pthreads": "~3.2.0",
"php": ">=7.2"
},
"conflict": {
"pocketmine/spl": "<0.4"
},
"require-dev": {
"phpstan/phpstan": "^0.12.8"
"phpstan/phpstan": "^0.12.8",
"phpstan/phpstan-strict-rules": "^0.12.2"
},
"type": "library",
"autoload": {
@ -197,7 +200,45 @@
"LGPL-3.0"
],
"description": "Logging components used by PocketMine-MP and related projects",
"time": "2020-01-31T14:31:47+00:00"
"time": "2020-03-31T15:43:47+00:00"
},
{
"name": "pocketmine/log-pthreads",
"version": "0.1.0",
"source": {
"type": "git",
"url": "https://github.com/pmmp/LogPthreads.git",
"reference": "9bbcef398b01487ab47c234a6a7054722abbe067"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/LogPthreads/zipball/9bbcef398b01487ab47c234a6a7054722abbe067",
"reference": "9bbcef398b01487ab47c234a6a7054722abbe067",
"shasum": ""
},
"require": {
"ext-pthreads": "~3.2.0",
"php": ">=7.2",
"pocketmine/log": "^0.2.0"
},
"conflict": {
"pocketmine/spl": "<0.4"
},
"require-dev": {
"phpstan/phpstan": "^0.12.18"
},
"type": "library",
"autoload": {
"classmap": [
"./src"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
],
"description": "Logging components specialized for pthreads used by PocketMine-MP and related projects",
"time": "2020-03-31T16:17:19+00:00"
},
{
"name": "pocketmine/math",
@ -235,16 +276,16 @@
},
{
"name": "pocketmine/nbt",
"version": "0.2.13",
"version": "0.2.14",
"source": {
"type": "git",
"url": "https://github.com/pmmp/NBT.git",
"reference": "6fc56f864a5375471f6e2d0f9f89f2462a1d8433"
"reference": "b31dca98443328c4bab76dc1b84c1473c79be20e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/NBT/zipball/6fc56f864a5375471f6e2d0f9f89f2462a1d8433",
"reference": "6fc56f864a5375471f6e2d0f9f89f2462a1d8433",
"url": "https://api.github.com/repos/pmmp/NBT/zipball/b31dca98443328c4bab76dc1b84c1473c79be20e",
"reference": "b31dca98443328c4bab76dc1b84c1473c79be20e",
"shasum": ""
},
"require": {
@ -254,8 +295,8 @@
"pocketmine/binaryutils": "^0.1.9"
},
"require-dev": {
"irstea/phpunit-shim": "^7.5",
"phpstan/phpstan": "^0.12.8"
"irstea/phpunit-shim": "^7.5 || ^8.0",
"phpstan/phpstan": "^0.12.11"
},
"type": "library",
"autoload": {
@ -268,35 +309,36 @@
"LGPL-3.0"
],
"description": "PHP library for working with Named Binary Tags",
"time": "2020-01-28T17:03:46+00:00"
"time": "2020-04-15T11:29:25+00:00"
},
{
"name": "pocketmine/raklib",
"version": "0.12.7",
"version": "0.12.8",
"source": {
"type": "git",
"url": "https://github.com/pmmp/RakLib.git",
"reference": "01abb4e78e2ef69a83d50037d558e0b274f8245b"
"reference": "9fea763ffc922db083e4528d4acd0b13d0ea83a4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/01abb4e78e2ef69a83d50037d558e0b274f8245b",
"reference": "01abb4e78e2ef69a83d50037d558e0b274f8245b",
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/9fea763ffc922db083e4528d4acd0b13d0ea83a4",
"reference": "9fea763ffc922db083e4528d4acd0b13d0ea83a4",
"shasum": ""
},
"require": {
"ext-bcmath": "*",
"ext-pthreads": "~3.2.0",
"ext-sockets": "*",
"php": ">=7.2.0",
"php-64bit": "*",
"php-ipv6": "*",
"pocketmine/binaryutils": "^0.1.9",
"pocketmine/log": "^0.1.0",
"pocketmine/log": "^0.2.0",
"pocketmine/log-pthreads": "^0.1.0",
"pocketmine/snooze": "^0.1.0"
},
"require-dev": {
"phpstan/phpstan": "^0.12.8"
"phpstan/phpstan": "^0.12.18",
"phpstan/phpstan-strict-rules": "^0.12.2"
},
"type": "library",
"autoload": {
@ -309,7 +351,7 @@
"GPL-3.0"
],
"description": "A RakNet server implementation written in PHP",
"time": "2020-01-31T15:33:05+00:00"
"time": "2020-03-31T17:28:28+00:00"
},
{
"name": "pocketmine/snooze",
@ -382,11 +424,11 @@
"packages-dev": [
{
"name": "irstea/phpunit-shim",
"version": "8.5.2",
"version": "8.5.4",
"source": {
"type": "git",
"url": "https://gitlab.irstea.fr/pole-is/tools/phpunit-shim.git",
"reference": "8ec63f895972681271191821a36f9081c236b993"
"reference": "25b3ffe1502bfd35d5cd23dc37f2f2e70cdf0b54"
},
"require": {
"ext-dom": "*",
@ -432,25 +474,28 @@
"testing",
"xunit"
],
"time": "2020-01-23T13:39:47+00:00"
"time": "2020-04-24T02:20:21+00:00"
},
{
"name": "phpstan/phpstan",
"version": "0.12.11",
"version": "0.12.25",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "ca5f2b7cf81c6d8fba74f9576970399c5817e03b"
"reference": "9619551d68b2d4c0d681a8df73f3c847c798ee64"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/ca5f2b7cf81c6d8fba74f9576970399c5817e03b",
"reference": "ca5f2b7cf81c6d8fba74f9576970399c5817e03b",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/9619551d68b2d4c0d681a8df73f3c847c798ee64",
"reference": "9619551d68b2d4c0d681a8df73f3c847c798ee64",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"conflict": {
"phpstan/phpstan-shim": "*"
},
"bin": [
"phpstan",
"phpstan.phar"
@ -471,25 +516,39 @@
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"time": "2020-02-16T14:00:29+00:00"
"funding": [
{
"url": "https://github.com/ondrejmirtes",
"type": "github"
},
{
"url": "https://www.patreon.com/phpstan",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
"type": "tidelift"
}
],
"time": "2020-05-10T20:36:16+00:00"
},
{
"name": "phpstan/phpstan-phpunit",
"version": "0.12.6",
"version": "0.12.8",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-phpunit.git",
"reference": "26394996368b6d033d012547d3197f4e07e23021"
"reference": "7232c17e2493dc598173da784477ce0afb2c4e0e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/26394996368b6d033d012547d3197f4e07e23021",
"reference": "26394996368b6d033d012547d3197f4e07e23021",
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/7232c17e2493dc598173da784477ce0afb2c4e0e",
"reference": "7232c17e2493dc598173da784477ce0afb2c4e0e",
"shasum": ""
},
"require": {
"php": "~7.1",
"phpstan/phpstan": "^0.12.4"
"phpstan/phpstan": "^0.12.6"
},
"conflict": {
"phpunit/phpunit": "<7.0"
@ -527,7 +586,7 @@
"MIT"
],
"description": "PHPUnit extensions and rules for PHPStan",
"time": "2020-01-10T12:07:21+00:00"
"time": "2020-04-17T08:04:10+00:00"
},
{
"name": "phpstan/phpstan-strict-rules",
@ -583,9 +642,7 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"daverandom/callback-validator": 20
},
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
@ -609,5 +666,6 @@
"ext-zip": "*",
"ext-zlib": ">=1.2.11"
},
"platform-dev": []
"platform-dev": [],
"plugin-api-version": "1.1.0"
}

View File

@ -1,4 +1,5 @@
includes:
- tests/phpstan/configs/actual-problems.neon
- tests/phpstan/configs/com-dotnet-magic.neon
- tests/phpstan/configs/custom-leveldb.neon
- tests/phpstan/configs/gc-hacks.neon
@ -31,158 +32,5 @@ parameters:
- tests/phpstan/stubs/pthreads.stub
- tests/phpstan/stubs/chunkutils.stub
reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings
ignoreErrors:
-
message: "#^Instanceof between pocketmine\\\\plugin\\\\PluginManager and pocketmine\\\\plugin\\\\PluginManager will always evaluate to true\\.$#"
count: 1
path: src/pocketmine/CrashDump.php
-
message: "#^pocketmine\\\\Player\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\entity\\\\Human\\.$#"
count: 1
path: src/pocketmine/Player.php
-
message: "#^Cannot instantiate interface pocketmine\\\\level\\\\format\\\\io\\\\LevelProvider\\.$#"
count: 1
path: src/pocketmine/Server.php
-
message: "#^Instanceof between pocketmine\\\\plugin\\\\PluginManager and pocketmine\\\\plugin\\\\PluginManager will always evaluate to true\\.$#"
count: 1
path: src/pocketmine/Server.php
-
message: "#^Instanceof between pocketmine\\\\scheduler\\\\AsyncPool and pocketmine\\\\scheduler\\\\AsyncPool will always evaluate to true\\.$#"
count: 1
path: src/pocketmine/Server.php
-
message: "#^Instanceof between pocketmine\\\\command\\\\CommandReader and pocketmine\\\\command\\\\CommandReader will always evaluate to true\\.$#"
count: 1
path: src/pocketmine/Server.php
-
message: "#^Instanceof between pocketmine\\\\network\\\\Network and pocketmine\\\\network\\\\Network will always evaluate to true\\.$#"
count: 1
path: src/pocketmine/Server.php
-
message: "#^pocketmine\\\\block\\\\[A-Za-z\\d]+\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
path: src/pocketmine/block
-
message: "#^pocketmine\\\\block\\\\Block\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\level\\\\Position\\.$#"
count: 1
path: src/pocketmine/block/Block.php
-
message: "#^Call to an undefined method pocketmine\\\\command\\\\CommandSender\\:\\:teleport\\(\\)\\.$#"
count: 1
path: src/pocketmine/command/defaults/TeleportCommand.php
# comment: "not actually possible, but high cost to fix warning"
-
message: "#^Method pocketmine\\\\event\\\\entity\\\\EntityDeathEvent\\:\\:getEntity\\(\\) should return pocketmine\\\\entity\\\\Living but returns pocketmine\\\\entity\\\\Entity\\.$#"
count: 1
path: src/pocketmine/event/entity/EntityDeathEvent.php
-
message: "#^Method pocketmine\\\\event\\\\entity\\\\EntityShootBowEvent\\:\\:getEntity\\(\\) should return pocketmine\\\\entity\\\\Living but returns pocketmine\\\\entity\\\\Entity\\.$#"
count: 1
path: src/pocketmine/event/entity/EntityShootBowEvent.php
-
message: "#^Property pocketmine\\\\event\\\\entity\\\\EntityShootBowEvent\\:\\:\\$projectile \\(pocketmine\\\\entity\\\\projectile\\\\Projectile\\) does not accept pocketmine\\\\entity\\\\Entity\\.$#"
count: 1
path: src/pocketmine/event/entity/EntityShootBowEvent.php
-
message: "#^Method pocketmine\\\\event\\\\entity\\\\ItemDespawnEvent\\:\\:getEntity\\(\\) should return pocketmine\\\\entity\\\\object\\\\ItemEntity but returns pocketmine\\\\entity\\\\Entity\\.$#"
count: 1
path: src/pocketmine/event/entity/ItemDespawnEvent.php
-
message: "#^Method pocketmine\\\\event\\\\entity\\\\ItemSpawnEvent\\:\\:getEntity\\(\\) should return pocketmine\\\\entity\\\\object\\\\ItemEntity but returns pocketmine\\\\entity\\\\Entity\\.$#"
count: 1
path: src/pocketmine/event/entity/ItemSpawnEvent.php
-
message: "#^Method pocketmine\\\\event\\\\entity\\\\ProjectileHitEvent\\:\\:getEntity\\(\\) should return pocketmine\\\\entity\\\\projectile\\\\Projectile but returns pocketmine\\\\entity\\\\Entity\\.$#"
count: 1
path: src/pocketmine/event/entity/ProjectileHitEvent.php
-
message: "#^Method pocketmine\\\\event\\\\entity\\\\ProjectileLaunchEvent\\:\\:getEntity\\(\\) should return pocketmine\\\\entity\\\\projectile\\\\Projectile but returns pocketmine\\\\entity\\\\Entity\\.$#"
count: 1
path: src/pocketmine/event/entity/ProjectileLaunchEvent.php
-
message: "#^pocketmine\\\\inventory\\\\DoubleChestInventory\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\inventory\\\\ChestInventory\\.$#"
count: 1
path: src/pocketmine/inventory/DoubleChestInventory.php
-
message: "#^pocketmine\\\\inventory\\\\EnderChestInventory\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\inventory\\\\ChestInventory\\.$#"
count: 1
path: src/pocketmine/inventory/EnderChestInventory.php
-
message: "#^pocketmine\\\\item\\\\GoldenAppleEnchanted\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\item\\\\GoldenApple\\.$#"
count: 1
path: src/pocketmine/item/GoldenAppleEnchanted.php
-
message: "#^pocketmine\\\\item\\\\WrittenBook\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\item\\\\WritableBook\\.$#"
count: 1
path: src/pocketmine/item/WrittenBook.php
-
message: "#^Variable property access on \\$this\\(pocketmine\\\\level\\\\generator\\\\PopulationTask\\)\\.$#"
count: 4
path: src/pocketmine/level/generator/PopulationTask.php
-
message: "#^Constructor of class pocketmine\\\\level\\\\generator\\\\hell\\\\Nether has an unused parameter \\$options\\.$#"
count: 1
path: src/pocketmine/level/generator/hell/Nether.php
-
message: "#^Constructor of class pocketmine\\\\level\\\\generator\\\\normal\\\\Normal has an unused parameter \\$options\\.$#"
count: 1
path: src/pocketmine/level/generator/normal/Normal.php
-
message: "#^Variable method call on pocketmine\\\\event\\\\Listener\\.$#"
count: 1
path: src/pocketmine/plugin/MethodEventExecutor.php
-
message: "#^Constructor of class pocketmine\\\\scheduler\\\\TaskScheduler has an unused parameter \\$logger\\.$#"
count: 1
path: src/pocketmine/scheduler/TaskScheduler.php
-
message: "#^Constant pocketmine\\\\COMPOSER_AUTOLOADER_PATH not found\\.$#"
path: src
-
message: "#^Constant pocketmine\\\\DATA not found\\.$#"
path: src
-
message: "#^Constant pocketmine\\\\GIT_COMMIT not found\\.$#"
path: src
-
message: "#^Constant pocketmine\\\\PLUGIN_PATH not found\\.$#"
path: src
-
message: "#^Constant pocketmine\\\\START_TIME not found\\.$#"
path: src
-
message: "#^Constant pocketmine\\\\VERSION not found\\.$#"
path: src
staticReflectionClassNamePatterns:
- "#^COM$#"

View File

@ -23,6 +23,10 @@ declare(strict_types=1);
namespace pocketmine;
use function define;
use function defined;
use function dirname;
// composer autoload doesn't use require_once and also pthreads can inherit things
if(defined('pocketmine\_CORE_CONSTANTS_INCLUDED')){
return;

View File

@ -19,6 +19,8 @@
*
*/
declare(strict_types=1);
// composer autoload doesn't use require_once and also pthreads can inherit things
if(defined('pocketmine\_GLOBAL_CONSTANTS_INCLUDED')){
return;

View File

@ -146,6 +146,8 @@ use pocketmine\network\mcpe\protocol\types\CommandEnum;
use pocketmine\network\mcpe\protocol\types\CommandParameter;
use pocketmine\network\mcpe\protocol\types\ContainerIds;
use pocketmine\network\mcpe\protocol\types\DimensionIds;
use pocketmine\network\mcpe\protocol\types\PersonaPieceTintColor;
use pocketmine\network\mcpe\protocol\types\PersonaSkinPiece;
use pocketmine\network\mcpe\protocol\types\PlayerPermissions;
use pocketmine\network\mcpe\protocol\types\SkinAdapterSingleton;
use pocketmine\network\mcpe\protocol\types\SkinAnimation;
@ -259,6 +261,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** @var bool */
public $loggedIn = false;
/** @var bool */
private $seenLoginPacket = false;
/** @var bool */
private $resourcePacksDone = false;
@ -1595,8 +1599,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
if($to->distanceSquared($ev->getTo()) > 0.01){ //If plugins modify the destination
$this->teleport($ev->getTo());
}else{
//TODO: workaround 1.14.30 bug: MoveActor(Absolute|Delta)Packet don't work on players anymore :(
$this->sendPosition($this, $this->yaw, $this->pitch, MovePlayerPacket::MODE_NORMAL, $this->hasSpawned);
$this->broadcastMovement();
$distance = sqrt((($from->x - $to->x) ** 2) + (($from->z - $to->z) ** 2));
//TODO: check swimming (adds 0.015 exhaustion in MCPE)
@ -1815,9 +1818,10 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
}
public function handleLogin(LoginPacket $packet) : bool{
if($this->loggedIn){
if($this->seenLoginPacket){
return false;
}
$this->seenLoginPacket = true;
if($packet->protocol !== ProtocolInfo::CURRENT_PROTOCOL){
if($packet->protocol < ProtocolInfo::CURRENT_PROTOCOL){
@ -1860,6 +1864,16 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$animations[] = new SkinAnimation(new SkinImage($animation["ImageHeight"], $animation["ImageWidth"], base64_decode($animation["Image"], true)), $animation["Type"], $animation["Frames"]);
}
$personaPieces = [];
foreach($packet->clientData["PersonaPieces"] as $piece){
$personaPieces[] = new PersonaSkinPiece($piece["PieceId"], $piece["PieceType"], $piece["PackId"], $piece["IsDefault"], $piece["ProductId"]);
}
$pieceTintColors = [];
foreach($packet->clientData["PieceTintColors"] as $tintColor){
$pieceTintColors[] = new PersonaPieceTintColor($tintColor["PieceType"], $tintColor["Colors"]);
}
$skinData = new SkinData(
$packet->clientData["SkinId"],
base64_decode($packet->clientData["SkinResourcePatch"] ?? "", true),
@ -1871,7 +1885,13 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$packet->clientData["PremiumSkin"] ?? false,
$packet->clientData["PersonaSkin"] ?? false,
$packet->clientData["CapeOnClassicSkin"] ?? false,
$packet->clientData["CapeId"] ?? ""
$packet->clientData["CapeId"] ?? "",
null,
$packet->clientData["ArmSize"] ?? SkinData::ARM_SIZE_WIDE,
$packet->clientData["SkinColor"] ?? "",
$personaPieces,
$pieceTintColors,
true
);
$skin = SkinAdapterSingleton::get()->fromSkinData($skinData);
@ -2250,6 +2270,10 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
}
public function handleEntityEvent(ActorEventPacket $packet) : bool{
if($packet->entityRuntimeId !== $this->id){
//TODO HACK: EATING_ITEM is sent back to the server when the server sends it for other players (1.14 bug, maybe earlier)
return $packet->event === ActorEventPacket::EATING_ITEM;
}
if(!$this->spawned or !$this->isAlive()){
return true;
}
@ -2389,7 +2413,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$item = $this->inventory->getItemInHand();
$oldItem = clone $item;
if($this->level->useItemOn($blockVector, $item, $face, $packet->trData->clickPos, $this, true)){
if(!$item->equalsExact($oldItem)){
if(!$item->equalsExact($oldItem) and $oldItem->equalsExact($this->inventory->getItemInHand())){
$this->inventory->setItemInHand($item);
$this->inventory->sendHeldItem($this->hasSpawned);
}
@ -2421,7 +2445,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
if($this->canInteract($blockVector->add(0.5, 0.5, 0.5), $this->isCreative() ? 13 : 7) and $this->level->useBreakOn($blockVector, $item, $this, true)){
if($this->isSurvival()){
if(!$item->equalsExact($oldItem)){
if(!$item->equalsExact($oldItem) and $oldItem->equalsExact($this->inventory->getItemInHand())){
$this->inventory->setItemInHand($item);
$this->inventory->sendHeldItem($this->hasSpawned);
}
@ -2532,6 +2556,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$cancelled = false;
$heldItem = $this->inventory->getItemInHand();
$oldItem = clone $heldItem;
if(!$this->canInteract($target, 8)){
$cancelled = true;
@ -2591,7 +2616,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
if($this->isAlive()){
//reactive damage like thorns might cause us to be killed by attacking another mob, which
//would mean we'd already have dropped the inventory by the time we reached here
if($heldItem->onAttackEntity($target) and $this->isSurvival()){ //always fire the hook, even if we are survival
if($heldItem->onAttackEntity($target) and $this->isSurvival() and $oldItem->equalsExact($this->inventory->getItemInHand())){ //always fire the hook, even if we are survival
$this->inventory->setItemInHand($heldItem);
}

View File

@ -177,15 +177,14 @@ namespace pocketmine {
}else{
$bootstrap = dirname(__FILE__, 3) . '/vendor/autoload.php';
}
define('pocketmine\COMPOSER_AUTOLOADER_PATH', $bootstrap);
if(\pocketmine\COMPOSER_AUTOLOADER_PATH !== false and is_file(\pocketmine\COMPOSER_AUTOLOADER_PATH)){
require_once(\pocketmine\COMPOSER_AUTOLOADER_PATH);
}else{
if($bootstrap === false or !is_file($bootstrap)){
critical_error("Composer autoloader not found at " . $bootstrap);
critical_error("Please install/update Composer dependencies or use provided builds.");
exit(1);
}
define('pocketmine\COMPOSER_AUTOLOADER_PATH', $bootstrap);
require_once(\pocketmine\COMPOSER_AUTOLOADER_PATH);
set_error_handler([Utils::class, 'errorExceptionHandler']);

View File

@ -1396,7 +1396,7 @@ class Server{
Network::$BATCH_THRESHOLD = -1;
}
$this->networkCompressionLevel = $this->getProperty("network.compression-level", 7);
$this->networkCompressionLevel = (int) $this->getProperty("network.compression-level", 7);
if($this->networkCompressionLevel < 1 or $this->networkCompressionLevel > 9){
$this->logger->warning("Invalid network compression level $this->networkCompressionLevel set, setting to default 7");
$this->networkCompressionLevel = 7;

View File

@ -23,6 +23,8 @@ declare(strict_types=1);
namespace pocketmine;
use const PTHREADS_INHERIT_ALL;
/**
* This class must be extended by all custom threading classes
*/
@ -78,7 +80,7 @@ abstract class Thread extends \Thread{
*
* @return bool
*/
public function start(?int $options = \PTHREADS_INHERIT_ALL){
public function start(?int $options = PTHREADS_INHERIT_ALL){
ThreadManager::getInstance()->add($this);
if($this->getClassLoader() === null){

View File

@ -23,6 +23,8 @@ declare(strict_types=1);
namespace pocketmine;
use function defined;
// composer autoload doesn't use require_once and also pthreads can inherit things
// TODO: drop this file and use a final class with constants
if(defined('pocketmine\_VERSION_INFO_INCLUDED')){
@ -31,6 +33,6 @@ if(defined('pocketmine\_VERSION_INFO_INCLUDED')){
const _VERSION_INFO_INCLUDED = true;
const NAME = "PocketMine-MP";
const BASE_VERSION = "3.11.6";
const BASE_VERSION = "3.12.2";
const IS_DEVELOPMENT_BUILD = false;
const BUILD_NUMBER = 0;

View File

@ -23,6 +23,8 @@ declare(strict_types=1);
namespace pocketmine;
use const PTHREADS_INHERIT_ALL;
/**
* This class must be extended by all custom threading classes
*/
@ -78,7 +80,7 @@ abstract class Worker extends \Worker{
*
* @return bool
*/
public function start(?int $options = \PTHREADS_INHERIT_ALL){
public function start(?int $options = PTHREADS_INHERIT_ALL){
ThreadManager::getInstance()->add($this);
if($this->getClassLoader() === null){

View File

@ -23,6 +23,11 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\ItemIds;
use function mt_rand;
class CocoaBlock extends Transparent{
protected $id = self::COCOA_BLOCK;
@ -48,4 +53,14 @@ class CocoaBlock extends Transparent{
public function isAffectedBySilkTouch() : bool{
return false;
}
public function getDropsForCompatibleTool(Item $item) : array{
return [
ItemFactory::get(ItemIds::DYE, 3, ($this->meta >> 2) === 2 ? mt_rand(2, 3) : 1)
];
}
public function getPickedItem() : Item{
return ItemFactory::get(ItemIds::DYE, 3);
}
}

View File

@ -55,7 +55,7 @@ abstract class Crops extends Flowable{
$this->getLevel()->setBlock($this, $ev->getNewState(), true, true);
}
$item->count--;
$item->pop();
return true;
}

View File

@ -99,7 +99,7 @@ class Grass extends Solid{
public function onActivate(Item $item, Player $player = null) : bool{
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){
$item->count--;
$item->pop();
TallGrassObject::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2);
return true;

View File

@ -72,7 +72,7 @@ class Sapling extends Flowable{
//TODO: change log type
Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->getVariant());
$item->count--;
$item->pop();
return true;
}

View File

@ -62,7 +62,7 @@ class Sugarcane extends Flowable{
$this->getLevel()->setBlock($this, $this, true);
}
$item->count--;
$item->pop();
return true;
}

View File

@ -71,10 +71,13 @@ class AttributeMap implements \ArrayAccess{
}
/**
* @param int $offset
* @param float $value
* @param int|null $offset
* @param float $value
*/
public function offsetSet($offset, $value) : void{
if($offset === null){
throw new \InvalidArgumentException("Array push syntax is not supported");
}
$this->attributes[$offset]->setValue($value);
}

View File

@ -125,7 +125,7 @@ class Effect{
/**
* @param int $id Effect ID as per Minecraft PE
* @param string $name Translation key used for effect name
* @param Color $color
* @param Color $color Color of bubbles given by this effect
* @param bool $isBad Whether the effect is harmful
* @param int $defaultDuration Duration in ticks the effect will last for by default if applied without a duration.
* @param bool $hasBubbles Whether the effect has potion bubbles. Some do not (e.g. Instant Damage has its own particles instead of bubbles)

View File

@ -297,11 +297,11 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
public const DATA_FLAG_OVER_SCAFFOLDING = 69;
public const DATA_FLAG_FALL_THROUGH_SCAFFOLDING = 70;
public const DATA_FLAG_BLOCKING = 71; //shield
public const DATA_FLAG_DISABLE_BLOCKING = 72;
//73 is set when a player is attacked while using shield, unclear on purpose
//74 related to shield usage, needs further investigation
public const DATA_FLAG_TRANSITION_BLOCKING = 72;
public const DATA_FLAG_BLOCKED_USING_SHIELD = 73;
public const DATA_FLAG_BLOCKED_USING_DAMAGED_SHIELD = 74;
public const DATA_FLAG_SLEEPING = 75;
//76 related to sleeping, unclear usage
public const DATA_FLAG_WANTS_TO_WAKE = 76;
public const DATA_FLAG_TRADE_INTEREST = 77;
public const DATA_FLAG_DOOR_BREAKER = 78; //...
public const DATA_FLAG_BREAKING_OBSTRUCTION = 79;
@ -311,8 +311,12 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
public const DATA_FLAG_ROARING = 83;
public const DATA_FLAG_DELAYED_ATTACKING = 84;
public const DATA_FLAG_AVOIDING_MOBS = 85;
//86 used by RangedAttackGoal
//87 used by NearestAttackableTargetGoal
public const DATA_FLAG_FACING_TARGET_TO_RANGE_ATTACK = 86;
public const DATA_FLAG_HIDDEN_WHEN_INVISIBLE = 87; //??????????????????
public const DATA_FLAG_IS_IN_UI = 88;
public const DATA_FLAG_STALKING = 89;
public const DATA_FLAG_EMOTING = 90;
public const DATA_FLAG_CELEBRATING = 91;
public const DATA_PLAYER_FLAG_SLEEP = 1;
public const DATA_PLAYER_FLAG_DEAD = 2; //TODO: CHECK
@ -1927,7 +1931,12 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
}
public function spawnTo(Player $player) : void{
if(!isset($this->hasSpawned[$player->getLoaderId()]) and $this->chunk !== null and isset($player->usedChunks[Level::chunkHash($this->chunk->getX(), $this->chunk->getZ())])){
if(
!isset($this->hasSpawned[$player->getLoaderId()]) and
$this->chunk !== null and
isset($player->usedChunks[$chunkHash = Level::chunkHash($this->chunk->getX(), $this->chunk->getZ())]) and
$player->usedChunks[$chunkHash] === true
){
$this->hasSpawned[$player->getLoaderId()] = $player;
$this->sendSpawnPacket($player);

View File

@ -835,7 +835,11 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
$pk->headYaw = $this->yaw;
$pk->mode = $teleport ? MovePlayerPacket::MODE_TELEPORT : MovePlayerPacket::MODE_NORMAL;
$this->level->addChunkPacket($this->getFloorX() >> 4, $this->getFloorZ() >> 4, $pk);
//we can't assume that everyone who is using our chunk wants to see this movement,
//because this human might be a player who shouldn't be receiving his own movement.
//this didn't matter when we were able to use MoveActorPacket because
//the client just ignored MoveActor for itself, but it doesn't ignore MovePlayer for itself.
$this->server->broadcastPacket($this->hasSpawned, $pk);
}
public function close() : void{

View File

@ -36,14 +36,10 @@ class ExperienceOrb extends Entity{
public const TAG_VALUE_PC = "Value"; //short
public const TAG_VALUE_PE = "experience value"; //int (WTF?)
/**
* Max distance an orb will follow a player across.
*/
/** Max distance an orb will follow a player across. */
public const MAX_TARGET_DISTANCE = 8.0;
/**
* Split sizes used for dropping experience orbs.
*/
/** Split sizes used for dropping experience orbs. */
public const ORB_SPLIT_SIZES = [2477, 1237, 617, 307, 149, 73, 37, 17, 7, 3, 1]; //This is indexed biggest to smallest so that we can return as soon as we found the biggest value.
/**

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\event\player;
use pocketmine\lang\TextContainer;
use pocketmine\lang\TranslationContainer;
use pocketmine\Player;
@ -31,13 +32,13 @@ use pocketmine\Player;
*/
class PlayerQuitEvent extends PlayerEvent{
/** @var TranslationContainer|string */
/** @var TextContainer|string */
protected $quitMessage;
/** @var string */
protected $quitReason;
/**
* @param TranslationContainer|string $quitMessage
* @param TextContainer|string $quitMessage
*/
public function __construct(Player $player, $quitMessage, string $quitReason){
$this->player = $player;
@ -46,14 +47,14 @@ class PlayerQuitEvent extends PlayerEvent{
}
/**
* @param TranslationContainer|string $quitMessage
* @param TextContainer|string $quitMessage
*/
public function setQuitMessage($quitMessage) : void{
$this->quitMessage = $quitMessage;
}
/**
* @return TranslationContainer|string
* @return TextContainer|string
*/
public function getQuitMessage(){
return $this->quitMessage;

View File

@ -246,18 +246,18 @@ abstract class BaseInventory implements Inventory{
}
public function canAddItem(Item $item) : bool{
$item = clone $item;
$count = $item->getCount();
for($i = 0, $size = $this->getSize(); $i < $size; ++$i){
$slot = $this->getItem($i);
if($item->equals($slot)){
if(($diff = $slot->getMaxStackSize() - $slot->getCount()) > 0){
$item->setCount($item->getCount() - $diff);
$count -= $diff;
}
}elseif($slot->isNull()){
$item->setCount($item->getCount() - $this->getMaxStackSize());
$count -= $this->getMaxStackSize();
}
if($item->getCount() <= 0){
if($count <= 0){
return true;
}
}

View File

@ -28,13 +28,9 @@ use pocketmine\Player;
class CreativeInventoryAction extends InventoryAction{
/**
* Player put an item into the creative window to destroy it.
*/
/** Player put an item into the creative window to destroy it. */
public const TYPE_DELETE_ITEM = 0;
/**
* Player took an item from the creative window.
*/
/** Player took an item from the creative window. */
public const TYPE_CREATE_ITEM = 1;
/** @var int */

View File

@ -565,7 +565,7 @@ class Item implements ItemIds, \JsonSerializable{
/**
* Pops an item from the stack and returns it, decreasing the stack count of this item stack by one.
*
* @return $this
* @return static A clone of this itemstack containing the amount of items that were removed from this stack.
* @throws \InvalidArgumentException if trying to pop more items than are on the stack
*/
public function pop(int $count = 1) : Item{

View File

@ -96,7 +96,7 @@ class PaintingItem extends Item{
$entity = Entity::createEntity("Painting", $blockReplace->getLevel(), $nbt);
if($entity instanceof Entity){
--$this->count;
$this->pop();
$entity->spawnToAll();
$player->getLevel()->broadcastLevelEvent($blockReplace->add(0.5, 0.5, 0.5), LevelEventPacket::EVENT_SOUND_ITEMFRAME_PLACE); //item frame and painting have the same sound

View File

@ -54,7 +54,7 @@ abstract class ProjectileItem extends Item{
$projectile->setMotion($projectile->getMotion()->multiply($this->getThrowForce()));
}
$this->count--;
$this->pop();
if($projectile instanceof Projectile){
$projectileEv = new ProjectileLaunchEvent($projectile);

View File

@ -44,7 +44,7 @@ class SpawnEgg extends Item{
$entity = Entity::createEntity($this->meta, $player->getLevel(), $nbt);
if($entity instanceof Entity){
--$this->count;
$this->pop();
$entity->spawnToAll();
return true;
}

View File

@ -1862,11 +1862,11 @@ class Level implements ChunkManager, Metadatable{
$ev->call();
if(!$ev->isCancelled()){
if(!$player->isSneaking() and $blockClicked->onActivate($item, $player)){
if((!$player->isSneaking() or $item->isNull()) and $blockClicked->onActivate($item, $player)){
return true;
}
if(!$player->isSneaking() and $item->onActivate($player, $blockReplace, $blockClicked, $face, $clickVector)){
if($item->onActivate($player, $blockReplace, $blockClicked, $face, $clickVector)){
return true;
}
}else{
@ -1909,7 +1909,7 @@ class Level implements ChunkManager, Metadatable{
if($player !== null){
$ev = new BlockPlaceEvent($player, $hand, $blockReplace, $blockClicked, $item);
if($this->checkSpawnProtection($player, $blockClicked)){
if($this->checkSpawnProtection($player, $blockReplace)){
$ev->setCancelled();
}

View File

@ -175,7 +175,7 @@ class Chunk{
* Returns a bitmap of block ID and meta at the specified chunk block coordinates
*
* @param int $x 0-15
* @param int $y
* @param int $y 0-255
* @param int $z 0-15
*
* @return int bitmap, (id << 4) | meta
@ -188,7 +188,7 @@ class Chunk{
* Sets block ID and meta in one call at the specified chunk block coordinates
*
* @param int $x 0-15
* @param int $y
* @param int $y 0-255
* @param int $z 0-15
* @param int|null $blockId 0-255 if null, does not change
* @param int|null $meta 0-15 if null, does not change
@ -205,7 +205,7 @@ class Chunk{
* Returns the block ID at the specified chunk block coordinates
*
* @param int $x 0-15
* @param int $y
* @param int $y 0-255
* @param int $z 0-15
*
* @return int 0-255
@ -218,7 +218,7 @@ class Chunk{
* Sets the block ID at the specified chunk block coordinates
*
* @param int $x 0-15
* @param int $y
* @param int $y 0-255
* @param int $z 0-15
* @param int $id 0-255
*
@ -234,7 +234,7 @@ class Chunk{
* Returns the block meta value at the specified chunk block coordinates
*
* @param int $x 0-15
* @param int $y
* @param int $y 0-255
* @param int $z 0-15
*
* @return int 0-15
@ -247,7 +247,7 @@ class Chunk{
* Sets the block meta value at the specified chunk block coordinates
*
* @param int $x 0-15
* @param int $y
* @param int $y 0-255
* @param int $z 0-15
* @param int $data 0-15
*
@ -263,7 +263,7 @@ class Chunk{
* Returns the sky light level at the specified chunk block coordinates
*
* @param int $x 0-15
* @param int $y
* @param int $y 0-255
* @param int $z 0-15
*
* @return int 0-15
@ -276,7 +276,7 @@ class Chunk{
* Sets the sky light level at the specified chunk block coordinates
*
* @param int $x 0-15
* @param int $y
* @param int $y 0-255
* @param int $z 0-15
* @param int $level 0-15
*
@ -303,7 +303,7 @@ class Chunk{
* Returns the block light level at the specified chunk block coordinates
*
* @param int $x 0-15
* @param int $y 0-15
* @param int $y 0-255
* @param int $z 0-15
*
* @return int 0-15
@ -316,7 +316,7 @@ class Chunk{
* Sets the block light level at the specified chunk block coordinates
*
* @param int $x 0-15
* @param int $y 0-15
* @param int $y 0-255
* @param int $z 0-15
* @param int $level 0-15
*
@ -653,7 +653,7 @@ class Chunk{
* Returns the tile at the specified chunk block coordinates, or null if no tile exists.
*
* @param int $x 0-15
* @param int $y
* @param int $y 0-255
* @param int $z 0-15
*
* @return Tile|null

View File

@ -35,6 +35,7 @@ use function file_exists;
use function file_get_contents;
use function file_put_contents;
use function mkdir;
use function zlib_decode;
abstract class BaseLevelProvider implements LevelProvider{
/** @var string */
@ -53,8 +54,20 @@ abstract class BaseLevelProvider implements LevelProvider{
}
protected function loadLevelData() : void{
$compressedLevelData = @file_get_contents($this->getPath() . "level.dat");
if($compressedLevelData === false){
throw new LevelException("Failed to read level.dat (permission denied or doesn't exist)");
}
$rawLevelData = @zlib_decode($compressedLevelData);
if($rawLevelData === false){
throw new LevelException("Failed to decompress level.dat contents (probably corrupted)");
}
$nbt = new BigEndianNBTStream();
$levelData = $nbt->readCompressed(file_get_contents($this->getPath() . "level.dat"));
try{
$levelData = $nbt->read($rawLevelData);
}catch(\UnexpectedValueException $e){
throw new LevelException("Failed to decode level.dat (" . $e->getMessage() . ")", 0, $e);
}
if(!($levelData instanceof CompoundTag) or !$levelData->hasTag("Data", CompoundTag::class)){
throw new LevelException("Invalid level.dat");

View File

@ -33,6 +33,7 @@ use pocketmine\nbt\tag\ByteArrayTag;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntArrayTag;
use pocketmine\nbt\tag\ListTag;
use function zlib_decode;
class Anvil extends McRegion{
@ -96,8 +97,12 @@ class Anvil extends McRegion{
}
protected function nbtDeserialize(string $data) : Chunk{
$data = @zlib_decode($data);
if($data === false){
throw new CorruptedChunkException("Failed to decompress chunk data");
}
$nbt = new BigEndianNBTStream();
$chunk = $nbt->readCompressed($data);
$chunk = $nbt->read($data);
if(!($chunk instanceof CompoundTag) or !$chunk->hasTag("Level")){
throw new CorruptedChunkException("'Level' key is missing from chunk NBT");
}

View File

@ -58,6 +58,7 @@ use function strrpos;
use function substr;
use function time;
use function unpack;
use function zlib_decode;
use const SCANDIR_SORT_NONE;
class McRegion extends BaseLevelProvider{
@ -125,8 +126,12 @@ class McRegion extends BaseLevelProvider{
* @throws CorruptedChunkException
*/
protected function nbtDeserialize(string $data) : Chunk{
$data = @zlib_decode($data);
if($data === false){
throw new CorruptedChunkException("Failed to decompress chunk data");
}
$nbt = new BigEndianNBTStream();
$chunk = $nbt->readCompressed($data);
$chunk = $nbt->read($data);
if(!($chunk instanceof CompoundTag) or !$chunk->hasTag("Level")){
throw new CorruptedChunkException("'Level' key is missing from chunk NBT");
}

View File

@ -32,7 +32,7 @@ use pocketmine\utils\Random;
abstract class Populator{
/**
* @return mixed
* @return void
*/
abstract public function populate(ChunkManager $level, int $chunkX, int $chunkZ, Random $random);
}

View File

@ -34,17 +34,26 @@ abstract class LightUpdate{
/** @var ChunkManager */
protected $level;
/** @var int[][] blockhash => [x, y, z, new light level] */
/**
* @var int[][] blockhash => [x, y, z, new light level]
* @phpstan-var array<int, array{int, int, int, int}>
*/
protected $updateNodes = [];
/** @var \SplQueue */
protected $spreadQueue;
/** @var bool[] */
/**
* @var true[]
* @phpstan-var array<int, true>
*/
protected $spreadVisited = [];
/** @var \SplQueue */
protected $removalQueue;
/** @var bool[] */
/**
* @var true[]
* @phpstan-var array<int, true>
*/
protected $removalVisited = [];
/** @var SubChunkIteratorManager */
protected $subChunkHandler;

View File

@ -27,7 +27,6 @@ namespace pocketmine\network\mcpe;
use pocketmine\entity\Attribute;
use pocketmine\entity\Entity;
use pocketmine\entity\Skin;
use pocketmine\item\Durable;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
@ -38,9 +37,12 @@ use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\network\mcpe\protocol\types\CommandOriginData;
use pocketmine\network\mcpe\protocol\types\EntityLink;
use pocketmine\network\mcpe\protocol\types\PersonaPieceTintColor;
use pocketmine\network\mcpe\protocol\types\PersonaSkinPiece;
use pocketmine\network\mcpe\protocol\types\SkinAnimation;
use pocketmine\network\mcpe\protocol\types\SkinData;
use pocketmine\network\mcpe\protocol\types\SkinImage;
use pocketmine\network\mcpe\protocol\types\StructureEditorData;
use pocketmine\network\mcpe\protocol\types\StructureSettings;
use pocketmine\utils\BinaryStream;
use pocketmine\utils\UUID;
@ -99,8 +101,35 @@ class NetworkBinaryStream extends BinaryStream{
$capeOnClassic = $this->getBool();
$capeId = $this->getString();
$fullSkinId = $this->getString();
$armSize = $this->getString();
$skinColor = $this->getString();
$personaPieceCount = $this->getLInt();
$personaPieces = [];
for($i = 0; $i < $personaPieceCount; ++$i){
$personaPieces[] = new PersonaSkinPiece(
$pieceId = $this->getString(),
$pieceType = $this->getString(),
$packId = $this->getString(),
$isDefaultPiece = $this->getBool(),
$productId = $this->getString()
);
}
$pieceTintColorCount = $this->getLInt();
$pieceTintColors = [];
for($i = 0; $i < $pieceTintColorCount; ++$i){
$pieceType = $this->getString();
$colorCount = $this->getLInt();
$colors = [];
for($j = 0; $j < $colorCount; ++$j){
$colors[] = $this->getString();
}
$pieceTintColors[] = new PersonaPieceTintColor(
$pieceType,
$colors
);
}
return new SkinData($skinId, $skinResourcePatch, $skinData, $animations, $capeData, $geometryData, $animationData, $premium, $persona, $capeOnClassic, $capeId);
return new SkinData($skinId, $skinResourcePatch, $skinData, $animations, $capeData, $geometryData, $animationData, $premium, $persona, $capeOnClassic, $capeId, $fullSkinId, $armSize, $skinColor, $personaPieces, $pieceTintColors);
}
/**
@ -123,9 +152,25 @@ class NetworkBinaryStream extends BinaryStream{
$this->putBool($skin->isPersona());
$this->putBool($skin->isPersonaCapeOnClassic());
$this->putString($skin->getCapeId());
//this has to be unique or the client will do stupid things
$this->putString(UUID::fromRandom()->toString()); //full skin ID
$this->putString($skin->getFullSkinId());
$this->putString($skin->getArmSize());
$this->putString($skin->getSkinColor());
$this->putLInt(count($skin->getPersonaPieces()));
foreach($skin->getPersonaPieces() as $piece){
$this->putString($piece->getPieceId());
$this->putString($piece->getPieceType());
$this->putString($piece->getPackId());
$this->putBool($piece->isDefaultPiece());
$this->putString($piece->getProductId());
}
$this->putLInt(count($skin->getPieceTintColors()));
foreach($skin->getPieceTintColors() as $tint){
$this->putString($tint->getPieceType());
$this->putLInt(count($tint->getColors()));
foreach($tint->getColors() as $color){
$this->putString($color);
}
}
}
private function getSkinImage() : SkinImage{
@ -658,6 +703,7 @@ class NetworkBinaryStream extends BinaryStream{
$result->mirror = $this->getByte();
$result->integrityValue = $this->getFloat();
$result->integritySeed = $this->getInt();
$result->pivot = $this->getVector3();
return $result;
}
@ -676,5 +722,34 @@ class NetworkBinaryStream extends BinaryStream{
$this->putByte($structureSettings->mirror);
$this->putFloat($structureSettings->integrityValue);
$this->putInt($structureSettings->integritySeed);
$this->putVector3($structureSettings->pivot);
}
protected function getStructureEditorData() : StructureEditorData{
$result = new StructureEditorData();
$result->structureName = $this->getString();
$result->structureDataField = $this->getString();
$result->includePlayers = $this->getBool();
$result->showBoundingBox = $this->getBool();
$result->structureBlockType = $this->getVarInt();
$result->structureSettings = $this->getStructureSettings();
$result->structureRedstoneSaveMove = $this->getVarInt();
return $result;
}
protected function putStructureEditorData(StructureEditorData $structureEditorData) : void{
$this->putString($structureEditorData->structureName);
$this->putString($structureEditorData->structureDataField);
$this->putBool($structureEditorData->includePlayers);
$this->putBool($structureEditorData->showBoundingBox);
$this->putVarInt($structureEditorData->structureBlockType);
$this->putStructureSettings($structureEditorData->structureSettings);
$this->putVarInt($structureEditorData->structureRedstoneSaveMove);
}
}

View File

@ -27,9 +27,9 @@ use pocketmine\network\mcpe\protocol\LoginPacket;
use pocketmine\Player;
use pocketmine\scheduler\AsyncTask;
use pocketmine\Server;
use function assert;
use function base64_decode;
use function chr;
use function count;
use function explode;
use function json_decode;
use function ltrim;
@ -94,7 +94,11 @@ class VerifyLoginTask extends AsyncTask{
* @throws VerifyLoginException if errors are encountered
*/
private function validateToken(string $jwt, ?string &$currentPublicKey, bool $first = false) : void{
[$headB64, $payloadB64, $sigB64] = explode('.', $jwt);
$rawParts = explode('.', $jwt);
if(count($rawParts) !== 3){
throw new VerifyLoginException("Wrong number of JWT parts, expected 3, got " . count($rawParts));
}
[$headB64, $payloadB64, $sigB64] = $rawParts;
$headers = json_decode(base64_decode(strtr($headB64, '-_', '+/'), true), true);
@ -111,7 +115,9 @@ class VerifyLoginTask extends AsyncTask{
//OpenSSL wants a DER-encoded signature, so we extract R and S from the plain signature and crudely serialize it.
assert(strlen($plainSignature) === 96);
if(strlen($plainSignature) !== 96){
throw new VerifyLoginException("Wrong signature length, expected 96, got " . strlen($plainSignature));
}
[$rString, $sString] = str_split($plainSignature, 48);

View File

@ -30,10 +30,11 @@ use pocketmine\network\mcpe\NetworkSession;
class ActorEventPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::ACTOR_EVENT_PACKET;
public const JUMP = 1;
public const HURT_ANIMATION = 2;
public const DEATH_ANIMATION = 3;
public const ARM_SWING = 4;
public const STOP_ATTACK = 5;
public const TAME_FAIL = 6;
public const TAME_SUCCESS = 7;
public const SHAKE_WET = 8;
@ -50,16 +51,18 @@ class ActorEventPacket extends DataPacket{
public const IRON_GOLEM_OFFER_FLOWER = 19;
public const IRON_GOLEM_WITHDRAW_FLOWER = 20;
public const LOVE_PARTICLES = 21; //breeding
public const VILLAGER_ANGRY = 22;
public const VILLAGER_HAPPY = 23;
public const WITCH_SPELL_PARTICLES = 24;
public const FIREWORK_PARTICLES = 25;
public const IN_LOVE_PARTICLES = 26;
public const SILVERFISH_SPAWN_ANIMATION = 27;
public const GUARDIAN_ATTACK = 28;
public const WITCH_DRINK_POTION = 29;
public const WITCH_THROW_POTION = 30;
public const MINECART_TNT_PRIME_FUSE = 31;
public const CREEPER_PRIME_FUSE = 32;
public const AIR_SUPPLY_EXPIRED = 33;
public const PLAYER_ADD_XP_LEVELS = 34;
public const ELDER_GUARDIAN_CURSE = 35;
public const AGENT_ARM_SWING = 36;
@ -79,6 +82,11 @@ class ActorEventPacket extends DataPacket{
public const ENTITY_SPAWN = 67; //used for MinecraftEventing stuff, not needed
public const DRAGON_PUKE = 68; //they call this puke particles
public const ITEM_ENTITY_MERGE = 69;
public const START_SWIM = 70;
public const BALLOON_POP = 71;
public const TREASURE_HUNT = 72;
public const AGENT_SUMMON = 73;
public const CHARGED_CROSSBOW = 74;
//TODO: add more events

View File

@ -28,6 +28,7 @@ namespace pocketmine\network\mcpe\protocol;
use pocketmine\item\Item;
use pocketmine\math\Vector3;
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\types\DeviceOS;
use pocketmine\network\mcpe\protocol\types\EntityLink;
use pocketmine\utils\UUID;
use function count;
@ -84,7 +85,7 @@ class AddPlayerPacket extends DataPacket{
/** @var string */
public $deviceId = ""; //TODO: fill player's device ID (???)
/** @var int */
public $buildPlatform = -1;
public $buildPlatform = DeviceOS::UNKNOWN;
protected function decodePayload(){
$this->uuid = $this->getUUID();

View File

@ -34,6 +34,7 @@ class AnimatePacket extends DataPacket{
public const ACTION_STOP_SLEEP = 3;
public const ACTION_CRITICAL_HIT = 4;
public const ACTION_MAGICAL_CRITICAL_HIT = 5;
public const ACTION_ROW_RIGHT = 128;
public const ACTION_ROW_LEFT = 129;

View File

@ -75,9 +75,7 @@ class AvailableCommandsPacket extends DataPacket{
*/
public const ARG_FLAG_ENUM = 0x200000;
/**
* This is used for /xp <level: int>L. It can only be applied to integer parameters.
*/
/** This is used for /xp <level: int>L. It can only be applied to integer parameters. */
public const ARG_FLAG_POSTFIX = 0x1000000;
public const HARDCODED_ENUM_NAMES = [

View File

@ -25,7 +25,6 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\NetworkBinaryStream;
use pocketmine\network\mcpe\NetworkSession;
use function assert;

View File

@ -39,6 +39,12 @@ abstract class DataPacket extends NetworkBinaryStream{
public const NETWORK_ID = 0;
public const PID_MASK = 0x3ff; //10 bits
private const SUBCLIENT_ID_MASK = 0x03; //2 bits
private const SENDER_SUBCLIENT_ID_SHIFT = 10;
private const RECIPIENT_SUBCLIENT_ID_SHIFT = 12;
/** @var bool */
public $isEncoded = false;
/** @var CachedEncapsulatedPacket|null */
@ -92,10 +98,13 @@ abstract class DataPacket extends NetworkBinaryStream{
* @throws \UnexpectedValueException
*/
protected function decodeHeader(){
$pid = $this->getUnsignedVarInt();
$header = $this->getUnsignedVarInt();
$pid = $header & self::PID_MASK;
if($pid !== static::NETWORK_ID){
throw new \UnexpectedValueException("Expected " . static::NETWORK_ID . " for packet ID, got $pid");
}
$this->senderSubId = ($header >> self::SENDER_SUBCLIENT_ID_SHIFT) & self::SUBCLIENT_ID_MASK;
$this->recipientSubId = ($header >> self::RECIPIENT_SUBCLIENT_ID_SHIFT) & self::SUBCLIENT_ID_MASK;
}
/**
@ -123,7 +132,11 @@ abstract class DataPacket extends NetworkBinaryStream{
* @return void
*/
protected function encodeHeader(){
$this->putUnsignedVarInt(static::NETWORK_ID);
$this->putUnsignedVarInt(
static::NETWORK_ID |
($this->senderSubId << self::SENDER_SUBCLIENT_ID_SHIFT) |
($this->recipientSubId << self::RECIPIENT_SUBCLIENT_ID_SHIFT)
);
}
/**

View File

@ -32,7 +32,7 @@ class InteractPacket extends DataPacket{
public const ACTION_LEAVE_VEHICLE = 3;
public const ACTION_MOUSEOVER = 4;
public const ACTION_OPEN_NPC = 5;
public const ACTION_OPEN_INVENTORY = 6;
/** @var int */

View File

@ -30,8 +30,12 @@ use pocketmine\network\mcpe\NetworkSession;
class LabTablePacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::LAB_TABLE_PACKET;
public const TYPE_START_COMBINE = 0;
public const TYPE_START_REACTION = 1;
public const TYPE_RESET = 2;
/** @var int */
public $uselessByte; //0 for client -> server, 1 for server -> client. Seems useless.
public $type;
/** @var int */
public $x;
@ -44,13 +48,13 @@ class LabTablePacket extends DataPacket{
public $reactionType;
protected function decodePayload(){
$this->uselessByte = $this->getByte();
$this->type = $this->getByte();
$this->getSignedBlockPosition($this->x, $this->y, $this->z);
$this->reactionType = $this->getByte();
}
protected function encodePayload(){
$this->putByte($this->uselessByte);
$this->putByte($this->type);
$this->putSignedBlockPosition($this->x, $this->y, $this->z);
$this->putByte($this->reactionType);
}

View File

@ -27,7 +27,7 @@ namespace pocketmine\network\mcpe\protocol;
use pocketmine\network\mcpe\NetworkSession;
class MultiplayerSettingsPacket extends DataPacket/* implements ServerboundPacket*/{ //TODO: this might be clientbound too, but unsure
class MultiplayerSettingsPacket extends DataPacket/* implements ClientboundPacket, ServerboundPacket*/{
public const NETWORK_ID = ProtocolInfo::MULTIPLAYER_SETTINGS_PACKET;
public const ACTION_ENABLE_MULTIPLAYER = 0;

View File

@ -196,7 +196,7 @@ class PacketPool{
*/
public static function getPacket(string $buffer) : DataPacket{
$offset = 0;
$pk = static::getPacketById(Binary::readUnsignedVarInt($buffer, $offset));
$pk = static::getPacketById(Binary::readUnsignedVarInt($buffer, $offset) & DataPacket::PID_MASK);
$pk->setBuffer($buffer, $offset);
return $pk;

View File

@ -67,6 +67,11 @@ class PlayerListPacket extends DataPacket{
$this->entries[$i] = $entry;
}
if($this->type === self::TYPE_ADD){
for($i = 0; $i < $count; ++$i){
$this->entries[$i]->skinData->setVerified($this->getBool());
}
}
}
protected function encodePayload(){
@ -87,6 +92,11 @@ class PlayerListPacket extends DataPacket{
$this->putUUID($entry->uuid);
}
}
if($this->type === self::TYPE_ADD){
foreach($this->entries as $entry){
$this->putBool($entry->skinData->isVerified());
}
}
}
public function handle(NetworkSession $session) : bool{

View File

@ -46,6 +46,7 @@ class PlayerSkinPacket extends DataPacket{
$this->skin = $this->getSkin();
$this->newSkinName = $this->getString();
$this->oldSkinName = $this->getString();
$this->skin->setVerified($this->getBool());
}
protected function encodePayload(){
@ -53,6 +54,7 @@ class PlayerSkinPacket extends DataPacket{
$this->putSkin($this->skin);
$this->putString($this->newSkinName);
$this->putString($this->oldSkinName);
$this->putBool($this->skin->isVerified());
}
public function handle(NetworkSession $session) : bool{

View File

@ -36,18 +36,12 @@ interface ProtocolInfo{
* This file is generated automatically, do not edit it manually.
*/
/**
* Actual Minecraft: PE protocol version
*/
public const CURRENT_PROTOCOL = 389;
/**
* Current Minecraft PE version reported by the server. This is usually the earliest currently supported version.
*/
public const MINECRAFT_VERSION = 'v1.14.0';
/**
* Version number sent to clients in ping responses.
*/
public const MINECRAFT_VERSION_NETWORK = '1.14.0';
/** Actual Minecraft: PE protocol version */
public const CURRENT_PROTOCOL = 390;
/** Current Minecraft PE version reported by the server. This is usually the earliest currently supported version. */
public const MINECRAFT_VERSION = 'v1.14.60';
/** Version number sent to clients in ping responses. */
public const MINECRAFT_VERSION_NETWORK = '1.14.60';
public const LOGIN_PACKET = 0x01;
public const PLAY_STATUS_PACKET = 0x02;

View File

@ -26,16 +26,32 @@ namespace pocketmine\network\mcpe\protocol;
#include <rules/DataPacket.h>
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\types\StructureEditorData;
class StructureBlockUpdatePacket extends DataPacket{
class StructureBlockUpdatePacket extends DataPacket/* implements ServerboundPacket*/{
public const NETWORK_ID = ProtocolInfo::STRUCTURE_BLOCK_UPDATE_PACKET;
/** @var int */
public $x;
/** @var int */
public $y;
/** @var int */
public $z;
/** @var StructureEditorData */
public $structureEditorData;
/** @var bool */
public $isPowered;
protected function decodePayload(){
//TODO
$this->getBlockPosition($this->x, $this->y, $this->z);
$this->structureEditorData = $this->getStructureEditorData();
$this->isPowered = $this->getBool();
}
protected function encodePayload(){
//TODO
$this->putBlockPosition($this->x, $this->y, $this->z);
$this->putStructureEditorData($this->structureEditorData);
$this->putBool($this->isPowered);
}
public function handle(NetworkSession $session) : bool{

View File

@ -35,7 +35,7 @@ class UpdateEquipPacket extends DataPacket{
/** @var int */
public $windowType;
/** @var int */
public $unknownVarint; //TODO: find out what this is (vanilla always sends 0)
public $windowSlotCount; //useless, seems to be part of a standard container header
/** @var int */
public $entityUniqueId;
/** @var string */
@ -44,7 +44,7 @@ class UpdateEquipPacket extends DataPacket{
protected function decodePayload(){
$this->windowId = $this->getByte();
$this->windowType = $this->getByte();
$this->unknownVarint = $this->getVarInt();
$this->windowSlotCount = $this->getVarInt();
$this->entityUniqueId = $this->getEntityUniqueId();
$this->namedtag = $this->getRemaining();
}
@ -52,7 +52,7 @@ class UpdateEquipPacket extends DataPacket{
protected function encodePayload(){
$this->putByte($this->windowId);
$this->putByte($this->windowType);
$this->putVarInt($this->unknownVarint);
$this->putVarInt($this->windowSlotCount);
$this->putEntityUniqueId($this->entityUniqueId);
$this->put($this->namedtag);
}

View File

@ -38,7 +38,7 @@ class UpdateTradePacket extends DataPacket{
/** @var int */
public $windowType = WindowTypes::TRADING; //Mojang hardcoded this -_-
/** @var int */
public $thisIsAlwaysZero = 0; //hardcoded to 0
public $windowSlotCount = 0; //useless, seems to be part of a standard container header
/** @var int */
public $tradeTier;
/** @var int */
@ -48,35 +48,35 @@ class UpdateTradePacket extends DataPacket{
/** @var string */
public $displayName;
/** @var bool */
public $isWilling;
/** @var bool */
public $isV2Trading;
/** @var bool */
public $isWilling;
/** @var string */
public $offers;
protected function decodePayload(){
$this->windowId = $this->getByte();
$this->windowType = $this->getByte();
$this->thisIsAlwaysZero = $this->getVarInt();
$this->windowSlotCount = $this->getVarInt();
$this->tradeTier = $this->getVarInt();
$this->traderEid = $this->getEntityUniqueId();
$this->playerEid = $this->getEntityUniqueId();
$this->displayName = $this->getString();
$this->isWilling = $this->getBool();
$this->isV2Trading = $this->getBool();
$this->isWilling = $this->getBool();
$this->offers = $this->getRemaining();
}
protected function encodePayload(){
$this->putByte($this->windowId);
$this->putByte($this->windowType);
$this->putVarInt($this->thisIsAlwaysZero);
$this->putVarInt($this->windowSlotCount);
$this->putVarInt($this->tradeTier);
$this->putEntityUniqueId($this->traderEid);
$this->putEntityUniqueId($this->playerEid);
$this->putString($this->displayName);
$this->putBool($this->isWilling);
$this->putBool($this->isV2Trading);
$this->putBool($this->isWilling);
$this->put($this->offers);
}

View File

@ -0,0 +1,44 @@
<?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 DeviceOS{
public const UNKNOWN = -1;
public const ANDROID = 1;
public const IOS = 2;
public const OSX = 3;
public const AMAZON = 4;
public const GEAR_VR = 5;
public const HOLOLENS = 6;
public const WINDOWS_10 = 7;
public const WIN32 = 8;
public const DEDICATED = 9;
public const TVOS = 10;
public const PLAYSTATION = 11;
public const NINTENDO = 12;
public const XBOX = 13;
public const WINDOWS_PHONE = 14;
}

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\types;
final class PersonaPieceTintColor{
public const PIECE_TYPE_PERSONA_EYES = "persona_eyes";
public const PIECE_TYPE_PERSONA_HAIR = "persona_hair";
public const PIECE_TYPE_PERSONA_MOUTH = "persona_mouth";
/** @var string */
private $pieceType;
/** @var string[] */
private $colors;
/**
* @param string[] $colors
*/
public function __construct(string $pieceType, array $colors){
$this->pieceType = $pieceType;
$this->colors = $colors;
}
public function getPieceType() : string{
return $this->pieceType;
}
/**
* @return string[]
*/
public function getColors() : array{
return $this->colors;
}
}

View File

@ -0,0 +1,77 @@
<?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 PersonaSkinPiece{
public const PIECE_TYPE_PERSONA_BODY = "persona_body";
public const PIECE_TYPE_PERSONA_BOTTOM = "persona_bottom";
public const PIECE_TYPE_PERSONA_EYES = "persona_eyes";
public const PIECE_TYPE_PERSONA_FACIAL_HAIR = "persona_facial_hair";
public const PIECE_TYPE_PERSONA_FEET = "persona_feet";
public const PIECE_TYPE_PERSONA_HAIR = "persona_hair";
public const PIECE_TYPE_PERSONA_MOUTH = "persona_mouth";
public const PIECE_TYPE_PERSONA_SKELETON = "persona_skeleton";
public const PIECE_TYPE_PERSONA_SKIN = "persona_skin";
public const PIECE_TYPE_PERSONA_TOP = "persona_top";
/** @var string */
private $pieceId;
/** @var string */
private $pieceType;
/** @var string */
private $packId;
/** @var bool */
private $isDefaultPiece;
/** @var string */
private $productId;
public function __construct(string $pieceId, string $pieceType, string $packId, bool $isDefaultPiece, string $productId){
$this->pieceId = $pieceId;
$this->pieceType = $pieceType;
$this->packId = $packId;
$this->isDefaultPiece = $isDefaultPiece;
$this->productId = $productId;
}
public function getPieceId() : string{
return $this->pieceId;
}
public function getPieceType() : string{
return $this->pieceType;
}
public function getPackId() : string{
return $this->packId;
}
public function isDefaultPiece() : bool{
return $this->isDefaultPiece;
}
public function getProductId() : string{
return $this->productId;
}
}

View File

@ -40,7 +40,7 @@ class PlayerListEntry{
/** @var string */
public $platformChatId = "";
/** @var int */
public $buildPlatform = -1;
public $buildPlatform = DeviceOS::UNKNOWN;
/** @var bool */
public $isTeacher = false;
/** @var bool */

View File

@ -23,8 +23,13 @@ declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol\types;
use pocketmine\utils\UUID;
class SkinData{
public const ARM_SIZE_SLIM = "slim";
public const ARM_SIZE_WIDE = "wide";
/** @var string */
private $skinId;
/** @var string */
@ -47,11 +52,25 @@ class SkinData{
private $personaCapeOnClassic;
/** @var string */
private $capeId;
/** @var string */
private $fullSkinId;
/** @var string */
private $armSize;
/** @var string */
private $skinColor;
/** @var PersonaSkinPiece[] */
private $personaPieces;
/** @var PersonaPieceTintColor[] */
private $pieceTintColors;
/** @var bool */
private $isVerified;
/**
* @param SkinAnimation[] $animations
* @param SkinAnimation[] $animations
* @param PersonaSkinPiece[] $personaPieces
* @param PersonaPieceTintColor[] $pieceTintColors
*/
public function __construct(string $skinId, string $resourcePatch, SkinImage $skinImage, array $animations = [], SkinImage $capeImage = null, string $geometryData = "", string $animationData = "", bool $premium = false, bool $persona = false, bool $personaCapeOnClassic = false, string $capeId = ""){
public function __construct(string $skinId, 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 = false){
$this->skinId = $skinId;
$this->resourcePatch = $resourcePatch;
$this->skinImage = $skinImage;
@ -63,6 +82,13 @@ class SkinData{
$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();
$this->armSize = $armSize;
$this->skinColor = $skinColor;
$this->personaPieces = $personaPieces;
$this->pieceTintColors = $pieceTintColors;
$this->isVerified = $isVerified;
}
public function getSkinId() : string{
@ -112,4 +138,40 @@ class SkinData{
return $this->capeId;
}
public function getFullSkinId() : string{
return $this->fullSkinId;
}
public function getArmSize() : string{
return $this->armSize;
}
public function getSkinColor() : string{
return $this->skinColor;
}
/**
* @return PersonaSkinPiece[]
*/
public function getPersonaPieces() : array{
return $this->personaPieces;
}
/**
* @return PersonaPieceTintColor[]
*/
public function getPieceTintColors() : array{
return $this->pieceTintColors;
}
public function isVerified() : bool{
return $this->isVerified;
}
/**
* @internal
*/
public function setVerified(bool $verified) : void{
$this->isVerified = $verified;
}
}

View File

@ -49,11 +49,11 @@ class SkinImage{
public static function fromLegacy(string $data) : SkinImage{
switch(strlen($data)){
case 64 * 32 * 4:
return new self(64, 32, $data);
return new self(32, 64, $data);
case 64 * 64 * 4:
return new self(64, 64, $data);
case 128 * 64 * 4:
return new self(128, 64, $data);
return new self(64, 128, $data);
case 128 * 128 * 4:
return new self(128, 128, $data);
}

View File

@ -0,0 +1,48 @@
<?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;
class StructureEditorData{
public const TYPE_DATA = 0;
public const TYPE_SAVE = 1;
public const TYPE_LOAD = 2;
public const TYPE_CORNER = 3;
public const TYPE_INVALID = 4;
public const TYPE_EXPORT = 5;
/** @var string */
public $structureName;
/** @var string */
public $structureDataField;
/** @var bool */
public $includePlayers;
/** @var bool */
public $showBoundingBox;
/** @var int */
public $structureBlockType;
/** @var StructureSettings */
public $structureSettings;
/** @var int */
public $structureRedstoneSaveMove;
}

View File

@ -23,6 +23,8 @@ declare(strict_types=1);
namespace pocketmine\network\mcpe\protocol\types;
use pocketmine\math\Vector3;
class StructureSettings{
/** @var string */
public $paletteName;
@ -52,4 +54,6 @@ class StructureSettings{
public $integrityValue;
/** @var int */
public $integritySeed;
/** @var Vector3 */
public $pivot;
}

View File

@ -41,14 +41,17 @@ use function socket_getsockname;
use function socket_last_error;
use function socket_listen;
use function socket_set_block;
use function socket_set_option;
use function socket_strerror;
use function socket_write;
use function trim;
use const AF_INET;
use const AF_UNIX;
use const SO_REUSEADDR;
use const SOCK_STREAM;
use const SOCKET_ENOPROTOOPT;
use const SOCKET_EPROTONOSUPPORT;
use const SOL_SOCKET;
use const SOL_TCP;
class RCON{
@ -74,6 +77,10 @@ class RCON{
$this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if(!socket_set_option($this->socket, SOL_SOCKET, SO_REUSEADDR, 1)){
throw new \RuntimeException("Unable to set option on socket: " . trim(socket_strerror(socket_last_error())));
}
if($this->socket === false or !@socket_bind($this->socket, $interface, $port) or !@socket_listen($this->socket, 5)){
throw new \RuntimeException(trim(socket_strerror(socket_last_error())));
}

View File

@ -116,7 +116,7 @@ class PermissionManager{
$this->defaultPerms[$permission->getName()] = $permission;
$this->dirtyPermissibles(false);
}
Timings::$permissionDefaultTimer->startTiming();
Timings::$permissionDefaultTimer->stopTiming();
}
private function dirtyPermissibles(bool $op) : void{

View File

@ -89,7 +89,6 @@ class PluginDescription{
/**
* @param string|mixed[] $yamlString
* @phpstan-param string|array<string, mixed> $yamlString
*/
public function __construct($yamlString){
$this->loadMap(!is_array($yamlString) ? yaml_parse($yamlString) : $yamlString);
@ -97,7 +96,6 @@ class PluginDescription{
/**
* @param mixed[] $plugin
* @phpstan-param array<string, mixed> $plugin
* @throws PluginException
*/
private function loadMap(array $plugin) : void{

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\resourcepacks;
use Ahc\Json\Comment as CommentedJsonDecoder;
use function assert;
use function count;
use function fclose;
use function feof;
@ -35,6 +36,8 @@ use function fseek;
use function gettype;
use function hash_file;
use function implode;
use function preg_match;
use function strlen;
class ZippedResourcePack implements ResourcePack{
@ -85,7 +88,22 @@ class ZippedResourcePack implements ResourcePack{
}
if(($manifestData = $archive->getFromName("manifest.json")) === false){
if($archive->locateName("pack_manifest.json") !== false){
$manifestPath = null;
$manifestIdx = null;
for($i = 0; $i < $archive->numFiles; ++$i){
$name = $archive->getNameIndex($i);
if(
($manifestPath === null or strlen($name) < strlen($manifestPath)) and
preg_match('#.*/manifest.json$#', $name) === 1
){
$manifestPath = $name;
$manifestIdx = $i;
}
}
if($manifestIdx !== null){
$manifestData = $archive->getFromIndex($manifestIdx);
assert($manifestData !== false);
}elseif($archive->locateName("pack_manifest.json") !== false){
throw new ResourcePackException("Unsupported old pack format");
}else{
throw new ResourcePackException("manifest.json not found in the archive root");

View File

@ -36,7 +36,7 @@ class TaskScheduler{
/** @var bool */
private $enabled = true;
/** @var ReversePriorityQueue<Task> */
/** @var ReversePriorityQueue<TaskHandler> */
protected $queue;
/** @var TaskHandler[] */

View File

@ -662,7 +662,11 @@ class Utils{
* @return string[] an array of tagName => tag value. If the tag has no value, an empty string is used as the value.
*/
public static function parseDocComment(string $docComment) : array{
preg_match_all('/(*ANYCRLF)^[\t ]*\* @([a-zA-Z]+)(?:[\t ]+(.+))?[\t ]*$/m', $docComment, $matches);
$rawDocComment = substr($docComment, 3, -2); //remove the opening and closing markers
if($rawDocComment === false){ //usually empty doc comment, but this is safer and statically analysable
return [];
}
preg_match_all('/(*ANYCRLF)^[\t ]*(?:\* )?@([a-zA-Z]+)(?:[\t ]+(.+?))?[\t ]*$/m', $rawDocComment, $matches);
return array_combine($matches[1], $matches[2]);
}

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
DIR="$(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
cd "$DIR"

View File

@ -21,4 +21,12 @@
declare(strict_types=1);
define('pocketmine\_PHPSTAN_ANALYSIS', true);
define('pocketmine\_PHPSTAN_ANALYSIS', true);
//TODO: these need to be defined properly or removed
define('pocketmine\COMPOSER_AUTOLOADER_PATH', dirname(__DIR__, 2) . '/vendor/autoload.php');
define('pocketmine\DATA', '');
define('pocketmine\GIT_COMMIT', str_repeat('00', 20));
define('pocketmine\PLUGIN_PATH', '');
define('pocketmine\START_TIME', microtime(true));
define('pocketmine\VERSION', '9.9.9');

View File

@ -0,0 +1,792 @@
parameters:
ignoreErrors:
-
message: "#^Instanceof between pocketmine\\\\plugin\\\\PluginManager and pocketmine\\\\plugin\\\\PluginManager will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/CrashDump.php
-
message: "#^pocketmine\\\\Player\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\entity\\\\Human\\.$#"
count: 1
path: ../../../src/pocketmine/Player.php
-
message: "#^Cannot instantiate interface pocketmine\\\\level\\\\format\\\\io\\\\LevelProvider\\.$#"
count: 1
path: ../../../src/pocketmine/Server.php
-
message: "#^Instanceof between pocketmine\\\\plugin\\\\PluginManager and pocketmine\\\\plugin\\\\PluginManager will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/Server.php
-
message: "#^Instanceof between pocketmine\\\\scheduler\\\\AsyncPool and pocketmine\\\\scheduler\\\\AsyncPool will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/Server.php
-
message: "#^Instanceof between pocketmine\\\\command\\\\CommandReader and pocketmine\\\\command\\\\CommandReader will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/Server.php
-
message: "#^Instanceof between pocketmine\\\\network\\\\Network and pocketmine\\\\network\\\\Network will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/Server.php
-
message: "#^pocketmine\\\\block\\\\Air\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Air.php
-
message: "#^pocketmine\\\\block\\\\Anvil\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Anvil.php
-
message: "#^pocketmine\\\\block\\\\BaseRail\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/BaseRail.php
-
message: "#^pocketmine\\\\block\\\\Bed\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Bed.php
-
message: "#^pocketmine\\\\block\\\\Bedrock\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Bedrock.php
-
message: "#^pocketmine\\\\block\\\\Beetroot\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Beetroot.php
-
message: "#^pocketmine\\\\block\\\\Block\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\level\\\\Position\\.$#"
count: 1
path: ../../../src/pocketmine/block/Block.php
-
message: "#^pocketmine\\\\block\\\\BoneBlock\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/BoneBlock.php
-
message: "#^pocketmine\\\\block\\\\Bookshelf\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Bookshelf.php
-
message: "#^pocketmine\\\\block\\\\BrewingStand\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/BrewingStand.php
-
message: "#^pocketmine\\\\block\\\\BrickStairs\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/BrickStairs.php
-
message: "#^pocketmine\\\\block\\\\Bricks\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Bricks.php
-
message: "#^pocketmine\\\\block\\\\BurningFurnace\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/BurningFurnace.php
-
message: "#^pocketmine\\\\block\\\\Button\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Button.php
-
message: "#^pocketmine\\\\block\\\\Cactus\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Cactus.php
-
message: "#^pocketmine\\\\block\\\\Cake\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Cake.php
-
message: "#^pocketmine\\\\block\\\\Carpet\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Carpet.php
-
message: "#^pocketmine\\\\block\\\\Carrot\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Carrot.php
-
message: "#^pocketmine\\\\block\\\\Chest\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Chest.php
-
message: "#^pocketmine\\\\block\\\\Clay\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Clay.php
-
message: "#^pocketmine\\\\block\\\\Coal\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Coal.php
-
message: "#^pocketmine\\\\block\\\\CoalOre\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/CoalOre.php
-
message: "#^pocketmine\\\\block\\\\Cobblestone\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Cobblestone.php
-
message: "#^pocketmine\\\\block\\\\CobblestoneStairs\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/CobblestoneStairs.php
-
message: "#^pocketmine\\\\block\\\\CobblestoneWall\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/CobblestoneWall.php
-
message: "#^pocketmine\\\\block\\\\Cobweb\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Cobweb.php
-
message: "#^pocketmine\\\\block\\\\CocoaBlock\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/CocoaBlock.php
-
message: "#^pocketmine\\\\block\\\\Concrete\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Concrete.php
-
message: "#^pocketmine\\\\block\\\\ConcretePowder\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/ConcretePowder.php
-
message: "#^pocketmine\\\\block\\\\CraftingTable\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/CraftingTable.php
-
message: "#^pocketmine\\\\block\\\\Dandelion\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Dandelion.php
-
message: "#^pocketmine\\\\block\\\\DaylightSensor\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/DaylightSensor.php
-
message: "#^pocketmine\\\\block\\\\DeadBush\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/DeadBush.php
-
message: "#^pocketmine\\\\block\\\\Diamond\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Diamond.php
-
message: "#^pocketmine\\\\block\\\\DiamondOre\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/DiamondOre.php
-
message: "#^pocketmine\\\\block\\\\Dirt\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Dirt.php
-
message: "#^pocketmine\\\\block\\\\DoublePlant\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/DoublePlant.php
-
message: "#^pocketmine\\\\block\\\\DoubleSlab\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/DoubleSlab.php
-
message: "#^pocketmine\\\\block\\\\Emerald\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Emerald.php
-
message: "#^pocketmine\\\\block\\\\EmeraldOre\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/EmeraldOre.php
-
message: "#^pocketmine\\\\block\\\\EnchantingTable\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/EnchantingTable.php
-
message: "#^pocketmine\\\\block\\\\EndPortalFrame\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/EndPortalFrame.php
-
message: "#^pocketmine\\\\block\\\\EndRod\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/EndRod.php
-
message: "#^pocketmine\\\\block\\\\EndStone\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/EndStone.php
-
message: "#^pocketmine\\\\block\\\\EndStoneBricks\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/EndStoneBricks.php
-
message: "#^pocketmine\\\\block\\\\Farmland\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Farmland.php
-
message: "#^pocketmine\\\\block\\\\Fence\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Fence.php
-
message: "#^pocketmine\\\\block\\\\Fire\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Fire.php
-
message: "#^pocketmine\\\\block\\\\Flower\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Flower.php
-
message: "#^pocketmine\\\\block\\\\FlowerPot\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/FlowerPot.php
-
message: "#^pocketmine\\\\block\\\\Glass\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Glass.php
-
message: "#^pocketmine\\\\block\\\\GlassPane\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/GlassPane.php
-
message: "#^pocketmine\\\\block\\\\GlowingObsidian\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/GlowingObsidian.php
-
message: "#^pocketmine\\\\block\\\\Glowstone\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Glowstone.php
-
message: "#^pocketmine\\\\block\\\\Gold\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Gold.php
-
message: "#^pocketmine\\\\block\\\\GoldOre\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/GoldOre.php
-
message: "#^pocketmine\\\\block\\\\Grass\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Grass.php
-
message: "#^pocketmine\\\\block\\\\GrassPath\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/GrassPath.php
-
message: "#^pocketmine\\\\block\\\\Gravel\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Gravel.php
-
message: "#^pocketmine\\\\block\\\\HardenedClay\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/HardenedClay.php
-
message: "#^pocketmine\\\\block\\\\HayBale\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/HayBale.php
-
message: "#^pocketmine\\\\block\\\\Ice\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Ice.php
-
message: "#^pocketmine\\\\block\\\\InvisibleBedrock\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/InvisibleBedrock.php
-
message: "#^pocketmine\\\\block\\\\Iron\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Iron.php
-
message: "#^pocketmine\\\\block\\\\IronBars\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/IronBars.php
-
message: "#^pocketmine\\\\block\\\\IronDoor\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/IronDoor.php
-
message: "#^pocketmine\\\\block\\\\IronOre\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/IronOre.php
-
message: "#^pocketmine\\\\block\\\\ItemFrame\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/ItemFrame.php
-
message: "#^pocketmine\\\\block\\\\Ladder\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Ladder.php
-
message: "#^pocketmine\\\\block\\\\Lapis\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Lapis.php
-
message: "#^pocketmine\\\\block\\\\LapisOre\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/LapisOre.php
-
message: "#^pocketmine\\\\block\\\\Lava\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Lava.php
-
message: "#^pocketmine\\\\block\\\\Leaves\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Leaves.php
-
message: "#^pocketmine\\\\block\\\\Lever\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Lever.php
-
message: "#^pocketmine\\\\block\\\\Magma\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Magma.php
-
message: "#^pocketmine\\\\block\\\\Melon\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Melon.php
-
message: "#^pocketmine\\\\block\\\\MelonStem\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/MelonStem.php
-
message: "#^pocketmine\\\\block\\\\MonsterSpawner\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/MonsterSpawner.php
-
message: "#^pocketmine\\\\block\\\\Mycelium\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Mycelium.php
-
message: "#^pocketmine\\\\block\\\\NetherBrickStairs\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/NetherBrickStairs.php
-
message: "#^pocketmine\\\\block\\\\NetherQuartzOre\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/NetherQuartzOre.php
-
message: "#^pocketmine\\\\block\\\\NetherReactor\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/NetherReactor.php
-
message: "#^pocketmine\\\\block\\\\NetherWartBlock\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/NetherWartBlock.php
-
message: "#^pocketmine\\\\block\\\\NetherWartPlant\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/NetherWartPlant.php
-
message: "#^pocketmine\\\\block\\\\Netherrack\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Netherrack.php
-
message: "#^pocketmine\\\\block\\\\NoteBlock\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/NoteBlock.php
-
message: "#^pocketmine\\\\block\\\\Obsidian\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Obsidian.php
-
message: "#^pocketmine\\\\block\\\\PackedIce\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/PackedIce.php
-
message: "#^pocketmine\\\\block\\\\Planks\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Planks.php
-
message: "#^pocketmine\\\\block\\\\Podzol\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Podzol.php
-
message: "#^pocketmine\\\\block\\\\Potato\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Potato.php
-
message: "#^pocketmine\\\\block\\\\Prismarine\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Prismarine.php
-
message: "#^pocketmine\\\\block\\\\Pumpkin\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Pumpkin.php
-
message: "#^pocketmine\\\\block\\\\PumpkinStem\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/PumpkinStem.php
-
message: "#^pocketmine\\\\block\\\\PurpurStairs\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/PurpurStairs.php
-
message: "#^pocketmine\\\\block\\\\Quartz\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Quartz.php
-
message: "#^pocketmine\\\\block\\\\QuartzStairs\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/QuartzStairs.php
-
message: "#^pocketmine\\\\block\\\\RedMushroom\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/RedMushroom.php
-
message: "#^pocketmine\\\\block\\\\RedMushroomBlock\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/RedMushroomBlock.php
-
message: "#^pocketmine\\\\block\\\\Redstone\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Redstone.php
-
message: "#^pocketmine\\\\block\\\\RedstoneLamp\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/RedstoneLamp.php
-
message: "#^pocketmine\\\\block\\\\RedstoneOre\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/RedstoneOre.php
-
message: "#^pocketmine\\\\block\\\\Sand\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Sand.php
-
message: "#^pocketmine\\\\block\\\\Sandstone\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Sandstone.php
-
message: "#^pocketmine\\\\block\\\\SandstoneStairs\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/SandstoneStairs.php
-
message: "#^pocketmine\\\\block\\\\Sapling\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Sapling.php
-
message: "#^pocketmine\\\\block\\\\SeaLantern\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/SeaLantern.php
-
message: "#^pocketmine\\\\block\\\\SignPost\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/SignPost.php
-
message: "#^pocketmine\\\\block\\\\Skull\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Skull.php
-
message: "#^pocketmine\\\\block\\\\Slab\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Slab.php
-
message: "#^pocketmine\\\\block\\\\Snow\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Snow.php
-
message: "#^pocketmine\\\\block\\\\SnowLayer\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/SnowLayer.php
-
message: "#^pocketmine\\\\block\\\\SoulSand\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/SoulSand.php
-
message: "#^pocketmine\\\\block\\\\Sponge\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Sponge.php
-
message: "#^pocketmine\\\\block\\\\StandingBanner\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/StandingBanner.php
-
message: "#^pocketmine\\\\block\\\\Stone\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Stone.php
-
message: "#^pocketmine\\\\block\\\\StoneBrickStairs\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/StoneBrickStairs.php
-
message: "#^pocketmine\\\\block\\\\StoneBricks\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/StoneBricks.php
-
message: "#^pocketmine\\\\block\\\\StonePressurePlate\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/StonePressurePlate.php
-
message: "#^pocketmine\\\\block\\\\Stonecutter\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Stonecutter.php
-
message: "#^pocketmine\\\\block\\\\Sugarcane\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Sugarcane.php
-
message: "#^pocketmine\\\\block\\\\TNT\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/TNT.php
-
message: "#^pocketmine\\\\block\\\\TallGrass\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/TallGrass.php
-
message: "#^pocketmine\\\\block\\\\Torch\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Torch.php
-
message: "#^pocketmine\\\\block\\\\Trapdoor\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Trapdoor.php
-
message: "#^pocketmine\\\\block\\\\Tripwire\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Tripwire.php
-
message: "#^pocketmine\\\\block\\\\TripwireHook\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/TripwireHook.php
-
message: "#^pocketmine\\\\block\\\\Vine\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Vine.php
-
message: "#^pocketmine\\\\block\\\\Water\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Water.php
-
message: "#^pocketmine\\\\block\\\\WaterLily\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/WaterLily.php
-
message: "#^pocketmine\\\\block\\\\WeightedPressurePlateLight\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/WeightedPressurePlateLight.php
-
message: "#^pocketmine\\\\block\\\\Wheat\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Wheat.php
-
message: "#^pocketmine\\\\block\\\\Wood\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Wood.php
-
message: "#^pocketmine\\\\block\\\\Wool\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
count: 1
path: ../../../src/pocketmine/block/Wool.php
-
message: "#^Call to an undefined method pocketmine\\\\command\\\\CommandSender\\:\\:teleport\\(\\)\\.$#"
count: 1
path: ../../../src/pocketmine/command/defaults/TeleportCommand.php
-
message: "#^Method pocketmine\\\\event\\\\entity\\\\EntityDeathEvent\\:\\:getEntity\\(\\) should return pocketmine\\\\entity\\\\Living but returns pocketmine\\\\entity\\\\Entity\\.$#"
count: 1
path: ../../../src/pocketmine/event/entity/EntityDeathEvent.php
-
message: "#^Method pocketmine\\\\event\\\\entity\\\\EntityShootBowEvent\\:\\:getEntity\\(\\) should return pocketmine\\\\entity\\\\Living but returns pocketmine\\\\entity\\\\Entity\\.$#"
count: 1
path: ../../../src/pocketmine/event/entity/EntityShootBowEvent.php
-
message: "#^Property pocketmine\\\\event\\\\entity\\\\EntityShootBowEvent\\:\\:\\$projectile \\(pocketmine\\\\entity\\\\projectile\\\\Projectile\\) does not accept pocketmine\\\\entity\\\\Entity\\.$#"
count: 1
path: ../../../src/pocketmine/event/entity/EntityShootBowEvent.php
-
message: "#^Method pocketmine\\\\event\\\\entity\\\\ItemDespawnEvent\\:\\:getEntity\\(\\) should return pocketmine\\\\entity\\\\object\\\\ItemEntity but returns pocketmine\\\\entity\\\\Entity\\.$#"
count: 1
path: ../../../src/pocketmine/event/entity/ItemDespawnEvent.php
-
message: "#^Method pocketmine\\\\event\\\\entity\\\\ItemSpawnEvent\\:\\:getEntity\\(\\) should return pocketmine\\\\entity\\\\object\\\\ItemEntity but returns pocketmine\\\\entity\\\\Entity\\.$#"
count: 1
path: ../../../src/pocketmine/event/entity/ItemSpawnEvent.php
-
message: "#^Method pocketmine\\\\event\\\\entity\\\\ProjectileHitEvent\\:\\:getEntity\\(\\) should return pocketmine\\\\entity\\\\projectile\\\\Projectile but returns pocketmine\\\\entity\\\\Entity\\.$#"
count: 1
path: ../../../src/pocketmine/event/entity/ProjectileHitEvent.php
-
message: "#^Method pocketmine\\\\event\\\\entity\\\\ProjectileLaunchEvent\\:\\:getEntity\\(\\) should return pocketmine\\\\entity\\\\projectile\\\\Projectile but returns pocketmine\\\\entity\\\\Entity\\.$#"
count: 1
path: ../../../src/pocketmine/event/entity/ProjectileLaunchEvent.php
-
message: "#^pocketmine\\\\inventory\\\\DoubleChestInventory\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\inventory\\\\ChestInventory\\.$#"
count: 1
path: ../../../src/pocketmine/inventory/DoubleChestInventory.php
-
message: "#^pocketmine\\\\inventory\\\\EnderChestInventory\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\inventory\\\\ChestInventory\\.$#"
count: 1
path: ../../../src/pocketmine/inventory/EnderChestInventory.php
-
message: "#^pocketmine\\\\item\\\\GoldenAppleEnchanted\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\item\\\\GoldenApple\\.$#"
count: 1
path: ../../../src/pocketmine/item/GoldenAppleEnchanted.php
-
message: "#^pocketmine\\\\item\\\\WrittenBook\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\item\\\\WritableBook\\.$#"
count: 1
path: ../../../src/pocketmine/item/WrittenBook.php
-
message: "#^Variable property access on \\$this\\(pocketmine\\\\level\\\\generator\\\\PopulationTask\\)\\.$#"
count: 4
path: ../../../src/pocketmine/level/generator/PopulationTask.php
-
message: "#^Constructor of class pocketmine\\\\level\\\\generator\\\\hell\\\\Nether has an unused parameter \\$options\\.$#"
count: 1
path: ../../../src/pocketmine/level/generator/hell/Nether.php
-
message: "#^Constructor of class pocketmine\\\\level\\\\generator\\\\normal\\\\Normal has an unused parameter \\$options\\.$#"
count: 1
path: ../../../src/pocketmine/level/generator/normal/Normal.php
-
message: "#^Variable method call on pocketmine\\\\event\\\\Listener\\.$#"
count: 1
path: ../../../src/pocketmine/plugin/MethodEventExecutor.php
-
message: "#^Constructor of class pocketmine\\\\scheduler\\\\TaskScheduler has an unused parameter \\$logger\\.$#"
count: 1
path: ../../../src/pocketmine/scheduler/TaskScheduler.php

View File

@ -1,6 +1,3 @@
#cyclic refs in lots of objects prevent GC, causing increased memory pressure
#the proper fix is to not have cycles, but in the meantime we have these hacks
parameters:
ignoreErrors:
-

View File

@ -1,3 +1,7 @@
parameters:
ignoreErrors:
- "#^Method ReflectionMethod\\:\\:getClosure\\(\\) invoked with 0 parameters, 1 required\\.$#"
-
message: "#^Method ReflectionMethod\\:\\:getClosure\\(\\) invoked with 0 parameters, 1 required\\.$#"
count: 1
path: ../../phpunit/network/mcpe/StupidJsonDecodeTest.php

View File

@ -1,55 +1,42 @@
parameters:
ignoreErrors:
- "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#"
-
message: "#^Default value of the parameter \\#\\d+ \\$[A-Za-z\\d_]+ \\(\\-?\\d+\\) of method .+\\(\\) is incompatible with type float\\.$#"
path: ../../../src
-
message: "#^Offset string does not exist on array\\(\\)\\.$#"
count: 3
path: ../../../src/pocketmine/MemoryManager.php
-
message: "#^Offset \\(int\\|string\\) does not exist on array\\(\\)\\.$#"
count: 1
path: ../../../src/pocketmine/MemoryManager.php
-
message: "#^Comparison operation \"\\>\\=\" between 0 and 2 is always false\\.$#"
count: 1
path: ../../../src/pocketmine/block/Liquid.php
-
#adjacentSources comparison FP
message: "#^If condition is always false\\.$#"
count: 1
path: ../../../src/pocketmine/block/Liquid.php
-
#readline() may return false
message: "#^Strict comparison using \\!\\=\\= between string and false will always evaluate to true\\.$#"
count: 1
message: "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#"
count: 3
path: ../../../src/pocketmine/command/CommandReader.php
-
#generics corruption, this might show up in other forms too
message: "#^Parameter \\#1 \\$offset \\(int\\) of method pocketmine\\\\entity\\\\AttributeMap\\:\\:offsetGet\\(\\) should be contravariant with parameter \\$offset \\(mixed\\) of method ArrayAccess\\<int,float\\>\\:\\:offsetGet\\(\\)$#"
count: 1
path: ../../../src/pocketmine/entity/AttributeMap.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: "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#"
count: 2
path: ../../../src/pocketmine/level/format/io/region/RegionLoader.php
-
message: "#^Call to function method_exists\\(\\) with pocketmine\\\\network\\\\mcpe\\\\CachedEncapsulatedPacket and '__toString' will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/network/mcpe/protocol/DataPacket.php
-
#phpstan doesn't understand that SplFixedArray may contain null
message: "#^Strict comparison using \\=\\=\\= between string and false will always evaluate to false\\.$#"
count: 1
path: ../../../src/pocketmine/utils/Utils.php
-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNotNull\\(\\) with int and string will always evaluate to true\\.$#"
count: 1
path: ../../../tests/phpunit/block/BlockTest.php
path: ../../phpunit/block/BlockTest.php

View File

@ -4,3 +4,4 @@ parameters:
message: "#^Parameter \\#1 \\$class of static method pocketmine\\\\level\\\\format\\\\io\\\\LevelProviderManager\\:\\:addProvider\\(\\) expects class\\-string\\<pocketmine\\\\level\\\\format\\\\io\\\\LevelProvider\\>, string given\\.$#"
count: 2
path: ../../phpunit/level/format/io/LevelProviderManagerTest.php

View File

@ -2,5 +2,6 @@ parameters:
ignoreErrors:
-
message: "#^Variable \\$GLOBALS in isset\\(\\) always exists and is not nullable\\.$#"
count: 1
path: ../../../src/pocketmine/MemoryManager.php

View File

@ -1,12 +1,11 @@
parameters:
ignoreErrors:
-
message: "#^Call to function is_subclass_of\\(\\) with class\\-string\\<pocketmine\\\\level\\\\generator\\\\Generator\\> and 'pocketmine\\\\\\\\level' will always evaluate to true\\.$#"
message: "#^Call to function is_subclass_of\\(\\) with class\\-string\\<pocketmine\\\\level\\\\generator\\\\Generator\\> and 'pocketmine\\\\\\\\level\\\\\\\\generator\\\\\\\\Generator' will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/Server.php
-
#::add() / ::remove() thread parameter
message: "#^If condition is always true\\.$#"
count: 2
path: ../../../src/pocketmine/ThreadManager.php
@ -22,38 +21,29 @@ parameters:
path: ../../../src/pocketmine/event/HandlerList.php
-
#jsonDeserialize(), not currently validated
message: "#^Casting to int something that's already int\\.$#"
count: 3
path: ../../../src/pocketmine/item/Item.php
-
#::get() tags parameter
message: "#^If condition is always false\\.$#"
count: 1
path: ../../../src/pocketmine/item/ItemFactory.php
-
#::get() tags parameter
message: "#^Strict comparison using \\!\\=\\= between null and null will always evaluate to false\\.$#"
count: 1
path: ../../../src/pocketmine/item/ItemFactory.php
-
#::get() tags parameter
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
count: 1
path: ../../../src/pocketmine/item/ItemFactory.php
-
message: "#^Call to function is_object\\(\\) with \\*NEVER\\* will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/item/ItemFactory.php
-
#->sendBlocks() blocks parameter
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
count: 2
path: ../../../src/pocketmine/level/Level.php
count: 1
path: ../../../src/pocketmine/item/ItemFactory.php
-
message: "#^Instanceof between pocketmine\\\\math\\\\Vector3 and pocketmine\\\\math\\\\Vector3 will always evaluate to true\\.$#"
@ -65,23 +55,28 @@ parameters:
count: 2
path: ../../../src/pocketmine/level/Level.php
-
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
count: 2
path: ../../../src/pocketmine/level/Level.php
-
message: "#^Call to function assert\\(\\) with bool will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/level/Level.php
-
message: "#^Call to function is_subclass_of\\(\\) with class\\-string\\<pocketmine\\\\level\\\\generator\\\\Generator\\> and 'pocketmine\\\\\\\\level' will always evaluate to true\\.$#"
message: "#^Call to function is_subclass_of\\(\\) with class\\-string\\<pocketmine\\\\level\\\\generator\\\\Generator\\> and 'pocketmine\\\\\\\\level\\\\\\\\generator\\\\\\\\Generator' will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/level/generator/GeneratorManager.php
-
#commands plugin.yml not currently validated, can't be sure
message: "#^Call to function is_array\\(\\) with array\\<string, mixed\\> will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/plugin/PluginManager.php
-
message: "#^Call to function is_subclass_of\\(\\) with class\\-string\\<pocketmine\\\\event\\\\Event\\> and 'pocketmine\\\\\\\\event' will always evaluate to true\\.$#"
message: "#^Call to function is_subclass_of\\(\\) with class\\-string\\<pocketmine\\\\event\\\\Event\\> and 'pocketmine\\\\\\\\event\\\\\\\\Event' will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/plugin/PluginManager.php

View File

@ -0,0 +1,42 @@
<?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;
use PHPUnit\Framework\TestCase;
class DataPacketTest extends TestCase{
public function testHeaderFidelity() : void{
$pk = new TestPacket();
$pk->senderSubId = 3;
$pk->recipientSubId = 2;
$pk->encode();
$pk2 = new TestPacket();
$pk2->setBuffer($pk->getBuffer());
$pk2->decode();
self::assertSame($pk2->senderSubId, 3);
self::assertSame($pk2->recipientSubId, 2);
}
}

View File

@ -0,0 +1,34 @@
<?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;
use pocketmine\network\mcpe\NetworkSession;
class TestPacket extends DataPacket{
public const NETWORK_ID = 1023;
public function handle(NetworkSession $handler) : bool{
return false;
}
}

View File

@ -63,6 +63,32 @@ class UtilsTest extends TestCase{
self::assertEquals("HIGHEST", $tags["priority"]);
}
/**
* @return string[][]
* @phpstan-return list<array{string}>
*/
public function parseDocCommentOneLineProvider() : array{
return [
["/** @ignoreCancelled true dummy */"],
["/**@ignoreCancelled true dummy*/"],
["/** @ignoreCancelled true dummy */"]
];
}
/**
* @dataProvider parseDocCommentOneLineProvider
*/
public function testParseOneLineDocComment(string $comment) : void{
$tags = Utils::parseDocComment($comment);
self::assertArrayHasKey("ignoreCancelled", $tags);
self::assertEquals("true dummy", $tags["ignoreCancelled"]);
}
public function testParseEmptyDocComment() : void{
$tags = Utils::parseDocComment("");
self::assertCount(0, $tags);
}
public function testNamespacedNiceClosureName() : void{
//be careful with this test. The closure has to be declared on the same line as the assertion.
self::assertSame('closure@' . Utils::cleanPath(__FILE__) . '#L' . __LINE__, Utils::getNiceClosureName(function() : void{}));