Compare commits

..

95 Commits

Author SHA1 Message Date
d36b24c518 Release 3.12.4 2020-06-02 18:40:33 +01:00
d554d8060b fixed absorption hearts not being consumed, closes #3546
this was caused by a bad fix for switching. we can't consider zero-damage attacks as cancelled because zero-damage might have been the result of things like consuming absorption hearts, so the aftereffects need to be processed even when the net damage is zero.
2020-06-02 10:09:18 +01:00
b48243fd09 Bump phpstan/phpstan-phpunit from 0.12.10 to 0.12.11 (#3547) 2020-06-01 18:05:51 +00:00
92cffc00d0 3.12.4 is next 2020-06-01 13:18:28 +01:00
e87e974323 Release 3.12.3 2020-06-01 13:18:28 +01:00
a3f6338626 Player: fixed internal server error when using insert-before on a client-sided book page 2020-06-01 12:59:18 +01:00
21aef97ba7 Player: fixed swapping book pages that only exist client-side, closes #3322 2020-06-01 12:50:39 +01:00
ed0d1978aa WritableBook: fixed thrown exception when asking for a page that doesn't exist (it's allowed to return null for a reason ...) 2020-06-01 12:46:41 +01:00
d64561b0b1 Fixed internal server error when deleting book pages that only exist client side 2020-06-01 12:39:17 +01:00
d234d3e45e ParticleCommand: added mobflame, closes #3102 2020-05-31 20:28:57 +01:00
5056754cea NetworkBinaryStream: do not round vectors directly on reading
fixes #3199
2020-05-31 20:17:42 +01:00
2dc3cf8162 InventoryTransaction: sync inventories before throwing validation exception to caller
fixes #3226

really the transaction shouldn't be handling inventory sync at all, but that's a job for another commit.
2020-05-31 20:10:29 +01:00
8c5a81cf5c Living: improved projectile knockback
this isn't pretty, but it works. I have a nicer idea how to do this on PM4, but it's going to involve BC breaks (as usual).
closes #3382
2020-05-31 20:04:12 +01:00
2b58f2bafd FallingBlock: remove superfluous transparent check, closes #3339 2020-05-31 19:54:47 +01:00
5dadf12374 Living: fixed cooldown damage logic, closes #2939 2020-05-31 19:46:51 +01:00
0d4e473bdd Reduce ResourcePackChunkData chunk size to 128 KB
while this is slightly less bandwidth efficient (1 in 92 datagrams not full vs 1 in 733), this is significantly less memory-hard.
I made this decision looking at the memory pressures that 1MB chunks exert - especially on RakNet. Client-side, these resource pack chunks all hang around in RakNet memory until the whole thing is received, and it's a lot more costly to receive 733 datagrams than it is to receive 92, especially since it's much more likely that some of the 733 will disappear along the way.
If, for example, the first couple of hundred KB split parts arrived out of 1MB, and then one of the parts got lost, all the already-received parts would hang around in memory not getting processed. With smaller chunks this is much less of a problem.
I explored taking the chunk size all the way down to 1KB to reduce the bandwidth waste caused by split packets (split headers), but this made resource pack downloading unbearably slow, so it wasn't acceptable.
2020-05-31 19:29:26 +01:00
11cedc4011 Player: added a constant for resource pack chunk sending size 2020-05-31 19:23:21 +01:00
3f2455f090 SnowLayer: fixed layer stacking, closes #2775 2020-05-31 17:38:24 +01:00
9d26a224a2 DoublePlant: add flammability info, closes #2465 2020-05-31 17:04:50 +01:00
c4ad390463 pocketmine.yml: raise default population-queue-size to 32
the old limit was made in the php5 days when performance was far worse and it was much more costly to generate chunks that weren't needed. Now it's significantly less and having a higher limit allows terrain to be sent more quickly in new worlds and to fast-moving players.
This limit really ought to go away completely but considering the technical barriers in the way it'll have to stay for now.
2020-05-31 16:58:53 +01:00
42e14f749e Do not blanket-ban all inventory transactions in spectator mode, fixes #2627
instead, we cancel the appropriate events before they are called, so that plugins can uncancel them if they choose.
2020-05-31 16:32:06 +01:00
3f07f06874 updated composer lockfile 2020-05-31 14:42:31 +01:00
10279e11ed updated build/php submodule to pmmp/php-build-scripts@d475b694e4 2020-05-31 14:33:26 +01:00
673e444456 phpstan: fix build failure 2020-05-31 13:02:32 +01:00
89c49d77c6 ditch irstea/phpunit-shim, more trouble than it's worth 2020-05-31 12:03:38 +01:00
c3a795e876 Fix walk sounds (#3492)
Co-authored-by: Govdim <govdim.govorek@gmail.com>
2020-05-24 14:03:14 +01:00
4199c3796f Water: Remove duplicate call to Entity->resetFallDistance() (#3524)
It's not clear what the intended goal of this code was, but the duplicate call is obviously useless.
2020-05-24 14:00:19 +01:00
bf6af269c8 StartGamePacket: use PUBLIC visibility by default 2020-05-20 20:04:39 +01:00
a29424f5b3 UIProfile: name constants as they appear in the MC user-facing settings
I think these names are stupid, but it'll be easier for people to figure out what they refer to if they match the client-sided naming.
2020-05-20 15:06:50 +01:00
ff3af492f8 Random: remove multiline formatting in nextSignedInt()
I'm sick to death of formatting tools messing with this...
2020-05-20 14:34:29 +01:00
80b804f7aa automated imports cleanup 2020-05-20 14:31:31 +01:00
3a78735982 added UIProfile protocol constants
these are only used in the LoginPacket, but plugin devs will probably find them useful anyway
2020-05-20 14:27:50 +01:00
ab32784c74 UpdateBlockSyncedPacket: remove default values for fields 2020-05-20 13:58:36 +01:00
816234a379 UpdateBlockSyncedPacket: populate missing information for second field 2020-05-20 13:57:08 +01:00
b7bf92a5e9 SimpleEventPacket: added missing type constant 2020-05-20 13:50:43 +01:00
dcca000ead PlayerActionPacket: added missing constant 2020-05-20 13:44:52 +01:00
c4ea51f985 NpcRequestPacket: added request type constants 2020-05-20 13:42:40 +01:00
8202bb1cd8 MoveActorAbsolutePacket: added missing flag 2020-05-20 13:39:56 +01:00
b75758e35e MoveActorDeltaPacket: added missing flags 2020-05-20 13:39:37 +01:00
38a06f76f8 LoginPacket: remove unused constant 2020-05-20 13:15:43 +01:00
84f99ed418 CommandOriginData: Rename previously unknown field 2020-05-20 13:00:03 +01:00
fd63f19199 make use of new GameRuleType constants 2020-05-20 12:35:29 +01:00
66d44aa814 added GameRuleType protocol constants 2020-05-20 12:35:07 +01:00
f3089f577e StartGamePacket: use new protocol constants for multiplayer visibility 2020-05-20 12:22:33 +01:00
9516ef1632 added GamePublishSetting protocol constants 2020-05-20 12:22:12 +01:00
e982a57cb5 StartGamePacket: use EducationEditionOffer constants 2020-05-20 12:08:56 +01:00
f57fa2252b added EducationEditionOffer protocol constants 2020-05-20 12:08:36 +01:00
02cc370855 StartGamePacket: use GeneratorType constants 2020-05-20 12:05:41 +01:00
0a5d14a840 added GeneratorType protocol constants 2020-05-20 12:05:41 +01:00
3ec2994d7f added protocol GameMode constants 2020-05-20 11:53:35 +01:00
786f416f2e Improved support for paths with backslashes on Unix filesystems (#3501)
Fixes #3497
2020-05-19 10:34:51 +01:00
a67d2ae978 parity: burning players no longer shoot burning arrows (#3509)
this behaviour doesn't exist in vanilla.
2020-05-19 10:31:39 +01:00
089180fef4 Players no longer burn when hit by other players, closes #3170 (#3470) 2020-05-18 21:13:56 +01:00
fffa4b9501 phpstan: baseline our way to level 8
we really need the level 8 checks on new code now, and waiting until old code is clean is not going to benefit us much because the issues that are there already exist.
2020-05-18 20:09:25 +01:00
71a8b0340c BUILDING.md: EOF newline [ci skip] 2020-05-18 19:23:18 +01:00
e544055bbc BUILDING.md: change build/server.phar to build/server-phar.php
closes #3507
2020-05-18 18:54:14 +01:00
8f5db7c297 3.12.2 changelog typo (#3505) 2020-05-18 12:26:07 +01:00
27f55e4c96 3.12.3 is next 2020-05-18 10:17:08 +01:00
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
69 changed files with 6900 additions and 379 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

@ -30,9 +30,9 @@ If you use a custom binary, you'll need to replace `composer` usages in this gui
Preprocessor requires that the `cpp` (c preprocessor) is available in your PATH.
## Building `PocketMine-MP.phar`
Run `build/server.phar` using your preferred PHP binary. It'll drop a `PocketMine-MP.phar` into the current working directory.
Run `build/server-phar.php` using your preferred PHP binary. It'll drop a `PocketMine-MP.phar` into the current working directory.
You can also use the `--out` option to change the output filename.
## Running PocketMine-MP from source code
Run `src/pocketmine/PocketMine.php` using your preferred PHP binary.
Run `src/pocketmine/PocketMine.php` using your preferred PHP binary.

View File

@ -9,3 +9,42 @@ Plugin developers should **only** update their required API to this version if y
# 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 protection 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.
# 3.12.3
- Core code is now analyzed using PHPStan level 8 (using baselines). While not all the code is level 8 compliant, this does mean that new code will be held to a higher standard, ensuring quality going forwards.
- Players no longer burn when melee-attacked by other players. (vanilla parity)
- Arrows shot by burning players are no longer on fire. (vanilla parity)
- Fixed a crash that could occur with plugins on Unix filesystems that had backslashes in their names.
- Cleaned up a whole bunch of unknowns in the protocol layer. Many new constants have been added.
- Fixed player walking sounds.
- Default generation queue size has been raised to 32 (previously 8). The previous default was selected in a time when PHP was much less performant than it is today, and in today's world it just needlessly slows things down.
- Double plants are now burned away by fire.
- Snow layers can now be stacked. (vanilla parity)
- Resource pack sending chunk size has been reduced to 128 KB (previously 1 MB). This change was made after analyzing the effects that larger pack chunk sizes have on RakNet. Given the technical evidence, a smaller size, while slightly less bandwidth-efficient, should be more manageable for RakNet due to lower split reassembly overhead and reduced memory pressure.
- Fixed "switching" (an exploit often complained about by PvP players). Now, the previous damage is subtracted from current damage when an entity is attacked while on cooldown. This means that attacking with a wooden sword and then diamond sword while attack cooldown is active will only deal as much damage as the diamond sword would have, instead of the combined total. This can be controlled using the `EntityDamageEvent::MODIFIER_PREVIOUS_DAMAGE_COOLDOWN` modifier. (vanilla parity)
- Fixed projectiles knocking mobs back in unexpected directions on collision.
- Fixed inventories not being synchronized on failed inventory transactions.
- Vector3s decoded from packets are no longer rounded directly. Instead, the player movement handler takes responsibility for rounding the coordinates to prevent anti cheat doing something it's not supposed to.
- `mobflame` particle can now be spawned using the `/particle` command.
- Fixed several internal errors that could occur while modifying writable books.
- Fixed swapping writable book pages not working in some cases.
- `WritableBook->getPageText()` no longer throws an exception when the page doesn't exist, but returns null (as it was originally intended to).
# 3.12.4
- Fixed absorption hearts not being consumed.

View File

@ -37,10 +37,10 @@
"adhocore/json-comment": "^0.1.0"
},
"require-dev": {
"phpstan/phpstan": "^0.12.14",
"irstea/phpunit-shim": "^8.5",
"phpstan/phpstan": "^0.12.25",
"phpstan/phpstan-phpunit": "^0.12.6",
"phpstan/phpstan-strict-rules": "^0.12.2"
"phpstan/phpstan-strict-rules": "^0.12.2",
"phpunit/phpunit": "^8.5"
},
"autoload": {
"psr-4": {

1556
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,10 @@
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
- tests/phpstan/configs/l7-baseline.neon
- tests/phpstan/configs/l8-baseline.neon
- tests/phpstan/configs/php-bugs.neon
- tests/phpstan/configs/phpstan-bugs.neon
- tests/phpstan/configs/phpunit-wiring-tests.neon
@ -12,13 +15,12 @@ includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
parameters:
level: 6
level: 8
autoload_files:
- tests/phpstan/bootstrap.php
- src/pocketmine/PocketMine.php
- build/make-release.php
- build/server-phar.php
- vendor/irstea/phpunit-shim/phpunit
paths:
- src
- build/make-release.php
@ -33,158 +35,3 @@ parameters:
reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings
staticReflectionClassNamePatterns:
- "#^COM$#"
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

View File

@ -146,6 +146,7 @@ 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\GameMode;
use pocketmine\network\mcpe\protocol\types\PersonaPieceTintColor;
use pocketmine\network\mcpe\protocol\types\PersonaSkinPiece;
use pocketmine\network\mcpe\protocol\types\PlayerPermissions;
@ -216,6 +217,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
public const SPECTATOR = 3;
public const VIEW = Player::SPECTATOR;
private const RESOURCE_PACK_CHUNK_SIZE = 128 * 1024; //128KB
/**
* Validates the given username.
*/
@ -261,6 +264,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** @var bool */
public $loggedIn = false;
/** @var bool */
private $seenLoginPacket = false;
/** @var bool */
private $resourcePacksDone = false;
@ -1331,12 +1336,13 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* TODO: remove this when Spectator Mode gets added properly to MCPE
*/
public static function getClientFriendlyGamemode(int $gamemode) : int{
$gamemode &= 0x03;
if($gamemode === Player::SPECTATOR){
return Player::CREATIVE;
}
return $gamemode;
static $map = [
self::SURVIVAL => GameMode::SURVIVAL,
self::CREATIVE => GameMode::CREATIVE,
self::ADVENTURE => GameMode::ADVENTURE,
self::SPECTATOR => GameMode::CREATIVE
];
return $map[$gamemode & 0x3];
}
/**
@ -1816,9 +1822,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){
@ -2065,7 +2072,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$pk = new ResourcePackDataInfoPacket();
$pk->packId = $pack->getPackId();
$pk->maxChunkSize = 1048576; //1MB
$pk->maxChunkSize = self::RESOURCE_PACK_CHUNK_SIZE;
$pk->chunkCount = (int) ceil($pack->getPackSize() / $pk->maxChunkSize);
$pk->compressedPackSize = $pack->getPackSize();
$pk->sha256 = $pack->getSha256();
@ -2231,7 +2238,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
}
public function handleMovePlayer(MovePlayerPacket $packet) : bool{
$newPos = $packet->position->subtract(0, $this->baseOffset, 0);
$newPos = $packet->position->round(4)->subtract(0, $this->baseOffset, 0);
if($this->isTeleporting and $newPos->distanceSquared($this) > 1){ //Tolerate up to 1 block to avoid problems with client-sided physics when spawning in blocks
$this->sendPosition($this, null, null, MovePlayerPacket::MODE_RESET);
@ -2300,11 +2307,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
return false;
}
if($this->isSpectator()){
$this->sendAllInventories();
return true;
}
/** @var InventoryAction[] $actions */
$actions = [];
foreach($packet->actions as $networkInventoryAction){
@ -2398,7 +2400,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->setUsingItem(false);
if(!$this->canInteract($blockVector->add(0.5, 0.5, 0.5), 13) or $this->isSpectator()){
if(!$this->canInteract($blockVector->add(0.5, 0.5, 0.5), 13)){
}elseif($this->isCreative()){
$item = $this->inventory->getItemInHand();
if($this->level->useItemOn($blockVector, $item, $face, $packet->trData->clickPos, $this, true)){
@ -2504,7 +2506,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
}
$ev = new PlayerInteractEvent($this, $item, null, $directionVector, $face, PlayerInteractEvent::RIGHT_CLICK_AIR);
if($this->hasItemCooldown($item)){
if($this->hasItemCooldown($item) or $this->isSpectator()){
$ev->setCancelled();
}
@ -2555,7 +2557,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$heldItem = $this->inventory->getItemInHand();
$oldItem = clone $heldItem;
if(!$this->canInteract($target, 8)){
if(!$this->canInteract($target, 8) or $this->isSpectator()){
$cancelled = true;
}elseif($target instanceof Player){
if(!$this->server->getConfigBool("pvp")){
@ -3053,8 +3055,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$pk = new ResourcePackChunkDataPacket();
$pk->packId = $pack->getPackId();
$pk->chunkIndex = $packet->chunkIndex;
$pk->data = $pack->getPackChunk(1048576 * $packet->chunkIndex, 1048576);
$pk->progress = (1048576 * $packet->chunkIndex);
$pk->data = $pack->getPackChunk(self::RESOURCE_PACK_CHUNK_SIZE * $packet->chunkIndex, self::RESOURCE_PACK_CHUNK_SIZE);
$pk->progress = (self::RESOURCE_PACK_CHUNK_SIZE * $packet->chunkIndex);
$this->dataPacket($pk);
return true;
}
@ -3075,14 +3077,26 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$modifiedPages[] = $packet->pageNumber;
break;
case BookEditPacket::TYPE_ADD_PAGE:
if(!$newBook->pageExists($packet->pageNumber)){
//this may only come before a page which already exists
//TODO: the client can send insert-before actions on trailing client-side pages which cause odd behaviour on the server
return false;
}
$newBook->insertPage($packet->pageNumber, $packet->text);
$modifiedPages[] = $packet->pageNumber;
break;
case BookEditPacket::TYPE_DELETE_PAGE:
if(!$newBook->pageExists($packet->pageNumber)){
return false;
}
$newBook->deletePage($packet->pageNumber);
$modifiedPages[] = $packet->pageNumber;
break;
case BookEditPacket::TYPE_SWAP_PAGES:
if(!$newBook->pageExists($packet->pageNumber) or !$newBook->pageExists($packet->secondaryPageNumber)){
//the client will create pages on its own without telling us until it tries to switch them
$newBook->addPage(max($packet->pageNumber, $packet->secondaryPageNumber));
}
$newBook->swapPages($packet->pageNumber, $packet->secondaryPageNumber);
$modifiedPages = [$packet->pageNumber, $packet->secondaryPageNumber];
break;
@ -3738,6 +3752,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$pk->headYaw = $yaw;
$pk->yaw = $yaw;
$pk->mode = $mode;
$pk->onGround = $this->onGround;
if($targets !== null){
$this->server->broadcastPacket($targets, $pk);

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

@ -33,6 +33,6 @@ if(defined('pocketmine\_VERSION_INFO_INCLUDED')){
const _VERSION_INFO_INCLUDED = true;
const NAME = "PocketMine-MP";
const BASE_VERSION = "3.12.0";
const BASE_VERSION = "3.12.4";
const IS_DEVELOPMENT_BUILD = false;
const BUILD_NUMBER = 0;

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

@ -124,4 +124,12 @@ class DoublePlant extends Flowable{
return parent::getAffectedBlocks();
}
public function getFlameEncouragement() : int{
return 60;
}
public function getFlammability() : int{
return 100;
}
}

View File

@ -42,7 +42,7 @@ class SnowLayer extends Flowable{
}
public function canBeReplaced() : bool{
return true;
return $this->meta < 7; //8 snow layers
}
public function getHardness() : float{
@ -57,9 +57,15 @@ class SnowLayer extends Flowable{
return TieredTool::TIER_WOODEN;
}
private function canBeSupportedBy(Block $b) : bool{
return $b->isSolid() or ($b->getId() === $this->getId() and $b->getDamage() === 7);
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
if($blockReplace->getSide(Vector3::SIDE_DOWN)->isSolid()){
//TODO: fix placement
if($blockReplace->getId() === $this->getId() and $blockReplace->getDamage() < 7){
$this->setDamage($blockReplace->getDamage() + 1);
}
if($this->canBeSupportedBy($blockReplace->getSide(Vector3::SIDE_DOWN))){
$this->getLevel()->setBlock($blockReplace, $this, true);
return true;
@ -69,7 +75,7 @@ class SnowLayer extends Flowable{
}
public function onNearbyBlockChange() : void{
if(!$this->getSide(Vector3::SIDE_DOWN)->isSolid()){
if(!$this->canBeSupportedBy($this->getSide(Vector3::SIDE_DOWN))){
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), false, false);
}
}

View File

@ -70,8 +70,6 @@ class Water extends Liquid{
if($entity->isOnFire()){
$entity->extinguish();
}
$entity->resetFallDistance();
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{

View File

@ -37,6 +37,7 @@ use pocketmine\level\particle\CriticalParticle;
use pocketmine\level\particle\DustParticle;
use pocketmine\level\particle\EnchantmentTableParticle;
use pocketmine\level\particle\EnchantParticle;
use pocketmine\level\particle\EntityFlameParticle;
use pocketmine\level\particle\ExplodeParticle;
use pocketmine\level\particle\FlameParticle;
use pocketmine\level\particle\HappyVillagerParticle;
@ -204,7 +205,8 @@ class ParticleCommand extends VanillaCommand{
return new AngryVillagerParticle($pos);
case "forcefield":
return new BlockForceFieldParticle($pos, $data ?? 0);
case "mobflame":
return new EntityFlameParticle($pos);
}
if(strpos($name, "iconcrack_") === 0){

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
@ -1164,6 +1168,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
if($teleport){
$pk->flags |= MoveActorAbsolutePacket::FLAG_TELEPORT;
}
if($this->onGround){
$pk->flags |= MoveActorAbsolutePacket::FLAG_GROUND;
}
$this->level->broadcastPacketToViewers($this, $pk);
}
@ -1927,7 +1934,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

@ -436,6 +436,9 @@ abstract class Living extends Entity implements Damageable{
* to effects or armour.
*/
public function applyDamageModifiers(EntityDamageEvent $source) : void{
if($this->lastDamageCause !== null and $this->attackTime > 0){
$source->setModifier(-$this->lastDamageCause->getBaseDamage(), EntityDamageEvent::MODIFIER_PREVIOUS_DAMAGE_COOLDOWN);
}
if($source->canBeReducedByArmor()){
//MCPE uses the same system as PC did pre-1.9
$source->setModifier(-$source->getFinalDamage() * $this->getArmorPoints() * 0.04, EntityDamageEvent::MODIFIER_ARMOR);
@ -514,11 +517,6 @@ abstract class Living extends Entity implements Damageable{
public function attack(EntityDamageEvent $source) : void{
if($this->noDamageTicks > 0){
$source->setCancelled();
}elseif($this->attackTime > 0){
$lastCause = $this->getLastDamageCause();
if($lastCause !== null and $lastCause->getBaseDamage() >= $source->getBaseDamage()){
$source->setCancelled();
}
}
if($this->hasEffect(Effect::FIRE_RESISTANCE) and (
@ -550,20 +548,15 @@ abstract class Living extends Entity implements Damageable{
$this->attackTime = $source->getAttackCooldown();
if($source instanceof EntityDamageByEntityEvent){
$e = $source->getDamager();
if($source instanceof EntityDamageByChildEntityEvent){
$e = $source->getChild();
}
if($source instanceof EntityDamageByChildEntityEvent){
$e = $source->getChild();
if($e !== null){
$motion = $e->getMotion();
$this->knockBack($e, $source->getBaseDamage(), $motion->x, $motion->z, $source->getKnockBack());
}
}elseif($source instanceof EntityDamageByEntityEvent){
$e = $source->getDamager();
if($e !== null){
if((
$source->getCause() === EntityDamageEvent::CAUSE_PROJECTILE or
$source->getCause() === EntityDamageEvent::CAUSE_ENTITY_ATTACK
) and $e->isOnFire()){
$this->setOnFire(2 * $this->level->getDifficulty());
}
$deltaX = $this->x - $e->x;
$deltaZ = $this->z - $e->z;
$this->knockBack($e, $source->getBaseDamage(), $deltaX, $deltaZ, $source->getKnockBack());

View File

@ -111,7 +111,7 @@ class FallingBlock extends Entity{
$this->flagForDespawn();
$block = $this->level->getBlock($pos);
if(($block->isTransparent() and !$block->canBeReplaced()) or ($this->onGround and abs($this->y - $this->getFloorY()) > 0.001)){
if(!$block->canBeReplaced() or ($this->onGround and abs($this->y - $this->getFloorY()) > 0.001)){
//FIXME: anvils are supposed to destroy torches
$this->getLevel()->dropItem($this, ItemFactory::get($this->getBlock(), $this->getDamage()));
}else{

View File

@ -26,6 +26,7 @@ namespace pocketmine\event\entity;
use pocketmine\entity\Entity;
use pocketmine\event\Cancellable;
use function array_sum;
use function max;
/**
* Called when an entity takes damage.
@ -40,6 +41,7 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
public const MODIFIER_CRITICAL = 7;
public const MODIFIER_TOTEM = 8;
public const MODIFIER_WEAPON_ENCHANTMENTS = 9;
public const MODIFIER_PREVIOUS_DAMAGE_COOLDOWN = 10;
public const CAUSE_CONTACT = 0;
public const CAUSE_ENTITY_ATTACK = 1;
@ -143,7 +145,7 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
}
public function getFinalDamage() : float{
return $this->baseDamage + array_sum($this->modifiers);
return max(0, $this->baseDamage + array_sum($this->modifiers));
}
/**

View File

@ -24,7 +24,6 @@ declare(strict_types=1);
namespace pocketmine\event\player;
use pocketmine\lang\TextContainer;
use pocketmine\lang\TranslationContainer;
use pocketmine\Player;
/**

View File

@ -293,7 +293,12 @@ class InventoryTransaction{
$this->shuffleActions();
$this->validate();
try{
$this->validate();
}catch(TransactionValidationException $e){
$this->sendInventories();
throw $e;
}
if(!$this->callExecuteEvent()){
$this->sendInventories();

View File

@ -59,7 +59,6 @@ class Bow extends Tool{
($player->yaw > 180 ? 360 : 0) - $player->yaw,
-$player->pitch
);
$nbt->setShort("Fire", $player->isOnFire() ? 45 * 60 : 0);
$diff = $player->getItemUseDuration();
$p = $diff / 20;
@ -84,7 +83,7 @@ class Bow extends Tool{
}
$ev = new EntityShootBowEvent($player, $this, $entity, $baseForce * 3);
if($baseForce < 0.1 or $diff < 5){
if($baseForce < 0.1 or $diff < 5 or $player->isSpectator()){
$ev->setCancelled();
}

View File

@ -50,7 +50,7 @@ class WritableBook extends Item{
*/
public function getPageText(int $pageId) : ?string{
$pages = $this->getNamedTag()->getListTag(self::TAG_PAGES);
if($pages === null){
if($pages === null or !$pages->isset($pageId)){
return null;
}

View File

@ -1856,17 +1856,17 @@ class Level implements ChunkManager, Metadatable{
if($player !== null){
$ev = new PlayerInteractEvent($player, $item, $blockClicked, $clickVector, $face, PlayerInteractEvent::RIGHT_CLICK_BLOCK);
if($this->checkSpawnProtection($player, $blockClicked)){
if($this->checkSpawnProtection($player, $blockClicked) or $player->isSpectator()){
$ev->setCancelled(); //set it to cancelled so plugins can bypass this
}
$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) or $player->isSpectator()){
$ev->setCancelled();
}

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

@ -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

@ -37,6 +37,7 @@ 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\GameRuleType;
use pocketmine\network\mcpe\protocol\types\PersonaPieceTintColor;
use pocketmine\network\mcpe\protocol\types\PersonaSkinPiece;
use pocketmine\network\mcpe\protocol\types\SkinAnimation;
@ -546,9 +547,9 @@ class NetworkBinaryStream extends BinaryStream{
*/
public function getVector3() : Vector3{
return new Vector3(
$this->getRoundedLFloat(4),
$this->getRoundedLFloat(4),
$this->getRoundedLFloat(4)
$this->getLFloat(),
$this->getLFloat(),
$this->getLFloat()
);
}
@ -602,13 +603,13 @@ class NetworkBinaryStream extends BinaryStream{
$type = $this->getUnsignedVarInt();
$value = null;
switch($type){
case 1:
case GameRuleType::BOOL:
$value = $this->getBool();
break;
case 2:
case GameRuleType::INT:
$value = $this->getUnsignedVarInt();
break;
case 3:
case GameRuleType::FLOAT:
$value = $this->getLFloat();
break;
}
@ -632,13 +633,13 @@ class NetworkBinaryStream extends BinaryStream{
$this->putString($name);
$this->putUnsignedVarInt($rule[0]);
switch($rule[0]){
case 1:
case GameRuleType::BOOL:
$this->putBool($rule[1]);
break;
case 2:
case GameRuleType::INT:
$this->putUnsignedVarInt($rule[1]);
break;
case 3:
case GameRuleType::FLOAT:
$this->putLFloat($rule[1]);
break;
}
@ -671,7 +672,7 @@ class NetworkBinaryStream extends BinaryStream{
$result->requestId = $this->getString();
if($result->type === CommandOriginData::ORIGIN_DEV_CONSOLE or $result->type === CommandOriginData::ORIGIN_TEST){
$result->varlong1 = $this->getVarLong();
$result->playerEntityUniqueId = $this->getVarLong();
}
return $result;
@ -683,7 +684,7 @@ class NetworkBinaryStream extends BinaryStream{
$this->putString($data->requestId);
if($data->type === CommandOriginData::ORIGIN_DEV_CONSOLE or $data->type === CommandOriginData::ORIGIN_TEST){
$this->putVarLong($data->varlong1);
$this->putVarLong($data->playerEntityUniqueId);
}
}

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

@ -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

@ -35,8 +35,6 @@ use function json_decode;
class LoginPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::LOGIN_PACKET;
public const EDITION_POCKET = 0;
/** @var string */
public $username;
/** @var int */

View File

@ -33,6 +33,7 @@ class MoveActorAbsolutePacket extends DataPacket{
public const FLAG_GROUND = 0x01;
public const FLAG_TELEPORT = 0x02;
public const FLAG_FORCE_MOVE_LOCAL_ENTITY = 0x04;
/** @var int */
public $entityRuntimeId;

View File

@ -36,6 +36,9 @@ class MoveActorDeltaPacket extends DataPacket{
public const FLAG_HAS_ROT_X = 0x08;
public const FLAG_HAS_ROT_Y = 0x10;
public const FLAG_HAS_ROT_Z = 0x20;
public const FLAG_GROUND = 0x40;
public const FLAG_TELEPORT = 0x80;
public const FLAG_FORCE_MOVE_LOCAL_ENTITY = 0x100;
/** @var int */
public $entityRuntimeId;

View File

@ -30,6 +30,13 @@ use pocketmine\network\mcpe\NetworkSession;
class NpcRequestPacket extends DataPacket{
public const NETWORK_ID = ProtocolInfo::NPC_REQUEST_PACKET;
public const REQUEST_SET_ACTIONS = 0;
public const REQUEST_EXECUTE_ACTION = 1;
public const REQUEST_EXECUTE_CLOSING_COMMANDS = 2;
public const REQUEST_SET_NAME = 3;
public const REQUEST_SET_SKIN = 4;
public const REQUEST_SET_INTERACTION_TEXT = 5;
/** @var int */
public $entityRuntimeId;
/** @var int */

View File

@ -49,7 +49,7 @@ class PlayerActionPacket extends DataPacket{
public const ACTION_STOP_GLIDE = 16;
public const ACTION_BUILD_DENIED = 17;
public const ACTION_CONTINUE_BREAK = 18;
public const ACTION_CHANGE_SKIN = 19;
public const ACTION_SET_ENCHANTMENT_SEED = 20;
public const ACTION_START_SWIMMING = 21;
public const ACTION_STOP_SWIMMING = 22;

View File

@ -32,6 +32,7 @@ class SimpleEventPacket extends DataPacket{
public const TYPE_ENABLE_COMMANDS = 1;
public const TYPE_DISABLE_COMMANDS = 2;
public const TYPE_UNLOCK_WORLD_TEMPLATE_SETTINGS = 3;
/** @var int */
public $eventType;

View File

@ -30,6 +30,10 @@ use pocketmine\nbt\NetworkLittleEndianNBTStream;
use pocketmine\nbt\tag\ListTag;
use pocketmine\network\mcpe\NetworkBinaryStream;
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\types\EducationEditionOffer;
use pocketmine\network\mcpe\protocol\types\GameRuleType;
use pocketmine\network\mcpe\protocol\types\GeneratorType;
use pocketmine\network\mcpe\protocol\types\MultiplayerGameVisibility;
use pocketmine\network\mcpe\protocol\types\PlayerPermissions;
use pocketmine\network\mcpe\protocol\types\RuntimeBlockMapping;
use function count;
@ -65,7 +69,7 @@ class StartGamePacket extends DataPacket{
/** @var int */
public $dimension;
/** @var int */
public $generator = 1; //default infinite - 0 old, 1 infinite, 2 flat
public $generator = GeneratorType::OVERWORLD;
/** @var int */
public $worldGamemode;
/** @var int */
@ -81,7 +85,7 @@ class StartGamePacket extends DataPacket{
/** @var int */
public $time = -1;
/** @var int */
public $eduEditionOffer = 0;
public $eduEditionOffer = EducationEditionOffer::NONE;
/** @var bool */
public $hasEduFeaturesEnabled = false;
/** @var float */
@ -95,9 +99,9 @@ class StartGamePacket extends DataPacket{
/** @var bool */
public $hasLANBroadcast = true;
/** @var int */
public $xboxLiveBroadcastMode = 0; //TODO: find values
public $xboxLiveBroadcastMode = MultiplayerGameVisibility::PUBLIC;
/** @var int */
public $platformBroadcastMode = 0;
public $platformBroadcastMode = MultiplayerGameVisibility::PUBLIC;
/** @var bool */
public $commandsEnabled;
/** @var bool */
@ -107,7 +111,7 @@ class StartGamePacket extends DataPacket{
* @phpstan-var array<string, array{0: int, 1: bool|int|float}>
*/
public $gameRules = [ //TODO: implement this
"naturalregeneration" => [1, false] //Hack for client side regeneration
"naturalregeneration" => [GameRuleType::BOOL, false] //Hack for client side regeneration
];
/** @var bool */
public $hasBonusChestEnabled = false;

View File

@ -30,21 +30,25 @@ use pocketmine\network\mcpe\NetworkSession;
class UpdateBlockSyncedPacket extends UpdateBlockPacket{
public const NETWORK_ID = ProtocolInfo::UPDATE_BLOCK_SYNCED_PACKET;
public const TYPE_NONE = 0;
public const TYPE_CREATE = 1;
public const TYPE_DESTROY = 2;
/** @var int */
public $entityUniqueId = 0;
public $entityUniqueId;
/** @var int */
public $uvarint64_2 = 0;
public $updateType;
protected function decodePayload(){
parent::decodePayload();
$this->entityUniqueId = $this->getUnsignedVarLong();
$this->uvarint64_2 = $this->getUnsignedVarLong();
$this->updateType = $this->getUnsignedVarLong();
}
protected function encodePayload(){
parent::encodePayload();
$this->putUnsignedVarLong($this->entityUniqueId);
$this->putUnsignedVarLong($this->uvarint64_2);
$this->putUnsignedVarLong($this->updateType);
}
public function handle(NetworkSession $session) : bool{

View File

@ -48,5 +48,5 @@ class CommandOriginData{
public $requestId;
/** @var int */
public $varlong1;
public $playerEntityUniqueId;
}

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,35 @@
<?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 EducationEditionOffer{
private function __construct(){
//NOOP
}
public const NONE = 0;
public const EVERYWHERE_EXCEPT_CHINA = 1;
public const CHINA = 2;
}

View File

@ -0,0 +1,38 @@
<?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 GameMode{
private function __construct(){
//NOOP
}
public const SURVIVAL = 0;
public const CREATIVE = 1;
public const ADVENTURE = 2;
public const SURVIVAL_VIEWER = 3;
public const CREATIVE_VIEWER = 4;
public const DEFAULT = 5;
}

View File

@ -0,0 +1,35 @@
<?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 GameRuleType{
private function __construct(){
//NOOP
}
public const BOOL = 1;
public const INT = 2;
public const FLOAT = 3;
}

View File

@ -0,0 +1,37 @@
<?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 GeneratorType{
private function __construct(){
//NOOP
}
public const FINITE_OVERWORLD = 0;
public const OVERWORLD = 1;
public const FLAT = 2;
public const NETHER = 3;
public const THE_END = 4;
}

View File

@ -0,0 +1,37 @@
<?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 MultiplayerGameVisibility{
private function __construct(){
//NOOP
}
public const NONE = 0;
public const INVITE = 1;
public const FRIENDS = 2;
public const FRIENDS_OF_FRIENDS = 3;
public const PUBLIC = 4;
}

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

@ -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,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\types;
final class UIProfile{
private function __construct(){
//NOOP
}
public const CLASSIC = 0;
public const POCKET = 1;
}

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

@ -78,8 +78,8 @@ abstract class PluginBase implements Plugin{
$this->loader = $loader;
$this->server = $server;
$this->description = $description;
$this->dataFolder = rtrim($dataFolder, "\\/") . "/";
$this->file = rtrim($file, "\\/") . "/";
$this->dataFolder = rtrim($dataFolder, "/" . DIRECTORY_SEPARATOR) . "/";
$this->file = rtrim($file, "/" . DIRECTORY_SEPARATOR) . "/";
$this->configFile = $this->dataFolder . "config.yml";
$this->logger = new PluginLogger($this);
$this->scheduler = new TaskScheduler($this->logger, $this->getFullName());
@ -169,7 +169,7 @@ abstract class PluginBase implements Plugin{
* @return null|resource Resource data, or null
*/
public function getResource(string $filename){
$filename = rtrim(str_replace("\\", "/", $filename), "/");
$filename = rtrim(str_replace(DIRECTORY_SEPARATOR, "/", $filename), "/");
if(file_exists($this->file . "resources/" . $filename)){
return fopen($this->file . "resources/" . $filename, "rb");
}

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

@ -130,7 +130,7 @@ chunk-ticking:
chunk-generation:
#Max. amount of chunks in the waiting queue to be populated
population-queue-size: 8
population-queue-size: 32
ticks-per:
autosave: 6000

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

@ -94,8 +94,7 @@ class Random{
$this->x = $this->y;
$this->y = $this->z;
$this->z = $this->w;
$this->w = ($this->w ^ (($this->w >> 19) & 0x7fffffff)
^ ($t ^ (($t >> 8) & 0x7fffffff))) & 0xffffffff;
$this->w = ($this->w ^ (($this->w >> 19) & 0x7fffffff) ^ ($t ^ (($t >> 8) & 0x7fffffff))) & 0xffffffff;
return $this->w;
}

View File

@ -28,6 +28,7 @@ use function fopen;
use function function_exists;
use function getenv;
use function is_array;
use function sapi_windows_vt100_support;
use function stream_isatty;
abstract class Terminal{

View File

@ -89,6 +89,7 @@ use function substr;
use function sys_get_temp_dir;
use function trim;
use function xdebug_get_function_stack;
use const DIRECTORY_SEPARATOR;
use const PHP_EOL;
use const PHP_INT_MAX;
use const PHP_INT_SIZE;
@ -639,7 +640,7 @@ class Utils{
* @return string
*/
public static function cleanPath($path){
$result = str_replace(["\\", ".php", "phar://"], ["/", "", ""], $path);
$result = str_replace([DIRECTORY_SEPARATOR, ".php", "phar://"], ["/", "", ""], $path);
//remove relative paths
//TODO: make these paths dynamic so they can be unit-tested against
@ -648,7 +649,7 @@ class Utils{
\pocketmine\PATH => ""
];
foreach($cleanPaths as $cleanPath => $replacement){
$cleanPath = rtrim(str_replace(["\\", "phar://"], ["/", ""], $cleanPath), "/");
$cleanPath = rtrim(str_replace([DIRECTORY_SEPARATOR, "phar://"], ["/", ""], $cleanPath), "/");
if(strpos($result, $cleanPath) === 0){
$result = ltrim(str_replace($cleanPath, $replacement, $result), "/");
}
@ -662,7 +663,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:
-

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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

@ -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{}));