Compare commits

...

6103 Commits
3.5.6 ... 4.0.4

Author SHA1 Message Date
b903e90dc2 Release 4.0.4 2022-01-01 16:50:02 +00:00
c8247786d7 Player: check chat length check with strlen() before mb_strlen()
mb_strlen() is O(n), whereas strlen() is O(1). If we receive very large chat messages (e.g. 2 MB), mb_strlen() will take a very long time to return a result (around 8ms on my machine).
Since the max size of a UTF-8 character is 4 bytes (according to standard), we can use strlen() with 4x the char limit to gate it and prevent this from happening.
2022-01-01 16:46:00 +00:00
f486b5f4a7 Player: fixed fall damage when sprinting down stairs (#4685)
Due to the way positions are updated over the network, we only see the end result of a movement and not its preceding actions. In addition, we don't know for sure whether the MCPE collision checks work the same exact way as PM.

TL;DR: It's possible for the client to capture and send a movement frame after they collided with a step and then already moved forward from it some distance, resulting in a weird arc pattern.

This PR checks the range between the old and new positions for collision boxes to ensure that all possible areas are checked for detecting fall damage.

This has been tested and successfully resolves various issues involving running down stairs:
- missing sounds
- random fall damage
2022-01-01 15:41:19 +00:00
54d6b83fc2 Entity: pass the appropriate value for AFFECTED_BY_GRAVITY 2022-01-01 15:39:46 +00:00
eedea38669 Improve performance of loading player inventories 2022-01-01 15:26:42 +00:00
3c6146b5e0 ContainerTrait: avoid absurdly inefficient use of setItem()
this substantially improves the performance of loading containers such as chests.
2022-01-01 15:05:32 +00:00
72f2c794ab SimpleInventory: improved performance of setContents()
avoid the overhead incurred by clear() and setItem(), because in internalSetContents(), we already have no listeners or viewers to talk to anyway, so this is just spamming shit into /dev/null.
2021-12-31 18:32:19 +00:00
38b6b39cb3 Filesystem: workaround a stupid Windows issue in safeFilePutContents()
occasionally Windows will randomly decide to deny us access to rename the file for no reason whatsoever. If this happens, we attempt an old-style copy and delete.
If the rename failed for a legit reason, the copy and delete should also fail and generate an error message. If it was Windows being a spaz, it should work normally without errors.
2021-12-29 15:26:34 +00:00
fcc4757209 Merge branch 'legacy/pm3' into stable 2021-12-27 21:54:56 +00:00
d9c70cb176 start.cmd: prevent idiotic behaviour when paths contain characters such as brackets
god I hate this shit so much
2021-12-27 21:54:32 +00:00
4aab0565c0 ChunkCache: fixed corner case in cache restart on AsyncTask error
the cache may have been destroyed since the task inception, leading to an exception being thrown.
2021-12-27 18:11:55 +00:00
8943d8a2a7 Player: fixed maximum message size limits to match vanilla bugrock 2021-12-27 16:51:47 +00:00
0da29beb1d Bump pocketmine/locale-data from 2.2.0 to 2.2.1 (#4667)
Bumps [pocketmine/locale-data](https://github.com/pmmp/Language) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/pmmp/Language/releases)
- [Commits](https://github.com/pmmp/Language/compare/2.2.0...2.2.1)

---
updated-dependencies:
- dependency-name: pocketmine/locale-data
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-27 16:43:32 +00:00
157048264c Bump phpunit/phpunit from 9.5.10 to 9.5.11 (#4675)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.10 to 9.5.11.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.10...9.5.11)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-27 16:43:19 +00:00
b55aa78aec Changelog: Replaced non-existent method (#4676) 2021-12-27 15:33:02 +00:00
091673d8f1 Fixed "You can only sleep at night" message (#4671) 2021-12-23 23:52:07 +00:00
e3614d1a82 Entity: fixed game performance issue with large scale entities
this->size refers to the scaled height, but the client wants the base (unscaled) size in these properties.
This caused immense lag when, for example, setting the scale of a player to 10, because their collision box would become 180 by 60, instead of the expected 18 by 6.
2021-12-18 22:38:45 +00:00
93caf72f34 KickCommand: Add missing space
closes #4660
closes #4661
2021-12-17 21:09:14 +00:00
e6e1bca676 4.0.4 is next 2021-12-16 01:35:43 +00:00
795ebd1824 Release 4.0.3 2021-12-16 01:35:42 +00:00
5f03887b47 Merge branch 'legacy/pm3' into stable 2021-12-16 01:34:10 +00:00
9979a64ad2 3.26.5 is next 2021-12-16 01:23:22 +00:00
75a72786f9 Release 3.26.4 2021-12-16 01:23:21 +00:00
3d205c6e5f Updated transient dependency junk 2021-12-16 01:20:05 +00:00
2955a92837 Updated pocketmine/nbt to 0.2.19 2021-12-16 01:19:30 +00:00
e70f81a111 Updated pocketmine/nbt to 0.3.2 2021-12-16 01:08:23 +00:00
57e1509c3a Updated translation APIs 2021-12-15 03:24:13 +00:00
0da1810aaa Updated composer dependencies 2021-12-15 03:12:26 +00:00
4d37b79ff7 Server: fixed not being able to deop players whose names were added to ops.txt with uppercase letters in them
same as iTXTech/Genisys#1204

why didn't anyone report this???
2021-12-15 01:08:59 +00:00
ea1fceece2 Merge branch 'legacy/pm3' into stable 2021-12-14 23:15:53 +00:00
7fb1669c6d php-cs-fixer: added binary_operator_spaces and unary_operator_spaces rules 2021-12-14 23:14:39 +00:00
929abb04be Merge branch 'legacy/pm3' into stable 2021-12-14 22:54:17 +00:00
a09817864b php-cs-fixer: add return_type_declaration space_before 2021-12-14 22:50:43 +00:00
45c4a9673d Player: fixed arm swing animation not showing during attack cooldown of victim
closes #4650
2021-12-14 19:03:42 +00:00
4ad8cb02a5 BlockIdentifier: ensure that the tile class given is valid 2021-12-14 17:36:25 +00:00
7e6bbcc393 Sync composer deps 2021-12-14 01:27:11 +00:00
c334e6dec7 Updated locale-data dependency 2021-12-14 00:31:44 +00:00
89a766b799 Bump fgrosse/phpasn1 from 2.3.1 to 2.4.0 (#4644)
Bumps [fgrosse/phpasn1](https://github.com/fgrosse/PHPASN1) from 2.3.1 to 2.4.0.
- [Release notes](https://github.com/fgrosse/PHPASN1/releases)
- [Changelog](https://github.com/fgrosse/PHPASN1/blob/master/CHANGELOG.md)
- [Commits](https://github.com/fgrosse/PHPASN1/compare/v2.3.1...v2.4.0)

---
updated-dependencies:
- dependency-name: fgrosse/phpasn1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-13 21:39:44 +00:00
7e99e5167c Merge branch 'legacy/pm3' into stable 2021-12-13 12:36:26 +00:00
f5bbd30dbb Fixed skins appearing black when using RTX resource packs, closes #4537 2021-12-13 12:35:55 +00:00
3be8472ae2 MemoryManager: fixed dumping of uninitialized properties
closes #4643
2021-12-13 12:11:49 +00:00
22bb1ce8e0 4.0.3 is next 2021-12-12 23:27:54 +00:00
178dcb71a9 Release 4.0.2 2021-12-12 23:27:50 +00:00
0a58fd5472 GeneratorManager: fixed addGenerator() being case-sensitive when overwrite=true
this was caused by 083a1e1ff6.

This was discovered by a new PHPStan rule I'm working on, which disallows overwriting the values of parameter variables. During the refactor of this function to correct the error, another error appeared: Variable might not be defined.

This is yet another excellent example of why mutability is bad.
2021-12-12 21:58:07 +00:00
e06eefeab0 build/generate-known-translation-apis: fixed incorrect positional parameter order
closes #4639
2021-12-11 21:28:52 +00:00
ede07c4314 Mark KnownTranslationKeys and KnownTranslationFactory as @internal 2021-12-11 21:24:18 +00:00
cba00bf1e2 Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2021-12-10 23:24:38 +00:00
e81bee3866 ConsoleReaderThread: disable opcache for console reader subprocess 2021-12-10 23:24:18 +00:00
e6b85988b2 Bump fgrosse/phpasn1 from 2.3.0 to 2.3.1 (#4636)
Bumps [fgrosse/phpasn1](https://github.com/fgrosse/PHPASN1) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/fgrosse/PHPASN1/releases)
- [Changelog](https://github.com/fgrosse/PHPASN1/blob/master/CHANGELOG.md)
- [Commits](https://github.com/fgrosse/PHPASN1/compare/v2.3.0...v2.3.1)

---
updated-dependencies:
- dependency-name: fgrosse/phpasn1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-10 22:37:28 +00:00
b50591303b README: make shield show download count for 4.0.1, not 3.26.3 2021-12-10 20:23:48 +00:00
448f26cefc SimpleCommandMap: do not strip backslashes from unquoted command arguments 2021-12-10 18:27:49 +00:00
fa48100da5 PluginDescription: ensure base type of decoded document is actually an array
fixes #4628
2021-12-10 18:08:50 +00:00
bcf8a3424c Merge branch 'legacy/pm3' into stable 2021-12-10 18:02:06 +00:00
69d5bfa0d4 3.26.4 is next 2021-12-10 17:55:11 +00:00
549fb923bf Release 3.26.3 2021-12-10 17:55:07 +00:00
6d5c463bdd PlayerExperienceChangeEvent: added range checks to setNewProgress()
WE FINALLY FUCKING FOUND IT

This took several years to identify because PHP's exception stack traces don't show the actual values of parameters, but rather the values of the variables they were assigned to.

This means that if the parameter variable is mutated, the exception trace will show the value of the variable inside the function, not the value that was actually passed.
2021-12-10 17:29:57 +00:00
911ad344c9 Human: do not mutate parameter variables in setXpAndProgress()
this caused a mystery that took 3 entire years to debug.
2021-12-10 17:27:28 +00:00
3b77462935 WritableBookBase: fixed crash when finding pages containing corrupted UTF-8 characters
maybe we should treat this as corrupted? but for now, it's consistent with how we deal with signs.
2021-12-10 16:39:13 +00:00
6b40ed7bf8 Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2021-12-10 16:32:32 +00:00
1ed9302f5a ItemEntity: clone items given to the constructor directly
this fixes some bizarre mutability issues that occurred when using World->dropItem() with the same object multiple times.
2021-12-10 16:31:56 +00:00
b3dab0beef readme: added total downloads & latest downloads badges
[ci skip]
2021-12-10 00:40:29 +00:00
6ddaed97fa 4.0.2 is next 2021-12-09 00:48:45 +00:00
036b90d247 Release 4.0.1 2021-12-09 00:48:42 +00:00
d909cd8a91 Merge branch 'legacy/pm3' into stable 2021-12-09 00:33:05 +00:00
06eaf9f273 3.26.3 is next 2021-12-09 00:27:03 +00:00
1e56ed2ea3 Release 3.26.2 2021-12-09 00:26:59 +00:00
dccb8a3595 Merge branch 'legacy/pm3' into stable 2021-12-09 00:00:11 +00:00
0ace807756 Merge commit 'b081394125f90c14d6894b24e2edb32f3284b3a0' into stable 2021-12-08 23:59:51 +00:00
40895a86e5 draft-release: stick a banner on the release notes to declare obsolescence 2021-12-08 23:55:43 +00:00
b081394125 Do not restrict the allowed update channels client-side
we really should have an endpoint on the server that deals with this.
2021-12-08 21:57:16 +00:00
f48cf68cac updater: log a message when an update was found, but it's an older version 2021-12-08 21:55:44 +00:00
264cff70ec Release new PM3 builds onto pm3 channel 2021-12-08 21:55:12 +00:00
3aabfa4ab0 bootstrap: display value of PHPRC when PHP binary is borked
PHPRC overrides the search path for php.ini, which might break the php.ini locating.
2021-12-08 20:48:44 +00:00
0793e7e094 PluginLoadabilityChecker: fixed logic of extension compatibility check
if the extension doesn't specify any version, we can't do any constraint other than *.
2021-12-08 20:08:53 +00:00
3d9e19546f EntityShootBowEvent: fixed incorrect field type 2021-12-07 23:35:45 +00:00
e0eeb87ea0 World: simplify tile position checking code 2021-12-07 16:45:20 +00:00
78ffad5ffc World: add checks for tile position outside of world bounds, closes #4622 2021-12-07 16:41:52 +00:00
5a351d3b17 StringToItemParser: fixed not recognizing slime or slime_block 2021-12-06 23:51:30 +00:00
0c012ca5d9 Replace usages of ItemFactory in tests with VanillaItems 2021-12-06 23:45:36 +00:00
0530cb72df StringToItemParser: fixed some bogus aliases inherited from Item::fromString() 2021-12-06 23:44:41 +00:00
ee060f3e02 Update PHPUnit dependency junk 2021-12-06 16:42:40 +00:00
e7deffa9af Update in-house dependency versions 2021-12-06 16:41:43 +00:00
6e4b73c183 FallingBlock: fixed crash when block is unable to be determined 2021-12-06 16:40:47 +00:00
62f150586f Bump pocketmine/locale-data from 2.0.20 to 2.0.22 (#4621)
Bumps [pocketmine/locale-data](https://github.com/pmmp/Language) from 2.0.20 to 2.0.22.
- [Release notes](https://github.com/pmmp/Language/releases)
- [Commits](https://github.com/pmmp/Language/compare/2.0.20...2.0.22)

---
updated-dependencies:
- dependency-name: pocketmine/locale-data
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-06 15:01:12 +00:00
8ed9551ac9 Bump pocketmine/binaryutils from 0.2.2 to 0.2.3 (#4620)
Bumps [pocketmine/binaryutils](https://github.com/pmmp/BinaryUtils) from 0.2.2 to 0.2.3.
- [Release notes](https://github.com/pmmp/BinaryUtils/releases)
- [Commits](https://github.com/pmmp/BinaryUtils/compare/0.2.2...0.2.3)

---
updated-dependencies:
- dependency-name: pocketmine/binaryutils
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-06 14:59:42 +00:00
4d2d0f1d35 changelog: mention removal of Player->getLowerCaseName()
closes #4618
2021-12-06 00:58:21 +00:00
cac9db9bcc changelog: fixed mistake in CreativeInventory documentation, closes #4616 2021-12-05 15:01:45 +00:00
300d194185 CS again 2021-12-05 01:09:03 +00:00
13340a21d3 fix CS 2021-12-05 01:01:16 +00:00
27f599793a tools: added old-but-gold server-ping.php 2021-12-05 01:00:24 +00:00
527e975fa9 shut 2021-12-05 00:45:23 +00:00
8e37f86480 Avoid file_put_contents() when overwriting files
this fixes many cases of corruption during disk-full situations - file_put_contents() would write an empty file, destroying the original data.
fixes #3152
2021-12-05 00:26:48 +00:00
8e8cee45b8 Config: use JSON_THROW_ON_ERROR for encoding 2021-12-04 21:44:12 +00:00
1a046c6cd5 LevelDB: fixed server crash when corrupted / invalid blockstate NBT is encountered 2021-12-04 18:17:17 +00:00
e61aaaccca LevelDB: removed hack for problem fixed by 1f9400f901 2021-12-04 16:20:57 +00:00
1b86355c40 Server: Suppress "Minecraft network interface running" messages if RakLibInterface registration is cancelled (#4603) 2021-12-02 20:29:01 +00:00
1669d33f7e Updated DevTools submodule to pmmp/DevTools@39510af5bc 2021-12-02 00:58:15 +00:00
2da65c5a6e 4.0.1 is next 2021-12-01 22:33:58 +00:00
468faa464b Release 4.0.0 2021-12-01 22:33:52 +00:00
59de045ecb PM4 LET'S GOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
Merge branch 'master' into stable
2021-12-01 22:19:37 +00:00
bd8308cc6f changelog: mention pocketmine subdirectory removal 2021-12-01 22:15:38 +00:00
edc3bae172 Merge branch 'stable' 2021-12-01 22:11:44 +00:00
06e7030817 Prepare changelog for 4.0.0 2021-12-01 22:09:34 +00:00
cb0af44ccb start.sh: improve errors when PHP isn't found 2021-11-30 23:51:35 +00:00
d535f02096 Make nicer errors for PHP binary not being found 2021-11-30 23:45:25 +00:00
7665f4f443 start.sh: remove 7 2021-11-30 23:43:17 +00:00
20d6b69813 3.26.2 is next 2021-11-30 22:27:42 +00:00
6b7d0307af Release 3.26.1 2021-11-30 22:27:42 +00:00
baeac2eb07 Fixed tiles not being sent with chunks 2021-11-30 22:19:28 +00:00
2850ea1e89 4.0.0-BETA16 is next 2021-11-30 19:27:05 +00:00
d560cf17fc Release 4.0.0-BETA15 2021-11-30 19:27:04 +00:00
3f6efd0018 Merge branch 'stable' 2021-11-30 19:20:40 +00:00
aea124af74 Fix inconsistent class name 2021-11-30 19:17:26 +00:00
8620e67d88 Protocol changes for 1.18.0 2021-11-30 19:16:38 +00:00
d5f81fe261 3.26.1 is next 2021-11-30 18:53:36 +00:00
0aeac3af7d Release 3.26.0 2021-11-30 18:53:36 +00:00
9931c1d50a Protocol changes for 1.18.0 2021-11-30 18:46:29 +00:00
d21a3d8750 4.0.0-BETA15 is next 2021-11-30 01:26:07 +00:00
6d62b06ce6 Release 4.0.0-BETA14 2021-11-30 01:26:07 +00:00
8be92d16fe Merge branch 'stable' 2021-11-30 01:19:54 +00:00
8079ae341a Updated build/php submodule to pmmp/php-build-scripts@bd329dba08 2021-11-30 01:19:14 +00:00
ba295dc7dc Always use LF in .neon files 2021-11-30 01:16:28 +00:00
38325c8573 Updated translations 2021-11-30 01:14:21 +00:00
f239b077b9 Fixed PHPStan complaints 2021-11-30 00:36:38 +00:00
6f8f460a6c Partially revert "ConsoleReaderChildProcess: Commit suicide in more cases"
This reverts commit cbe0f44c4f.

This achieves the same result as the reverted commit wrt. process in the
same manner (writing a keepalive into the socket and checking if it
failed to send). However, it does _not_ allow the process to die on
reaching pipe EOF, since this can cause many spams of subprocesses when
stdin is actually not a tty (e.g. in a Docker container).
2021-11-30 00:27:52 +00:00
882df94bcb ConsoleReaderThread: fixed zombie process leak 2021-11-29 23:45:10 +00:00
4a8ca603a1 Log a message when forceShutdown() is called for anything other than a graceful shutdown 2021-11-28 18:53:34 +00:00
52f0c4f3ed Removed dodgy test using invalid block metadata 2021-11-27 22:51:14 +00:00
e2815eed60 BlockFactory: remap a bunch more invalid states 2021-11-27 20:07:58 +00:00
932a88764c composer commands suck 2021-11-27 04:07:25 +00:00
9540193766 Fixed everything lighting on fire 2021-11-27 03:54:30 +00:00
cc23e0b7a1 Updated DevTools submodule to pmmp/DevTools@6af57741e6 2021-11-27 03:52:32 +00:00
1f9400f901 World: automatically remap invalid blockstates on chunk load
this fixes a wide range of blocks with invalid blockstates becoming update! blocks on the client.

The most common occurrence of this was air with nonzero metadata left behind by world editors which set blockIDs but not block metadata. This caused large ghost structures of update! blocks to appear from nowhere.

The performance impact of this is very minimal (20 microseconds per chunk load in timings, compared to average 660 microseconds to load tiles).
2021-11-27 01:12:30 +00:00
e5149756a8 WorldTimings: fixed merge error introduced by 3bf87378ef 2021-11-27 00:06:09 +00:00
bc18969a09 Merge branch 'stable' 2021-11-26 23:45:09 +00:00
c19174a174 3.25.7 is next 2021-11-26 23:37:47 +00:00
f95142f6b6 Release 3.25.6 2021-11-26 23:37:46 +00:00
7ace24caab Fixed borked build number
this was a problem before the recent clean-up; the only reason it just decided to show now is because 2000+25 is valid PHP code, so PHP saved our asses.
2021-11-26 23:36:19 +00:00
32f619ac49 3.25.6 is next 2021-11-26 23:20:48 +00:00
1bb6ac4fb6 Release 3.25.5 2021-11-26 23:20:40 +00:00
533d3aae8b Merge branch 'stable' 2021-11-26 22:41:18 +00:00
52a891ba73 shut 2021-11-26 22:32:25 +00:00
71b813d4f9 Define pocketmine\BUILD_NUMBER from phar metadata
this way we don't have to patch the code (no idea why we were doing that anyway).
2021-11-26 22:27:58 +00:00
f2540a72ad Backport improved make-release.php from PM4 2021-11-26 22:10:46 +00:00
03f13495b7 Merge branch 'stable' 2021-11-26 21:59:55 +00:00
7e0f6c02a1 Updated build/php submodule to pmmp/php-build-scripts@a59722c676 2021-11-26 21:59:39 +00:00
1bc7869f6e Added remapping for almost 4000 invalid blockstates
when a block has sole ownership of an ID, the state bitmask can be ignored and we can just claim the whole metadata range for that single block.
This fixes a large number of issues with unknown blocks on older worlds where world editors did not remove the metadata, although update blocks will currently still appear on initial chunk send due to lack of AOT conversion (TODO).
2021-11-26 01:58:52 +00:00
5556861000 ItemFactory: move SweetBerries registration to the correct place 2021-11-26 00:46:35 +00:00
7dd5d0b593 4.0.0-BETA14 is next 2021-11-25 00:40:43 +00:00
9338d42742 Release 4.0.0-BETA13 2021-11-25 00:40:40 +00:00
9346ecdc39 Merge branch 'stable' 2021-11-25 00:01:48 +00:00
c023c02b6c MemoryManager: Removed obsolete workaround for $GLOBALS not being defined on threads
this was long since fixed, and everyone has since been forced to upgrade to pthreads 4.0.0, which definitely has the fix.
2021-11-24 23:57:55 +00:00
bb7683158f Remove dead ignoreErrors patterns 2021-11-24 23:52:51 +00:00
fad96b77ce stfu 2021-11-24 23:49:56 +00:00
40575a6dcf Merge branch 'master' of github.com:pmmp/PocketMine-MP 2021-11-24 23:43:03 +00:00
40f8f042da Merge branch 'stable' 2021-11-24 23:42:53 +00:00
0fe6038c41 Merge branch 'stable' 2021-11-24 23:41:40 +00:00
adff561483 phpstan: go nuclear on OPcache
when using dynamic reflection (which is the default), any time static reflection comes into play, bad shit starts to happen because of FileReadTrapStreamWrapper.
I attempted to fix these issues (phpstan/phpstan-src#801) and failed miserably.
So, to save the hassle, it's time to just remove OPcache from the picture (which, unfortunately, also means that PHPStan will not benefit from JIT).
2021-11-24 23:40:54 +00:00
ad56392d95 Skull: fixed calculation of collision boxes (#4591) 2021-11-24 21:42:51 +00:00
472ffb28ff ScriptPluginLoader: use parseDocComment() instead of reinventing the wheel 2021-11-24 17:22:49 +00:00
726c5652f7 ScriptPluginLoader: fixed reading @tags from non-docblock lines preceding the first docblock 2021-11-24 17:07:34 +00:00
b784a04e08 Utils: fixed parseDocComment() ignoring tags containing hyphens 2021-11-24 16:38:37 +00:00
5c7125f190 Improved error handling for loading broken entity / tile data 2021-11-23 17:41:26 +00:00
eb0cf52d81 Remove useless code (#4590) 2021-11-23 17:09:33 +00:00
d8f0fd0a7e McRegion: skip chunks with TerrainGenerated=false
legacy PM used to save even ungenerated chunks, and omitted some tags when doing so which we expect to always be present.
2021-11-23 01:49:48 +00:00
fb0eebc0dc RegionWorldProvider: Show a more specific message on missing required ByteArrayTags 2021-11-23 01:39:35 +00:00
020cd7b966 CrashDump: fixed encodedData being uninitialized before getEncodedData() is called 2021-11-22 22:31:07 +00:00
c37c261c0f Separate crashdump file generation from crashdump data collection
this allows CrashDump to be used just to generate data, which will come in useful for non-crash error reporting in the future (e.g. packet decoding errors).
2021-11-22 22:19:40 +00:00
2bb97d8904 Be quiet CS 2021-11-22 15:40:47 +00:00
d3878b2d57 fixed spam 2021-11-22 15:37:33 +00:00
cbe0f44c4f ConsoleReaderChildProcess: Commit suicide in more cases
this makes it slightly less annoying to get rid of as an orphan process, though it still won't immediately die.
2021-11-22 14:58:45 +00:00
37622e02b8 Updated translations 2021-11-21 21:11:39 +00:00
ed8b4950a3 Updated BedrockProtocol 2021-11-21 21:10:58 +00:00
fc7d297f60 Added missing fields of StructureSettings 2021-11-21 20:51:35 +00:00
7b4ef293bd NetworkBinaryStream: fixed incorrect field types for StructureSettings 2021-11-21 20:49:00 +00:00
c72d66f370 Merge branch 'stable' 2021-11-20 18:28:55 +00:00
3683884b9c Updated build/php submodule to pmmp/php-build-scripts@7a2ab5b922 2021-11-20 18:27:43 +00:00
37e8b1ee8c Merge branch 'master' of github.com:pmmp/PocketMine-MP 2021-11-20 18:25:45 +00:00
046dafc34f Merge branch 'stable' 2021-11-20 18:25:30 +00:00
db135788b9 Updated transient dependencies 2021-11-20 18:19:27 +00:00
b34e6f53eb Changed visibility of Projectile->move to Protected. (#4585) 2021-11-19 23:21:10 +00:00
b4b954cc5f build/generate-registry-annotations: accommodate code with CRLF 2021-11-19 21:38:43 +00:00
7210db25b0 Bump phpstan/phpstan from 1.1.2 to 1.2.0 (#4583)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.1.2 to 1.2.0.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/master/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.1.2...1.2.0)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-19 14:42:01 +00:00
4599913034 Separate crashdump rendering from crashdump data collection
this allows this code to be reused for reproducing crashdumps based on the original data.
2021-11-18 00:58:20 +00:00
c48aa274e7 Merge branch 'master' of github.com:pmmp/PocketMine-MP 2021-11-15 22:52:47 +00:00
269231c228 Ban foreach(arrayWithStringKeys as k => v)
this is not as good as phpstan/phpstan-src#769 (e.g. array_key_first()/array_key_last() aren't covered by this, nor is array_rand()) but it does eliminate the most infuriating cases where this usually crops up.
2021-11-15 22:52:05 +00:00
4cad552909 Allow input of relative coordinates to setworldspawn command (#4575) 2021-11-14 20:07:37 +00:00
f2d5455c5e changelog: mention that armor right-click equipping is now supported
[ci skip]
closes #4570
2021-11-14 16:42:35 +00:00
65247b7248 changelog: add notes about ender inventory
closes #4569
2021-11-14 16:41:57 +00:00
2f408708f0 Explosion: fixed blocks with tiles not using said tiles for drop info
closes #4571
2021-11-14 16:27:47 +00:00
3dd03075cb StringToItemParser: added some quality-of-life aliases 2021-11-14 15:52:50 +00:00
82b5bca83e Merge branch 'master' of github.com:pmmp/PocketMine-MP 2021-11-14 15:52:05 +00:00
639867a640 Added missing aliases for wooden items 2021-11-14 15:51:41 +00:00
d4a382d568 Fix position of setworldspawn command (#4574)
* The world spawn position is no longer rounded

* Remove round() since the position is always int
2021-11-14 15:40:20 +00:00
399824c31c Add correct drop for Podzol (#4573) 2021-11-14 14:15:36 +00:00
ada469bc45 README: do not show beta releases on badge
[ci skip]
2021-11-12 01:35:39 +00:00
dc8243f88b Bump phpstan/phpstan from 1.1.1 to 1.1.2 (#4564)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.1.1 to 1.1.2.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/1.1.1...1.1.2)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-12 00:24:23 +00:00
7668171c56 Merge branch 'master' of github.com:pmmp/PocketMine-MP 2021-11-12 00:17:07 +00:00
e4754ab029 PluginBase: Improved error messages for commands containing illegal characters 2021-11-12 00:16:53 +00:00
3276047497 Updated composer dependencies 2021-11-12 00:13:22 +00:00
49a8eff11e BUILDING: submodules are no longer required
submodules are useful (e.g. devtools, build/php) but they are not required to build a server phar.
2021-11-11 14:29:56 +00:00
73592349cd 4.0.0-BETA13 is next 2021-11-09 16:50:46 +00:00
635a9143de Release 4.0.0-BETA12 2021-11-09 16:50:42 +00:00
c3ec9c0948 Effect default duration is once again NOT hardcoded, like PM3
I have no fucking idea why I hardcoded this to begin with. Not one of my better ideas ...
2021-11-09 01:52:47 +00:00
09a2e006a8 CS AGAIN 2021-11-09 00:20:06 +00:00
fed59d3ebe added missing file 2021-11-09 00:11:39 +00:00
c7beb0a702 Clean up inventory auto close mess from PM3
on PM3 there was no concept of 'current window', we had no idea which window the player was actually looking at.
2021-11-08 23:51:25 +00:00
5be429a8c4 Ensure inventories get evacuated on server-side window close 2021-11-08 23:48:05 +00:00
ab002ca06d Improved handling of temporary inventory windows
evacuation behaviour is now consistent regardless of who is doing it
2021-11-08 23:36:58 +00:00
6efb1db107 Fixed inventories not working after dying with inventory open
closes #4185
closes #4177
2021-11-08 23:04:00 +00:00
6fdcfb01c8 Seal up main inventory open/close logic inside InventoryManager where it belongs 2021-11-08 22:58:06 +00:00
1beec348f9 3.25.5 is next 2021-11-08 22:33:09 +00:00
7306a2d939 Release 3.25.4 2021-11-08 22:33:08 +00:00
4bf338f783 Player: fixed removeWindow() causing all other inventories to be unopenable 2021-11-08 22:29:14 +00:00
255ff63fda 3.25.4 is next 2021-11-08 20:35:15 +00:00
d72f6a3ac6 Release 3.25.3 2021-11-08 20:35:14 +00:00
93a1e84ad9 TypeConverter: further simplification 2021-11-08 20:27:53 +00:00
c33f97ae41 TypeConverter: clean up absurdly overcomplicated bullshit in createInventoryAction() 2021-11-08 20:18:19 +00:00
cc4bb91fcb Implemented IPv6 support (#4554) 2021-11-08 20:03:28 +00:00
eb9012401b Merge branch 'stable' 2021-11-08 19:53:56 +00:00
3b34268ed6 Human: try to trap this stupid float cast bug in the wild 2021-11-08 19:48:39 +00:00
4c07078586 Merge branch 'stable' 2021-11-08 19:01:08 +00:00
19a3efe893 ....... 2021-11-08 18:57:14 +00:00
a1ecdc27e5 Removed Vanilla*::fromString()
these were misbegotten and should never have existed.
If someone really needs these for some reason, they can use getAll()[name].
2021-11-08 18:52:14 +00:00
f93b5be789 Added new dynamic StringToEffectParser 2021-11-08 18:49:28 +00:00
1fb60b5b3a CS fix again 2021-11-08 18:45:05 +00:00
08420c2556 Added new dynamic StringToEnchantmentParser
this should be used instead of VanillaEnchantments::fromString(), because it allows registering custom aliases.
2021-11-08 18:44:15 +00:00
18f5fb66bb Abstract the base functionality of StringToItemParser 2021-11-08 18:37:05 +00:00
a6f6b60bed fix CS again 2021-11-08 18:02:24 +00:00
c6c992a1f0 Preparations for negative Y support 2021-11-08 17:28:22 +00:00
df39a1ca07 TeleportCommand: do not hardcode world bounds 2021-11-08 17:22:01 +00:00
be6d1843de Merge branch 'master' of github.com:pmmp/PocketMine-MP 2021-11-08 17:17:20 +00:00
2b0b9bd8ed Update composer dependencies 2021-11-08 17:16:57 +00:00
76dad46e13 Bump phpstan/phpstan from 1.0.2 to 1.1.1 (#4560)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.0.2 to 1.1.1.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/1.0.2...1.1.1)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-08 13:36:06 +00:00
eb3530b6e6 Use pmmp/setup-php-action to compile PHP 2021-11-07 23:13:56 +00:00
4131bcef08 Changed "Level" string to "World" in Position::__toString() method. (#4559) 2021-11-07 21:11:55 +00:00
b84f7c18ec Install ext/crypto from PECL 2021-11-07 19:18:09 +00:00
45edb94607 Crafting tables now work the same way as anvils and enchanting tables
Removing almost all special-case logic for crafting tables.
2021-11-07 16:20:07 +00:00
6b316dc29a PluginManager: Make declaration of duplicate permissions a load error 2021-11-06 17:05:37 +00:00
d9d37f7fa6 ResourcePacksPacketHandler: fixed a mistake from c773e43eda
fixes #4557

Note: you may need to clear your local pack cache in order to get it working again.
2021-11-06 16:45:14 +00:00
4cb6c7dc1e PluginManager: fixed plugins being able to alter groups of other plugins' permissions
this could happen if a plugin declared a permission already declared by another plugin, and then declared a different default for it (e.g. true instead of op).
2021-11-06 16:32:19 +00:00
b392651354 pocketmine.yml: always refer to worlds as worlds in config comments, not levels 2021-11-06 02:22:14 +00:00
f81c55ce6c 4.0.0-BETA12 is next 2021-11-06 01:17:03 +00:00
002feacf8e Release 4.0.0-BETA11 2021-11-06 01:16:58 +00:00
b8523f7a18 Player: fix the fix which just degraded performance
if a chunk was requested for generation, count++ and count(activeRequests)++, which means that we would only get to submit half as many generation requests as we're allowed to.
Calculate the limit at the start and remember it instead.
2021-11-06 01:00:35 +00:00
640e88009b Player: fixed a mistake in generation rate limit
we don't want to allow sending further chunks when we haven't generated near ones, because we won't be able to see them anyway, and we might end up not needing them.
This now fully matches the results of PM3.
2021-11-06 00:57:37 +00:00
6cd272c9e1 Update transient composer dependencies 2021-11-06 00:55:13 +00:00
566c57bcd3 we no longer need submodules for these jobs 2021-11-06 00:35:39 +00:00
3c754b079c Move resources/locale to Composer dependency
all remaining submodules are now non-essential to running a server.
They are also versioned and updates can be done automatically using 'composer update'.

Finally, we can also put an end to the issue of translations being rendered incorrectly or being missing due to outdated submodules.
2021-11-06 00:32:58 +00:00
dbf9a33160 ChunkSelector: Improve algorithm to send chunks in proper circles, instead of squares
this ensures that the edge of loaded terain is always the same distance
away in any direction. This also means that when flying parallel to X or
Z axes, you now have about 12% more chunks directly in front of you,
instead of to your left and right, which gives the impression that
chunks are loading faster (they aren't, they are just being ordered in a
more sensible way).
2021-11-06 00:15:04 +00:00
07b1cff306 Bonemeal is no longer consumed when cancelling plant growth events (#4551) 2021-11-05 16:15:55 +00:00
0989c77037 Player: check that horizontal distance travelled is > 0 before adding exhaustion, or triggering a new chunk order
closes #4548
2021-11-05 15:46:55 +00:00
5107d0df4e Player: cap maximum number of active generation requests
this fixes the horrible spotty chunk loading seen in https://twitter.com/dktapps/status/1456397007946461190?s=20.
In practice, this made chunks invisible on teleport for several tens of seconds after teleporting. Having a larger chunks-per-tick with large render distance compounded to worsen the problem.
It wasn't really noticeable on small render distances, but very obvious on large ones with fast chunk sending and slow generation.

This also fixes #4187 (at least to the extent that it works on PM3, anyway).
2021-11-05 15:09:42 +00:00
579ef63663 EntityDataHelper: accept FloatTag for vector3 as well as Double
MCPE uses Float for entity positions.
2021-11-04 20:46:34 +00:00
8abc952c74 simulate-chunk-selector: do not reallocate colours on every frame 2021-11-04 19:38:40 +00:00
4c3a5fdd73 Clean PHPStan baselines from 1.0.2 2021-11-04 19:28:52 +00:00
54f287feb6 Merge branch 'stable' 2021-11-04 19:27:41 +00:00
84f8b3eb2d Move CrashDump to pocketmine\crash namespace 2021-11-04 19:23:45 +00:00
15fca84f3b remove some PHPStan error patterns 2021-11-04 19:22:49 +00:00
c60144210f Regenerate PHPStan bugs baseline 2021-11-04 19:18:29 +00:00
8ac999cbd4 Use object models for crashdump generation 2021-11-04 16:55:04 +00:00
4f8501ff34 Added a tool to visualise behaviour of ChunkSelector
I actually intended to write a tool for debugging generation, but it turns out this, as an intermediary step, is also useful and a whole bunch of fun to play with.
2021-11-04 14:14:55 +00:00
2405e45b35 Player: mark as not using item when held item slot is changed
closes #4538
2021-11-03 21:26:20 +00:00
e0b07ff308 Human: do not add more XP if totalXp limit was already reached
this matches the vanilla behaviour. For some reason it doesn't consider levels (so you can have a level higher or lower than this without actually having that amount of XP), but this matches Java behaviour as of 1.10.

fixes #4543
2021-11-03 20:45:55 +00:00
729f831b8f PHPStan 1.0.2 2021-11-03 20:26:32 +00:00
0356716e8e PopulationTask: do not expose internal fields as public
this code dates back to pthreads v2, when visibility on Threaded object fields meant different things (wtf, krakjoe??)
2021-11-03 15:23:43 +00:00
5c81b04813 PopulationTask: use typed properties 2021-11-03 15:22:49 +00:00
1ebb206762 World: fixed yet another edge case in drainPopulationRequestQueue() leading to assertion failure
really had to go fucking nuclear on it :(
2021-11-03 14:58:58 +00:00
29e2d92098 Bump phpstan/phpstan from 1.0.0 to 1.0.1 (#4541)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/1.0.0...1.0.1)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-03 11:27:42 +00:00
ef82a2cd79 Fixed PlayerEmoteEvent::setEmoteId() being useless 2021-11-02 23:10:26 +00:00
87031627bf Do not call PlayerEmoteEvent if rate limit was reached 2021-11-02 23:09:43 +00:00
f066199971 Implement emote support (#4523) 2021-11-02 23:04:55 +00:00
a0e9eec652 4.0.0-BETA11 is next 2021-11-02 19:18:20 +00:00
fa6a432d58 Release 4.0.0-BETA10 2021-11-02 19:18:19 +00:00
102277c636 draft-release: fixed BedrockData JSON minification 2021-11-02 19:16:36 +00:00
f50f26d52e 4.0.0-BETA10 is next 2021-11-02 19:14:15 +00:00
4ca7c29cde Release 4.0.0-BETA9 2021-11-02 19:14:12 +00:00
9f64bc8180 Merge branch 'stable' 2021-11-02 17:30:36 +00:00
f75a05d7fa 3.25.3 is next 2021-11-02 17:21:49 +00:00
3dae873731 Release 3.25.2 2021-11-02 17:21:44 +00:00
aa0dc60c32 Merge branch 'master' of github.com:pmmp/PocketMine-MP 2021-11-02 17:10:19 +00:00
d184838ba0 Move Promise classes to their own namespace 2021-11-02 17:10:07 +00:00
ead8ccf08d CocoaBlock: call BlockGrowEvent when growing for any reason (#4536) 2021-11-02 17:05:07 +00:00
38f97bed52 World: fixed PopulationTask failed assumption that generator is always registered
if the worker selected previously had a generator registered, but has since been shutdown, the workerStartHook that cleans up generatorRegisteredWorkers won't yet have been called.
This results in the worker being started by the submission of PopulationTask, and the generator doesn't get preemptively registered.
2021-11-02 16:58:14 +00:00
275f145418 BedrockData is now a Composer dependency
this should put a stop to people nagging me about incorrect blocks (we have a check to make sure composer dependencies are up to date).
2021-11-02 16:45:45 +00:00
6b07f7a5ec pmmp/BedrockProtocol@5.0.0+bedrock-1.17.40 2021-11-02 16:22:56 +00:00
e131c2cefa Drop pocketmine/spl 2021-11-02 16:08:29 +00:00
e34364412b Replace InvalidStateException usages with InvalidArgument or LogicException 2021-11-02 16:05:54 +00:00
4eef458d29 Config: throw AssumptionFailedError if config type is invalid or DETECT during save()
this should never happen ... it was already checked in load()
2021-11-02 16:03:43 +00:00
8b3565b75d PopulationTask no longer depends on a World object
this means it's now possible to test generation offline without too much hassle.
World::generateChunkCallback() has been removed from public API.
2021-11-02 15:40:51 +00:00
facfd7c04a sanity check 2021-11-02 15:26:54 +00:00
65ef9f786a Use standard chunkHash() to index population chunks 2021-11-02 15:25:03 +00:00
4dc13ab3da ConsoleReaderThread: strip control characters
this fixes a bug I encountered when accidentally pressing ctrl+a+d (which inserts a chr(1) character), because it made the server unable to find the command - but still reported an error containing what looked like a valid command (character isn't printable).
2021-11-02 15:11:23 +00:00
ede4157814 Check to see if the player can start using the Releasable item. (#4532) 2021-11-02 14:36:16 +00:00
34ea199fb0 World: fixed additional edge case - population promise rejected before task completion
if this happened, the index would stay set in activeChunkPopulationTasks, eventually causing the generation queue to jam up completely and non-forced generation to come to a standstill.
2021-11-02 14:30:23 +00:00
1775699f05 World: make sure that chunks locked by PopulationTask always get unlocked, no matter what
fixes #4527
2021-11-02 14:20:42 +00:00
32a857b8b4 fix CS 2021-11-02 14:09:16 +00:00
7e4be29fc4 Gracefully force-shutdown on failure to start RakLib
this now won't generate a crashdump.
2021-11-02 13:51:01 +00:00
c17587d436 World: use new Vector3() instead of Block->getPosition()
When profiling this, I noticed that we spend a stupidly large amount of time creating useless Position objects in the case of update=true, because Vector3->sides() calls Position->getSide(), which calls Position::fromObject(parent::getSide()). This is stupid because the update logic doesn't require Positions anywhere (as evidenced by this change needing no other alterations.

A rough profile shows that this improves setBlock() performance by about 25% in the update=true case, which is a pretty big margin.
As an added bonus, it gets rid of some unrealized cyclic dependencies in World->changedBlocks.
2021-11-02 03:00:00 +00:00
0f6b7e48cb Updated BedrockProtocol:
it's weirdly satisfying that LevelChunkPacket::create() with the extra parameter turns out to be exactly the same length as the old way.
2021-11-02 01:37:56 +00:00
f2912fcdd8 Updated pocketmine/log and pocketmine/log-pthreads (BC breaks included)
AttachableLogger deals with Closures now instead of LoggerAttachment objects
ThreadedLoggerAttachment no longer implements LoggerAttachment
2021-11-01 22:22:22 +00:00
f6cb4f9597 Updated BedrockProtocol 2021-11-01 21:32:02 +00:00
54442f7e4b Merge branch 'stable' 2021-11-01 21:18:35 +00:00
5257755dc5 shut 2021-11-01 21:15:58 +00:00
8c16ecaa5b Merge branch 'stable' 2021-11-01 21:08:32 +00:00
3214da8642 pthreads 4.0.0 2021-11-01 21:01:59 +00:00
f827a555d5 Merge branch 'stable' 2021-11-01 18:13:24 +00:00
61145baded Merge commit 27ae959e8 2021-11-01 17:42:31 +00:00
4d54d6c552 Merge commit f8f39687e2 2021-11-01 17:41:47 +00:00
485bc2c565 Merge commit 94737934de 2021-11-01 17:41:10 +00:00
07b4f844a9 Merge commit debb469de1 2021-11-01 17:40:40 +00:00
19e5775f6b Merge commit 73dc0598e4 2021-11-01 17:40:06 +00:00
804fb3f603 Merge commit 141fbde660 2021-11-01 17:39:40 +00:00
6175b03433 Merge commit 69952ae2af 2021-11-01 17:36:34 +00:00
a78248a19c Merge commit '71f2a34616961d6328f06fd911b6d4450a61643e' 2021-11-01 17:33:02 +00:00
414ccb9f10 Merge commit 'd17cd658030e66009c0bb32941387c7444d3ffe0' 2021-11-01 17:31:05 +00:00
794142fe49 Merge l7/l8/l9 baselines into actual-problems
it doesn't serve any practical purpose to keep these separated, particularly since it's getting so difficult to figure out which errors are coming from which levels (since we always use 9, it doesn't really make any difference).
2021-11-01 17:27:31 +00:00
ff27c5f7db PHPStan 1.0.0 2021-11-01 17:24:20 +00:00
4d4362801f AvailableCommandsPacket: remove dead code 2021-11-01 17:01:26 +00:00
0babe0a1ab LevelDB: remove unused private method 2021-11-01 16:55:05 +00:00
d696ebcda3 Level: do not use static:: to access levelIdCounter
the field is private.
2021-11-01 16:52:27 +00:00
c3768b997a Updated to pmmp/BedrockProtocol@146498c279 2021-11-01 16:13:33 +00:00
f6480017ce Update PHPUnit dependency junk 2021-11-01 16:12:37 +00:00
9f5c16bc46 Projectile: use closure instead of do/while for reading id/data of block
not ideal, but whatever I guess... this at least provides scope isolation
2021-11-01 15:56:28 +00:00
8865bb73ba BanEntry: remove useless do/while 2021-11-01 15:52:55 +00:00
2dee1dbc28 Remove ridiculous code in ResourcePackManager 2021-11-01 15:41:21 +00:00
0f0b6f0efa Utils: eliminate usages of backtick operator 2021-11-01 15:25:56 +00:00
d5f13d8be2 Timezone: make PHPStan 1.0 happy 2021-11-01 15:24:16 +00:00
27ae959e89 Terminal: backport shell_exec() code from PM4 to make PHPStan 1.0 happy 2021-11-01 15:23:36 +00:00
f8f39687e2 Achievement: declare proper type for $list static property 2021-11-01 15:22:33 +00:00
94737934de PlayerDeathEvent: fixed LSP violation reported by PHPStan 1.0 2021-11-01 14:17:54 +00:00
debb469de1 Updated PHPUnit dependency junk 2021-11-01 13:54:04 +00:00
616eb0050d World: remove premature optimisation of setBlockAt() introduced by ece28e5d7b
closes #4531
it turns out that letting the light updates themselves handle this is faster than trying to get in the way.
2021-11-01 02:34:44 +00:00
9d30bc8b95 World: fixed assertion failure when requesting, cancelling, and then re-requesting chunks via requestChunkPopulation()
if the request/cancel/re-request happens all in the time before the queue gets drained, chunk hashes may appear multiple times in the queue. We don't want to process them twice if this happens (although it's mostly harmless anyway).
2021-11-01 02:17:11 +00:00
46b7d35cd3 Player: return from callback if used chunk status is not REQUESTED_GENERATION()
this can happen especially on large render distances when flying fast and changing direction - we decide we don't want the chunk, then, after changing direction and re-ordering chunks, we decide we do want it again, and end up registering a second callback. In this case, we need to ensure that only one of the callbacks gets executed (it doesn't matter which one).
2021-11-01 01:45:49 +00:00
c781efcf90 World: avoid calling the same logic twice in requestChunkPopulation()
orderChunkPopulation() checks the preconditions too. Have them both call an internal function that doesn't.
2021-11-01 00:36:57 +00:00
e4a54f5b6a World: deduplicate code in request/orderChunkPopulation 2021-11-01 00:33:18 +00:00
afb54f1ae4 World: flip orderChunkPopulation() condition around
this makes it more obvious that the code is similar to requestChunkPopulation() barring one distinct difference.
2021-11-01 00:25:30 +00:00
8f803df511 World: check population locks _after_ checking if the chunk is already populated, not before
this led to another case where a population request would be queued up for an already-populated chunk for no reason.
2021-10-31 23:54:27 +00:00
f4a3c40b5c World: use better variable names in orderChunkPopulation() 2021-10-31 23:48:00 +00:00
9dec82cdbc World: fixed requestChunkPopulation() queuing requests for chunks which are already populated
this led to chunk sending getting bogged down if there were more than population-queue-size chunks waiting to be generated.
2021-10-31 23:40:34 +00:00
74031d2fbe World: remove the fulfilled promise from the population request map
fixes crash when unregistering chunk loaders
2021-10-31 23:05:12 +00:00
bd60e41268 Revert "Revert "Player: do not re-request the same ungenerated chunks multiple times""
This reverts commit 3265d3f6b4.
2021-10-31 22:57:56 +00:00
96cfdc79b8 World: fixed original promise not getting fulfilled if the chunk became populated=true after a promise was already made (but not fulfilled) to populate it
this could happen if a plugin calls setPopulated(true) on a chunk after a request for its population landed in the queue, but before it actually got processed. In that case, the promise would never get fulfilled.
2021-10-31 22:54:37 +00:00
2fa0a914ff World::orderChunkPopulation() may return a pre-resolved promise
this does not indicate a failure; it indicates that the chunk has already been successfully populated.
In this case, we shouldn't be putting the task back on the queue.

This is skirting around the real bug, which is that requestChunkPopulation() doesn't check if the target chunk is already populated before it creates a new promise that it will be.
2021-10-31 22:51:37 +00:00
08636d079d Promise: expose isResolved() 2021-10-31 22:48:52 +00:00
3265d3f6b4 Revert "Player: do not re-request the same ungenerated chunks multiple times"
This reverts commit 866020dfdb.

For some fucking reason this broke resending chunks in some cases (and
sending chunks at all in others). I don't have time to debug this right
now, so it's going to have to remain broken, infuriatingly enough.
2021-10-31 21:25:21 +00:00
0f78a2b5ef Advisory chunk locking for chunk population (#4513)
this allows chunks locked for population to be modified. If the PopulationTask detects that the chunk was modified during the onCompletion(), the result of the population will be discarded and rescheduled, so that it includes user modifications.
2021-10-31 21:11:20 +00:00
f1a791ef75 Improved Promise API - separate resolver and consumer APIs
this makes creating a promise slightly more cumbersome, but I'm more concerned about people who might try to call 'new Promise' directly.
2021-10-31 19:49:57 +00:00
866020dfdb Player: do not re-request the same ungenerated chunks multiple times
this doesn't affect chunk resends, since they'll be kicked back to NEEDED, which is detected by orderChunks().
2021-10-31 18:52:37 +00:00
c580bb2434 InGamePacketHandler: mark player as not using item in more cases
fixes #4355
2021-10-31 14:41:31 +00:00
4fe3f69702 World: eliminate final remaining 'no loaders attached' debug message on player creation 2021-10-31 14:33:27 +00:00
018006541e changelog: mention block-picking changes
[ci skip]
2021-10-31 14:12:12 +00:00
fbb91d123d World::unregisterChunkListenerFromAll(): go through unregisterChunkListener()
this ensures that everything gets cleaned up properly (e.g. player chunk listeners).
2021-10-31 14:03:40 +00:00
3dc75644d9 World: avoid duplicated logger code in initChunk() 2021-10-31 14:02:25 +00:00
1cabe4baf3 World: do not crash on duplicate tiles loaded from disk
closes #4049
2021-10-31 13:58:32 +00:00
73dc0598e4 CrashDump: remove derp space 2021-10-30 23:22:37 +01:00
faad2365e2 World: Register a temporary chunk loader on chunks used by PopulationTask
fixes #3839
2021-10-30 22:17:06 +01:00
4f816d03a7 SurvivalBlockBreakHandler: remove useless code 2021-10-30 21:35:58 +01:00
1d22761d27 Remove useless newline 2021-10-30 21:25:47 +01:00
5b8ce7e3e2 Cake: fixed desync on cancellation of eating
closes #3591
we don't support eating in creative right now, but the cake shouldn't appear to be eaten when it's not.
2021-10-30 21:02:24 +01:00
08f3c18de9 Arrow: do not add pickups to creative players' inventories
closes #2932
2021-10-30 17:16:46 +01:00
141fbde660 Player: fixed getting re-banned on rejoin after unban from hardcore death
closes #2175
2021-10-30 16:58:03 +01:00
465a509858 World: remove spammy debug message 2021-10-30 16:13:01 +01:00
69952ae2af Human: limit lifetime total XP range to INT32_MAX
closes #4484
2021-10-30 16:05:10 +01:00
71f2a34616 Entity: spawnTo() must silently swallow errors
Player->showPlayer() assumes that spawnTo() will take care of all the checks necessary to ensure we don't actually spawn a player to someone it shouldn't be able to see. In PM3, there's nothing we can do about that.
This could be a problem if anything decides to override spawnTo() to do additional stuff and assumes that the function will always succeed; however, there's not much reason to do that (plugins sending packets should override sendSpawnPacket() instead).
2021-10-30 15:38:27 +01:00
63dfcc60c3 4.0.0-BETA9 is next 2021-10-29 22:35:23 +01:00
428bd5ae91 Release 4.0.0-BETA8 2021-10-29 22:35:15 +01:00
d17cd65803 3.25.2 is next 2021-10-29 22:23:28 +01:00
a8d5e8c5f6 Release 3.25.1 2021-10-29 22:23:22 +01:00
19f448d074 pocketmine/math 0.4.0 2021-10-29 21:56:56 +01:00
1c18c731ef bootstrap: check for zlib raw support in leveldb 2021-10-29 19:15:12 +01:00
8a2ecfe1d4 Merge branch 'stable' 2021-10-29 19:04:01 +01:00
089e62b44e Entity::spawnTo(): verify that the target player belongs to the same world as the entity
this should never be hit in the PM case, but it's an InvalidArgument rather than AssumptionFailedError because plugins can and do call this with bad things.
2021-10-29 18:54:00 +01:00
32a34d2494 Location: change order of constructor parameters
to be consistent with Position::__construct() and Location::fromObject() (although Location::fromObject() has no choice, thanks to the anti-feature known as late static binding ...)
2021-10-29 15:43:09 +01:00
ee9f5e0044 Location: make __construct() parameters mandatory
I did consider allowing yaw/pitch to remain optional, but considering the implicit immutability of Location, it really doesn't make any sense to create a Location with default yaw/pitch - just create a Position in that case instead.
2021-10-29 15:40:58 +01:00
88b7389080 InventoryManager: reduce code duplication 2021-10-29 15:37:52 +01:00
f1cc168d26 phpstan: exclude a couple of files from analysis temporarily
close #4472
2021-10-29 00:23:13 +01:00
fb5543a2ad Updated BedrockProtocol dependency 2021-10-29 00:16:11 +01:00
a4eda9a8f5 World: call nearby entities' onNearbyBlockChange() in setChunk()
fixes #2779 in all known cases.
2021-10-28 23:59:32 +01:00
eb75df6f8e World: Intelligently perform automatic transfer or deletion of tiles in setChunk(), depending on the context
tiles may be deleted in the following circumstances:
1) the target block in the new chunk doesn't expect a tile
2) the target block in the new chunk expects a different type of tile (responsibility of the plugin developer to create the new tile)
3) there's already a tile in the target chunk which conflicts with the old one

In all other cases, the tile will be transferred.

This resolves a large number of unintentional bugs caused by world editors replacing chunks without setting the deleteTilesAndEntities parameter to false (even the core itself does it).

closes #4520
2021-10-28 23:48:17 +01:00
c66790b6a6 World: never delete entities in setChunk()
entities exist completely independently from chunks now, so there is no need to interact with them whatsoever.
As I wrote in #4520, there's no sense in deleting entities here, since a chunk replacement is essentially just a mass block update.

On that theme, it might be a good idea to call Entity->onNearbyBlockChange() for all entities in the target and adjacent chunks when replacing a chunk, to ensure that they get the proper movement updates.
2021-10-28 23:42:28 +01:00
d78801b9d5 World: fixed tiles and entities getting deleted when adjacent chunks are modified during population 2021-10-28 22:24:47 +01:00
d410db4302 Chunk: rename DIRTY_FLAG_TERRAIN to DIRTY_FLAG_BLOCKS
we use the word 'terrain' elsewhere to refer to the combination of blocks and biomes, so using TERRAIN here is misleading.
2021-10-28 22:11:07 +01:00
a62ce64fdd Revert "Chunk: added modification counter"
This reverts commit a5418a019d.

The more I assessed this, the more I realized that this implementation
doesn't actually offer any value. Since modcounters don't persist after
chunk unload + reload, they can't be reliably used to detect changes in
chunks without additional event subscriptions.
For the purpose I actually intended to use them for (population task
cancellation) there's a) another solution, and b) modcounts are
unreliable for that too, because of the aforementioned potential for
chunks to get unloaded and reloaded.
For the case of detecting dirty chunks within PopulationTask itself,
they are also unnecessary, since the dirty flags are sufficient within
there, since FastChunkSerializer doesn't copy dirty flags.

In conclusion, this was a misbegotten addition with little real value,
but does impact performance in hot paths.
2021-10-28 21:02:04 +01:00
5db3915aad Make MemoryManager aware of ChunkCache 2021-10-28 20:28:00 +01:00
eb40b741ae StandardPacketBroadcaster now splits broadcasts by session-specific PacketSerializerContext
in the normal case, all sessions will share the same PacketSerializerContext and Compressor, so this code will be the same as before
However, for the multi-protocol hackers out there, this should reduce the maintenance burden (@Driesboy) since now only the PacketSerializerContext needs to be maintained. I recommend a separate PacketSerializerContext for each protocol (perhaps put the protocol version in the serializer context too, if you need it for some reason).
2021-10-28 20:15:37 +01:00
b3720b3f17 4.0.0-BETA8 is next 2021-10-28 17:28:53 +01:00
7effa03ba4 Release 4.0.0-BETA7 2021-10-28 17:28:48 +01:00
d0474ccd92 make-release: note which channel the build will be released into 2021-10-28 16:29:20 +01:00
2b0768f720 make-release: fixed retention of +dev on release versions 2021-10-28 16:26:56 +01:00
dba148cfaa build/make-release: make arg parsing use getopt 2021-10-28 16:25:18 +01:00
48f77abe7e Leave channel ID in VersionInfo
so that I don't have to type it out every time I make a new release. Most of the time it's going to be posted to the same channel as before anyway.
2021-10-28 16:03:43 +01:00
bb05af103d PluginManager: fixed crash when using a plugin-loader plugin (read: devtools)
closes #4518
2021-10-28 15:55:05 +01:00
0ef5c67b9b Use static constructor for MovePlayerPacket
this marks the last of the packets created using the old way.
2021-10-27 21:10:16 +01:00
6d89265510 Player: reduce code duplication
back when this was just hardcoded >> 4 everywhere, nobody thought anything of it, but now it uses constants, it's easy to cross-reference and see where the duplicates are.
2021-10-26 23:02:50 +01:00
a7d8a598e1 World: reduce code duplication for chunk coordinate calculation 2021-10-26 22:58:17 +01:00
51fbff204b World: make PhpStorm understand return type of getAdjacentChunks() 2021-10-26 20:32:09 +01:00
1873457840 PopulationTask: stop using dynamic properties 2021-10-26 20:21:58 +01:00
fca70efbb1 World: move chunk population related methods to be in the same overall place 2021-10-26 16:44:08 +01:00
8f88393184 World: Specialize generateChunkCallback() for PopulationTask
this allows us to also set the adjacent chunks before calling ChunkPopulateEvent, to give a more accurate picture of what changed.
2021-10-26 15:28:00 +01:00
b9d9b69bbe ConsoleReaderThread: trim the string before returning it
it will have a newline at the end that was added by the subprocess when posting it to the main process.
2021-10-26 01:07:14 +01:00
1d99cd329a CS again 2021-10-26 00:50:43 +01:00
bd8cba1a7f Added unit tests for Utils::testValidInstance() 2021-10-26 00:49:41 +01:00
24d4daec90 Utils::testValidInstance() now accepts interfaces for the baseName 2021-10-26 00:32:32 +01:00
4178c81209 Utils: fixed testValidInstance() not accepting the same valid class for both className and baseName
this caused problems in PlayerCreationEvent because plugins set the base class and then set the player class to the same thing.
2021-10-26 00:31:30 +01:00
94f4ef5862 PopulationTask: Throw AssumptionFailedError if center chunk is null for some reason 2021-10-25 21:07:03 +01:00
2e2515354c PopulationTask: fixed undefined method call
fuck you PhpStorm! fuck you PhpStorm! fuck you PhpStorm!
2021-10-25 20:57:43 +01:00
359d0835f3 CS 2021-10-25 20:54:39 +01:00
d4cbde6f10 PopulationTask: use modification counters to detect changed chunks
instead of using terrain dirty flags, which aren't suitable for this purpose
2021-10-25 20:53:50 +01:00
a5418a019d Chunk: added modification counter
this is independent from the terrain dirty flags (which are specifically used to track state of chunks needing to be saved).
2021-10-25 20:53:11 +01:00
baba25953f Chunk: make all parameters of __construct() mandatory and non-nullable
having the constructor fill in defaults for these invariably causes bugs.
2021-10-25 20:22:50 +01:00
d53347454b Chunk: use HeightArray::fill() 2021-10-25 20:17:30 +01:00
401e8d117b Flat: use a less dumb way to build biome array 2021-10-25 20:15:33 +01:00
9835d75f65 Chunk: removed heighArray parameter from constructor
we don't pass this anywhere, and really it should be dynamically initialized anyway, just like light.
2021-10-25 20:13:50 +01:00
b8519d1af4 World: fixed every chunk having terrain saved at least once, even if unmodified
setPopulated() sets dirty flags on the chunk, causing the autosave sweep
to think they've been changed when they haven't. We now pass
terrainPopulated to the constructor to avoid this ambiguity recurring in
the future.
2021-10-25 19:53:47 +01:00
f6e53f826b Fixed Anvil/McRegion chunks getting autosaved on first time, even when unchanged
setGenerated/setPopulated and friends set hasChanged = true, which causes the world to autosave them the first time around, even though they weren't modified.
2021-10-25 19:52:44 +01:00
42ede30e77 ... 2021-10-23 23:57:28 +01:00
04aedc6494 Updated BedrockProtocol 2021-10-23 23:54:49 +01:00
701a71a4ee Sound::encode() position is no longer nullable
making this nullable was based on the invalid assumption that global sounds have no position, but it turns out they _do_ still use the position to make the sound come from the correct direction.
2021-10-23 02:01:26 +01:00
e50072dc27 Clean PHPStan baselines 2021-10-23 01:55:10 +01:00
c77829f4ad Migrate packet creation to use ::create() methods in all but one case
MovePlayerPacket doesn't yet have a ::create() due to a complication with fields that aren't always present.
2021-10-23 01:46:01 +01:00
c773e43eda Updated BedrockProtocol to pmmp/BedrockProtocol@97fa88e9ef 2021-10-23 01:16:45 +01:00
c262c2e726 Updated composer dependencies 2021-10-23 01:14:54 +01:00
a4b65d6a3f PlayerCreationEvent: verify that the class actually exists and is instantiable
this ensures that crashdumps blame the plugin instead of the core on bad classes, such as in this case: https://crash.pmmp.io/view/5331225
2021-10-21 20:37:45 +01:00
986b4e0651 Enforce single-line PhpDoc for properties where possible 2021-10-21 20:32:37 +01:00
2971bf30a5 actions: combine code verify into one step
this way the diff takes one less click to get to.
2021-10-21 00:30:19 +01:00
4f2bcb61d6 Fixed crashdump generation when crashing before PluginManager was created 2021-10-20 23:35:04 +01:00
e2275cc8ec PluginManager: Prevent infinite recursion in loadPlugins()
if a plugin calls loadPlugins(server->getPluginPath()) during its onLoad(), and it itself is in that plugin path, an infinite recursion will occur.
2021-10-20 23:10:18 +01:00
620874d902 PluginManager: Extract checkPluginLoadability() to a PluginLoadabilityChecker unit
this can be more easily unit-tested.
2021-10-20 22:31:56 +01:00
44508a138f Moved plugin extension requirement checks to PluginManager::checkPluginLoadability()
these don't really belong in PluginDescription.
2021-10-20 22:13:30 +01:00
aa408c9a97 Fixed 9646128d01 2021-10-20 21:54:57 +01:00
6d78a0b435 CS 2021-10-20 21:52:42 +01:00
76b4b23d98 PluginManager: remove loadPlugin()
loadPlugins() is now the preferred option, since it does all the proper checks.
In addition, the server now acknowledges that loading a single plugin may cause multiple plugins to be loaded, so returning only a single Plugin is not representative of what's actually happening.
2021-10-20 21:52:19 +01:00
03fcd844eb PluginManager::loadPlugins() now accepts files as well as directories
loadPlugins() is now a superior option to loadPlugin(), since it enforces dependency checks and also supports automatic loading of plugins when new loaders are installed.
2021-10-20 21:36:14 +01:00
fecc13f362 Merge branch 'master' of github.com:pmmp/PocketMine-MP 2021-10-20 21:23:14 +01:00
9646128d01 Updated resources/locale submodule to pmmp/Language@09c709f242 2021-10-20 21:22:56 +01:00
a788954551 Fixed dependency handling across plugin loaders (#3971) 2021-10-20 20:22:00 +01:00
dc07ac33d3 protocol: fixed missing field of CraftRecipeAuto 2021-10-20 19:47:32 +01:00
ec3986827c Update BedrockProtocol to 3.0.1, widen constraint to allow newer patch versions 2021-10-20 16:20:10 +01:00
09c840b66a Update transient composer dependencies 2021-10-20 16:19:20 +01:00
80b402e529 ItemTranslator: throw the proper exceptions when failing to map network IDs 2021-10-20 14:01:39 +01:00
a3f8546ac4 4.0.0-BETA7 is next 2021-10-19 19:13:43 +01:00
46920818b5 Release 4.0.0-BETA6 2021-10-19 19:13:43 +01:00
69cb575789 Merge branch 'stable' 2021-10-19 19:05:25 +01:00
fee6478cbe Updated BedrockData and BedrockProtocol for 1.17.40 support 2021-10-19 19:00:29 +01:00
9c5cec77b1 3.25.1 is next 2021-10-19 18:27:30 +01:00
f48b703533 Release 3.25.0 2021-10-19 18:27:26 +01:00
70636f6eb4 Protocol changes for 1.17.40 2021-10-19 18:00:34 +01:00
c70b80c273 ItemEntity: implement partial itemstack pickups in the dumbest way possible
Given the various limitations and flexibilities posed by EntityItemPickupEvent, I settled on this as the simplest way to deal with the problem.

- EntityItemPickupEvent may have its destination inventory changed, so we can't cache the result of getAddableItemQuantity() to use after the event.
- The item itself may have changed, so even if we thought we could add some items before the change, we might not be able to afterwards.

Considering the above facts, it's better to just give the whole itemstack to EntityItemPickupEvent, and let plugins use getAddableItemQuantity() on their own to decide if their chosen inventory can accommodate the item or not.
If it can't, then we'll just drop it on the ground.
This also fixes a potential issue where plugins changing the item to a custom one might end up with their items and the actual items both just vanishing if the target inventory was full.
closes #4499
2021-10-17 22:37:49 +01:00
a794d24c81 Added a tool to generate a Markdown document of all core permissions 2021-10-17 17:02:18 +01:00
8db5732b44 Drop respect/validation
it's not worth this turning into compatibility baggage just so that we can parse plugin_list.yml, especially when we have new ways to handle data parsing coming in the pipeline.
For something as small as plugin_list.yml, it's easier (and in this case better too) to just validate it manually (respect/validation was anyway too strict considering it's YAML we're dealing with).
2021-10-15 17:15:46 +01:00
48f809d3fa Removed another dead PHPStan error pattern
this was actually a PHPStan bug fixed in 0.12.99.
2021-10-15 17:01:09 +01:00
0348236860 fucking CS again 2021-10-14 15:56:50 +01:00
8c07748100 RakLibInterface: print packet exception info as a block using Utils::printableExceptionInfo() 2021-10-14 15:55:08 +01:00
06e7338ff9 Move exception printing utilities from MainLogger to Utils
where they can be useful to other stuff apart from just the logger
2021-10-14 15:54:20 +01:00
bdbfa70558 Server: break some isolated stuff out of Server::__construct() 2021-10-14 15:44:18 +01:00
7a4af7a0bc SignalHandler: fix CS
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
2021-10-14 15:14:27 +01:00
34b1392598 Cross-platform signal handler 2021-10-14 15:03:11 +01:00
321345fcc8 Sapling: simplify condition 2021-10-13 23:00:38 +01:00
0ac9f4fe61 BlockFactory: move SweetBerryBush to its proper place 2021-10-13 22:26:51 +01:00
2db53775e0 Sort item_from_string_bc_map using SORT_NATURAL 2021-10-13 21:01:59 +01:00
8523f0fb0b CS fix 2021-10-13 20:31:24 +01:00
b570324288 LegacyStringToItemParser: rely exclusively on item_from_string_bc_map.json, do not interpret integers given as strings
fixes #4507
2021-10-13 20:29:18 +01:00
6284cd14c7 LegacyStringToItemParser: added getMappings() 2021-10-13 20:19:44 +01:00
ce8af4e3bc 4.0.0-BETA6 is next 2021-10-13 00:02:01 +01:00
b65e89b605 Release 4.0.0-BETA5 2021-10-13 00:01:56 +01:00
d3f74d6ce1 Merge branch 'stable' 2021-10-12 23:32:43 +01:00
bbd925abc4 Merge commit '974d08efd62c52c1c8ac92cb1b67ac157908fd71' 2021-10-12 23:31:50 +01:00
4bf6205a6c Merge commit '289553fa46fc26b03db73db23481a98d6ddb12a5' 2021-10-12 23:28:35 +01:00
b5699679ef Merge commit 'e38866c4ba90f8efd5630dbe674fd7ca15f586ff' 2021-10-12 23:23:27 +01:00
824a89edfe Merge commit 'e032b8fe208a053441c9fbd377209740008cddb8' 2021-10-12 23:12:17 +01:00
ead9aae23c Updated build/php submodule to pmmp/php-build-scripts@fab0cbeaae 2021-10-12 23:10:06 +01:00
aefa0afd7c DefaultPermissions: Order registrations alphabetically 2021-10-12 22:17:46 +01:00
ec2699ffee DefaultPermissions: fix description of timings command permission 2021-10-12 22:16:20 +01:00
49c1e4c06e Implement fletching table (#4501) 2021-10-12 21:21:05 +01:00
9b94a4661b ItemTranslator: Use LegacyItemIdToStringMap instead of reading files directly 2021-10-11 22:17:40 +01:00
62f11360ee Added unit tests for getAddableItemQuantity() 2021-10-11 21:52:27 +01:00
a5833327f0 Inventory: added getAddableItemQuantity()
this mostly reuses the code from canAddItem().
2021-10-11 21:46:27 +01:00
d73ea8efe4 FlatGeneratorOptions: Do not hardcode biome ID 2021-10-11 21:32:20 +01:00
835e18ce6e Changelog: Changed utils\Color to color\Color (#4502)
[ci skip]
2021-10-11 20:15:44 +01:00
01c0602043 Server: do not attempt to generate a new world if it already exists 2021-10-11 17:48:08 +01:00
8fd475f87b WorldManager: Check generator options of worlds before loading them, too 2021-10-11 17:44:38 +01:00
34f54750c8 Added support for creation-time validation of generator options, closes #2717 2021-10-11 17:37:47 +01:00
092aabeb97 fix CS 2021-10-11 17:21:19 +01:00
89d7b7198f Server: drop support for tagging generator options onto the 'generator' key in pocketmine.yml
the 'preset' key should be used for this purpose instead.

This couldn't be dropped until now due to the shitty handling of unknown generators.
2021-10-11 17:20:49 +01:00
70deea0ef9 Flat: Move preset handling to a FlatGeneratorOptions unit 2021-10-11 16:53:08 +01:00
859cdfa5d2 GeneratorManager: removed unused parameter from getGenerator() 2021-10-11 16:18:38 +01:00
fa93a8d78f Server: Error on unknown generators when generating new worlds from config, instead of silently using DEFAULT
this is consistent with the behaviour of loading worlds.
2021-10-11 16:13:32 +01:00
7b6632941d GeneratorManager::getGenerator() now returns null for unknown generator aliases
instead of returning Normal::class (indistinguishable from successful match) or throwing an exception (pain in the ass to handle).
2021-10-11 16:04:36 +01:00
e62794e4cf TypeConverter: fixed PHPStan errors 2021-10-11 15:17:32 +01:00
500c298aaf Disallow the use of @handleCancelled on non-cancellable events
closes #3464
2021-10-11 15:12:16 +01:00
8ac16345a3 TypeConverter: account for items without properly mapped IDs
fixes #4459
2021-10-11 15:05:08 +01:00
19a66a8d03 committing the new strings would have helped ... 2021-10-11 01:14:00 +01:00
6d728e8d98 PluginManager: Improved startup performance when loading many plugins
for some reason we were reading and parsing the plugin.yml at least twice for every plugin loaded.
We were repeating work already done by the initial loadPlugins() triage (discovering correct loader, loading plugin.yml from disk, parsing plugin.yml, validating plugin.yml) every time loadPlugin() was called with that plugin.
2021-10-11 01:11:59 +01:00
e1ee320c8d PluginManager: Localize plugin loading error messages 2021-10-11 00:58:33 +01:00
965a16d19d PluginManager: Extract deterministic plugin loadability checks into a separate method 2021-10-11 00:49:32 +01:00
5bae458a91 changelog: mention that Entity->setPosition(AndRotation)() are now protected 2021-10-10 23:32:40 +01:00
2696698926 ClosureTask: relax closure checks to allow arrow functions without return typehints
nobody uses return typehints on arrow functions anyway .. they just waste space.
2021-10-10 23:31:57 +01:00
912e612743 Utils: allow validateCallableSignature() to accept a manually constructed CallbackType instead of a closure
this allows more fine-grained control without PHPStan yelling at us.
2021-10-10 23:27:09 +01:00
fd2df637b6 Block: rename getPositionOffset() -> getModelPositionOffset()
this gives a better idea of what the function does, and is also much less annoying for auto complete.
2021-10-10 22:35:38 +01:00
aa53dc6709 Entity: fixed network properties not updating when fireTicks changes
another bug that LBSG knew about, but didn't report. :/
2021-10-09 23:57:37 +01:00
c1f843a42c GarbageCollectorCommand: fixed duplicate MB suffix 2021-10-09 23:57:36 +01:00
09715906c8 StructureGrowEvent: added API to get the player who caused the growth (#4445) 2021-10-09 22:51:46 +01:00
13068ba3a7 3.24.1 is next 2021-10-09 20:20:41 +01:00
b54854529f Release 3.24.0 2021-10-09 20:20:37 +01:00
974d08efd6 Bump PHP minimum requirement to 8.0
PHPStan failed on 7.4 after updating to 0.12.99, and I figured it was less hassle to just do this than fix the build. In any case, we stopped shipping 7.4 months ago, and warned at 3.22 release that 7.4 support would soon be dropped.
2021-10-09 20:09:42 +01:00
289553fa46 CS again 2021-10-09 19:50:07 +01:00
e38866c4ba phpstan 0.12.99 2021-10-09 19:33:43 +01:00
58a95f8836 Updated transitive composer dependencies 2021-10-09 19:18:32 +01:00
ccc881ee58 Switch to custom permission denied message
closes #4494
2021-10-09 00:57:15 +01:00
308d7c126a Fixed world data ::generate() functions putting level.dat in the wrong place if the world path didn't end with a / 2021-10-08 23:39:25 +01:00
4910250a81 Config: fixed writeList() 2021-10-07 21:47:09 +01:00
e0d2e24698 fix CS (again\!) 2021-10-07 21:19:44 +01:00
d5f02a0bf8 Config: expose APIs to parse/emit list configs 2021-10-07 21:18:42 +01:00
2a3a57c519 Enable parsing/emitting .properties without creating a Config object
this is useful when the contents are just going to get passed straight into a model, making Config object redundant anyway.
2021-10-07 20:53:15 +01:00
5115387feb fix CS (again) 2021-10-07 20:43:55 +01:00
dd0aaf59b5 MainLogger: Log exceptions as a single block message 2021-10-07 20:40:20 +01:00
a555f21b18 MainLogger: write messages before calling logger attachments 2021-10-07 20:32:02 +01:00
1be9b2f037 Config: drop packing of arrays
we don't handle arrays on decode, so there's no reason to support them on encode either.
2021-10-07 20:30:56 +01:00
32fd9879e5 fix CS 2021-10-07 20:16:54 +01:00
dc2e8e7e8f ServerConfigGroup: do not assume that values are always bool|string 2021-10-07 20:02:21 +01:00
847e24fc41 4.0.0-BETA5 is next 2021-10-06 23:49:30 +01:00
9e6d740570 Release 4.0.0-BETA4 2021-10-06 23:49:13 +01:00
8e3772ceef Block: fixed incorrect behaviour of isSameState() for multi-ID blocks
fixes #4492
2021-10-06 23:16:03 +01:00
e032b8fe20 Server: fixed stats reporting checking a nonexistent pocketmine.yml property
this was originally worked around by 47f7af6739. However, that commit was just duct tape, and I never bothered to investigate if the config was being checked somewhere else.
Here's to a years-old bug finally getting fixed.
2021-10-06 22:23:41 +01:00
90800a4124 Config: Try to coerce types, similar to YAML 2021-10-06 21:09:23 +01:00
4b00465e24 Clean PHPStan baselines 2021-10-06 02:14:30 +01:00
10b3596eef PluginDescription: use typed properties 2021-10-06 02:00:55 +01:00
258c38f9cd PluginDescription: loosen invalid permission message (it might be wrong type as well as not existing) 2021-10-06 01:45:40 +01:00
d07517fe8b Use an object to represent command entries in plugin manifest 2021-10-06 01:42:03 +01:00
31a176286d Do not register plugin commands without valid permissions
this could lead to harmful results, e.g. if a developer typo'd while writing the plugin.yml, an admin-only command could become accessible to everyone, since commands are by default accessible by everyone.
2021-10-06 01:18:14 +01:00
1fafce6d6f PluginBase: remove special true/false handling for command permissions
these aren't accepted as permission names anymore, and they never worked properly anyway.
2021-10-06 01:12:02 +01:00
5061bbbc25 fuck you git x2 2021-10-06 01:01:20 +01:00
a101d1cdf9 Drop pocketmine.plugin.fileError in favour of pocketmine.plugin.loadError
fileError was unnecessarily noisy, putting the directory path on the console twice. This conveys just as much information but with less wasted space.
2021-10-05 23:31:00 +01:00
fec48003d9 ..... 2021-10-05 20:29:24 +01:00
e25c03eec1 Gracefully handle errors loading plugin manifest
this isn't perfect, but it covers the common cases.
Now, the server won't spam crashdumps just because some plugin declared nested permissions.
2021-10-05 20:28:43 +01:00
7245d15abe PermissionParser: Throw more specific exceptions 2021-10-05 19:57:26 +01:00
13178a47a5 fuck you git 2021-10-05 19:11:10 +01:00
817ab88c70 Properly handle errors decoding network item NBT
since the NBT is now decoded immediately now, any incorrect NBT will cause exceptions to be thrown that we weren't handling, causing server crashes.
2021-10-05 19:10:55 +01:00
fef8297907 GiveCommand: don't crash on bogus item NBT 2021-10-05 19:09:46 +01:00
dbeaf27cb7 Document that Item::setNamedTag() may cause NbtException to be thrown
if the NBT is bogus for some reason
in PM3, these kinds of bugs wouldn't show up until/unless the item NBT was actually used, but on PM4, we decode it ahead of time, so the errors always show up immediately.
2021-10-05 19:09:22 +01:00
2db79cf58d Fix build 2021-10-05 18:41:47 +01:00
7d06b76aaf PluginManager: account for possible invalid format of API version
we're seeing a lot of crashes because of this.
2021-10-05 18:36:00 +01:00
0ad663ff50 Merge remote-tracking branch 'origin/stable' 2021-10-05 01:17:59 +01:00
a27c14c00c phpstan: exclude build/php from analysis
in case I built PHP in there, I don't want the install_data getting analysed and screwing up the analysis.
2021-10-05 00:14:44 +00:00
5b26abcb0e NetworkSession: fixed code copy pasta
these are not, in fact, equivalent.
2021-10-05 01:02:15 +01:00
f2d6059613 NetworkSession: Sync world spawn on world change 2021-10-04 22:51:31 +01:00
bb6ea8cbdc Do not call PlayerLoginEvent during the Player constructor
this closes a lot of loopholes in the login sequence that plugins were using to cause crashes.
2021-10-04 22:36:50 +01:00
356a49d225 NetworkSession: account for possibility of syncGameMode() being called before the player is ready to receive it
close #4323
2021-10-04 22:13:42 +01:00
6332af3e59 Require RakLib 0.14.2 minimum 2021-10-04 21:50:11 +01:00
fb570970a8 Localize gamemode command errors 2021-10-02 21:22:54 +01:00
30e10c38b6 Localize /help 2021-10-02 20:59:36 +01:00
05dc675d5b Replace commands.generic.notFound with a custom PM version
this also fixes #4379.
2021-10-02 20:42:59 +01:00
d63b9d1648 WorldManager: localize strings for world loading, generation and conversion 2021-10-02 20:33:32 +01:00
f9e6fd44bc Merge branch 'stable'
it looks like I goofed up the last merge and the changelog didn't get
merged into master.
2021-10-02 20:18:06 +01:00
0108888450 Process: silence taskkill complaining that it can't commit suicide
since taskkill is a subprocess of the server process, it gets included in taskkill's own attempted killing spree, but taskkill (wisely) won't kill itself.
2021-10-02 17:23:26 +01:00
dd0c2fed82 Process: add subprocess parameter to kill()
fix CommandReader subprocess lingering on a crash and fucking up the console
2021-10-02 16:56:24 +01:00
2566123e49 Remove unnecessary constant from PHPStan bootstrap 2021-10-02 16:34:38 +01:00
54174eefa0 Make sure COMPOSER_AUTOLOADER_PATH is always declared
Sacrifice dynamic composer autoloader path to do this, because we don't
need it anyway - it was a misconceived feature from the days when I used
the same workspace for PM3 and PM4 both.
2021-10-02 15:27:17 +01:00
f5266ec816 World: remove dead code leftover from 34f01a3ce3
fixes #4486
2021-10-02 12:33:46 +01:00
c6b2c63a9b Remove a couple more dead errors from PHPStan baseline 2021-10-02 00:52:47 +01:00
f26f063164 UPnP: catch InternetException when attempting portforward
we might fail to get the internal IP for some reason, which shouldn't crash the server.
2021-10-02 00:52:14 +01:00
81d5598e96 UPnP: Fixed server crash on failure to find UPnP device
https://crash.pmmp.io/view/5241010
2021-10-01 23:27:58 +01:00
c7e9138994 PopulationTask: reduce code duplication 2021-10-01 23:18:56 +01:00
88f799da2c more AssumptionFailedError hacks for PHPStan :(
the code in this class is really horrible
2021-10-01 23:05:48 +01:00
8de30e8162 FastChunkSerializer no longer serializes light by default
the core doesn't use this anywhere.
serializeWithoutLight() has been renamed to serializeTerrain() to more accurately describe what it does.
2021-10-01 22:57:22 +01:00
e6f6a036ef LightPopulationTask: do not copy existing light arrays
this task wipes out the light arrays and recalculates them from scratch, so it's pointless to copy any preexisting light arrays anyway.
2021-10-01 22:34:11 +01:00
32f8b8163e Clean out PHPStan l7 baseline 2021-10-01 22:19:36 +01:00
5b818827db Chunk: stop exposing SplFixedArray<SubChunk> to the API
this fixes a large number of PHPStan errors, and also brings us a step closer to negative-build-height readiness.
2021-10-01 22:17:28 +01:00
42bf9578ce Remove unused constants 2021-10-01 22:05:03 +01:00
aee4a00a50 Updated dependencies 2021-10-01 21:40:31 +01:00
2fdd8d039e RakLib 0.14.1 2021-10-01 21:39:26 +01:00
349f37b15f resource packs: manifest may also contain a list of dependencies
... which we should be verifying the presence of, as the server.
2021-10-01 21:14:28 +01:00
afa3349c04 Acknowledge the presence of capabilities field in resource pack manifest
closes #4485
2021-10-01 21:09:53 +01:00
6a8280b1ba Lever: add block property APIs 2021-09-29 00:20:57 +01:00
003c002208 Bump phpunit/phpunit from 9.5.9 to 9.5.10 (#4482)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.9 to 9.5.10.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.9...9.5.10)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-28 21:04:11 +01:00
d417b1e2f5 Projectile: fixed move() not using the given parameters (#4481)
it was using this->motion instead, which usually would be the same, but maybe not.
2021-09-28 21:03:03 +01:00
65e468e3c2 Updated build/php submodule to pmmp/php-build-scripts@6aac46e500 2021-09-28 21:00:13 +01:00
a11cf8c296 Update PHP versions used by GitHub Actions 2021-09-28 20:52:40 +01:00
c931c52617 AsyncTask: added newline 2021-09-27 13:53:30 +01:00
b3e8314b9f PTHREADS_INHERIT_CONSTANTS is no longer needed for MainLogger to log exceptions
cleaned paths are now referenced from Filesystem instead of namespace constants.
2021-09-26 21:41:24 +01:00
f138004913 PlayerDeathEvent: fixed property type variance issue PHPStan complains about 2021-09-26 21:20:42 +01:00
8e2d06a880 ChunkSerializer: support writing 0 bpb palettes on the wire
these are now supported as of 1.17.30.
2021-09-25 01:17:32 +01:00
eb80515e99 Fixed incorrect parameter checking in BlockFactory::get() (#4476) 2021-09-24 15:47:11 +01:00
1cb540387c 4.0.0-BETA4 is next 2021-09-23 21:51:36 +01:00
9bc07a9cc0 Release 4.0.0-BETA3 2021-09-23 21:51:23 +01:00
5f1e66478b changelog: mention UPnP API changes 2021-09-22 23:12:56 +01:00
36b8217e68 Updated to RakLib 0.14.0 2021-09-22 23:05:24 +01:00
d455188d03 3.23.2 is next 2021-09-22 01:00:50 +01:00
14fba36636 Release 3.23.1 2021-09-22 01:00:50 +01:00
43ac3fbf3e actions: use newer PHP versions 2021-09-22 00:51:06 +01:00
352162a6e6 Fixed PHP 7.4 build 2021-09-22 00:50:00 +01:00
b3601c9390 Regenerate PHPStan baselines 2021-09-22 00:45:07 +01:00
817fec9e3d EducationSettingsPacket: safeguard against purity issue reported by PHPStan
while annoying, PHPStan is right to complain about this, because putBool() is impure, meaning that these fields could have been mutated in the call.
We know they didn't, but PHPStan doesn't, and we can't mark the method as pure because .. well .. it isn't.
2021-09-22 00:44:52 +01:00
3813caf5ec Updated BedrockProtocol and BedrockData for 1.17.30 2021-09-22 00:36:21 +01:00
e472c117e0 Merge branch 'stable' 2021-09-22 00:33:49 +01:00
ceeef7c729 3.23.1 is next 2021-09-22 00:29:24 +01:00
7f1b2a0ee5 Release 3.23.0 2021-09-22 00:29:24 +01:00
27324a3aeb Protocol changes for 1.17.30 2021-09-22 00:26:39 +01:00
133398c69a changelog: add newline
[ci skip]
2021-09-19 22:57:22 +01:00
52b6952771 changelog: baseline for 4.0.0-BETA3
[ci skip]
2021-09-19 22:55:48 +01:00
1ce388ca0b Liquid: add getMinAdjacentSourcesToFormSource(), remove circular dependency between Liquid and Water
this unpleasantly-named method allows controlling the source-forming behaviour of liquids by changing the required number of adjacent sources that must be present in order for a new source to form. This allows stuff like non-infinite water.
2021-09-19 15:59:16 +01:00
971cbe3929 Liquid: restore mistakenly removed check 2021-09-19 15:42:17 +01:00
18de35ffc7 Liquid: use facing instead of hardcoded integers 2021-09-19 15:37:03 +01:00
576c33ee8f Liquid: make flow vector calculation less cancerous to read 2021-09-18 23:04:28 +01:00
6b2ab15ea1 MinimumCostFlowCalculator: fix bug caused by recent change 2021-09-18 16:20:01 +01:00
027f7e249b MinimumCostFlowCalculator: Use match statements where possible
coincidentally, this also fixes the build.
2021-09-18 16:17:08 +01:00
a9c4238c59 Liquid: Extract a big chunk of code to MinimumCostFlowCalculator 2021-09-18 16:13:38 +01:00
34e1b244fa Liquid: split canFlowInto() over multiple lines
the original version is very hard to read.
2021-09-18 15:53:54 +01:00
b047100719 Liquid: improve minimum cost calculation handling 2021-09-18 15:52:16 +01:00
1b5071e074 Liquid: make some code slightly less cancerous to read 2021-09-18 15:28:45 +01:00
3836a57ba6 Player: add getPlayerInfo(), closes #4450 2021-09-17 22:17:36 +01:00
87dc763d92 actions: test that generated code is consistent 2021-09-17 16:46:27 +01:00
43b2e1a0e8 tools/convert-world: improve error messages and exit codes
die with a string exits with zero? wtf?
2021-09-16 15:28:20 +01:00
05e2bef5ce ItemFactory: fix crash when checking if blockitem IDs are registered 2021-09-16 14:53:19 +01:00
6cf181b579 LevelDB: Use arrow functions for better readability 2021-09-16 14:44:56 +01:00
9490b78640 Move packet handler default implementations to BedrockProtocol
in many cases this will now require zero changes to PM at all to be compatible with a new protocol version.
2021-09-15 22:27:49 +01:00
59f3622f69 changelog: mention PluginLoadOrder changes (#4458)
[ci skip]
2021-09-15 17:18:53 +01:00
a1c82da2f2 Liquid: remove useless continue 2021-09-12 16:03:52 +01:00
84170ad3e1 Furnace: fixed deactivation after being reloaded from disk (regression from PM3)
closes #4430
2021-09-12 15:49:33 +01:00
ace8841d5d Explosion: allow the normal blockupdate mechanism to deal with explosions
in PM4, all blockupdates are buffered, so the old 7x performance penalty that used to be incurred by doing this is no longer a problem.
Also, this actually reduces the overhead of explosions themselves by moving the onNearbyBlockChange() burden off explodeB() and into the main world ticking function.
2021-09-12 15:45:02 +01:00
5ddd94b7e8 Remove redundant World->isChunkGenerated() calls
isChunkGenerated() merely checks if the chunk can be loaded from disk, if it's not in the runtime cache already.
This is pointless in all of these cases, because the check is prefaced by an isChunkLoaded() check, which already limits the possibility anyway. If the chunk is not generated, it'll also be considered not loaded.
2021-09-12 15:21:09 +01:00
f0fa561c2f World: use arrow functions in useBreakOn() 2021-09-12 15:16:55 +01:00
33a7c05425 Updated PHPStan baselines 2021-09-11 23:12:43 +01:00
273aa8ab42 Drop useless usage translation strings for commands with no parameters 2021-09-11 17:06:26 +01:00
3b7580688c Stop auto-translating string descriptions/usages for commands
Require usage of Translatable for translations.
2021-09-11 16:46:40 +01:00
b65e3c69b1 4.0.0-BETA3 is next 2021-09-10 17:18:32 +01:00
26e3280fea Release 4.0.0-BETA2 2021-09-10 17:18:31 +01:00
fa45d1cdb5 Merge branch 'stable' 2021-09-10 17:13:51 +01:00
33b5da3749 3.22.6 is next 2021-09-10 17:09:51 +01:00
40e88f1686 Release 3.22.5 2021-09-10 17:09:50 +01:00
c995c2de37 updated changelog
[ci skip]
2021-09-10 17:04:35 +01:00
7701e1ff98 InGamePacketHandler: fix regression in movement handling since 82c8fa696a
fixes #4291
fixes #4398
2021-09-10 16:52:46 +01:00
4111d92b98 Stop hardcoding chunk dimensions everywhere (#4443) 2021-09-10 16:13:25 +01:00
9d5a86fe53 Revert "World: make the second parameter for getCollidingEntities() mandatory and non-nullable"
This reverts commit e1b7bf31bb.

fixes #4447
2021-09-10 16:06:08 +01:00
cf762d345d Player: Log debug messages when canInteract() prevents block interaction 2021-09-10 15:58:38 +01:00
f5c9c02e09 Improve documentation of Thread and Worker 2021-09-10 15:57:45 +01:00
32588d79c8 ConsoleReaderThread: remove useless code 2021-09-10 13:54:42 +01:00
1cc57afd25 Stop the ConsoleReaderThread explicitly, instead of letting ThreadManager do it
this hack dates back to the days when the console reader would get stuck on shutdown on some platforms.
2021-09-10 13:48:01 +01:00
334bf1277d BlockTransaction: Return failure if no blocks were changed
fixes #2813
2021-09-10 00:32:46 +01:00
082f0f2d57 Player: Generate an InventoryTransaction (with event) for crafting grid/cursor evacuation
this fixes the crack in the armour that allows creative players to drop items even when all drops are being cancelled by plugins.

closes #3284
2021-09-09 17:11:59 +01:00
5d4f14b388 Added TransactionBuilderInventory for server-side inventory transaction generation 2021-09-09 17:10:04 +01:00
4a787769bf Merge branch 'stable' 2021-09-09 16:06:16 +01:00
4c65a0cdaa LegacySkinAdapter: Use 64x64 for persona polyfilled skins
64x32 has some corruption issues and generally just looks really bad.
2021-09-09 16:04:43 +01:00
e0e19c67ef World: do not warn about leaked Player entities during world unload
this raises false-positives during shutdown if players were online.
The fact that the player entity leans on the World to clean up after it is slightly problematic, but I'm not sure what else to do about it for now.
2021-09-09 15:55:37 +01:00
6f8261f26a Added changelog so far for beta2 2021-09-09 01:32:39 +01:00
34f01a3ce3 World: Track entities separately from chunks
this allows entities to exist outside of generated chunks, with one caveat: they won't be saved in such cases.
Obviously, for player entities, this doesn't matter.

fixes #3947
2021-09-09 01:17:41 +01:00
ba2bfe0e11 World: depopulate neighbourBlockUpdateQueueIndex sooner
this fixes 2 problems:
1) Blocks which set themselves to something else during onNearbyBlockChange() would not receive any block update
2) A memory leak when blocks in unloaded chunks were scheduled for an update.

I'm a little uneasy about this change, because there must have been some reason why I put this at the end of the block and not at the start, but whatever it is, I can't reason about it, and there's reasons not to put it at the end too.
2021-09-08 22:11:17 +01:00
b9b1ba9526 Include eye height in Living->lookAt() calculation (#4440) 2021-09-08 21:54:32 +01:00
dca5a9d8ea Remove PHP Version from notice. (#4442) 2021-09-08 17:00:12 +01:00
7c943880b2 Do not show update notifications to users running from git sources 2021-09-07 23:52:11 +01:00
b8a15b647c Updated build/php submodule to pmmp/php-build-scripts@ad9cd1fdb4 2021-09-07 22:35:02 +00:00
627c70c4df actions: use chunkutils2 0.3.1 2021-09-07 22:55:50 +01:00
bc6e73e81d SubChunk: fixed light array GC since native LightArray introduction
since this went native, there was no support for copy-on-write, so this was only lazy-inited, but never cleaned if the array remained empty.
2021-09-07 22:54:54 +01:00
11d2e1ef08 Require ext-chunkutils ^0.3.0 2021-09-07 22:53:50 +01:00
c605b54591 Accept dev versions of chunkutils2 2021-09-07 22:52:00 +01:00
0f70348821 Remove noise 2021-09-07 20:31:13 +01:00
72fb49b356 World: add notifyNeighbourBlockUpdate() to allow triggering neighbour block updates on blocks manually
this can be useful if blocks were modified asynchronously.
2021-09-07 20:18:53 +01:00
ac55b21fb4 4.0.0-BETA2 is next 2021-09-07 14:19:29 +01:00
210b9c7b75 Release 4.0.0-BETA1 2021-09-07 14:19:29 +01:00
57e2b16139 Dropped PreProcessor 2021-09-07 14:04:52 +01:00
806f03bd37 consistency ... 2021-09-07 13:00:28 +01:00
39820be836 draft-release: preprocess only src of dependencies
p sure we had this problem already somewhere else? ...
2021-09-07 12:59:32 +01:00
7276e9610c fixing draft-release for PM4 2021-09-07 12:49:39 +01:00
06a0e37b94 Fixed build info generation for PM4 2021-09-07 12:47:41 +01:00
64347e9499 Merge branch 'stable' 2021-09-07 12:45:52 +01:00
c948aa94aa Fixed new files in build/ keeping getting missed 2021-09-07 12:39:54 +01:00
5d0d1aa4c5 Include build/generate-build-info-json.php in analysis 2021-09-07 12:36:42 +01:00
9b8be22015 Sort phpstan.neon 2021-09-07 12:32:19 +01:00
dd4abe7f7a Updated test 2021-09-07 12:27:24 +01:00
da0482d330 Solidify version comparison 2021-09-07 12:24:16 +01:00
9a745ffc09 Do not enforce suffix checks for API versions 2021-09-07 12:06:36 +01:00
580b53eb9b update changelog
[ci skip]
2021-09-07 12:05:13 +01:00
710345d4b0 Implemented Farmland turns to dirt when jumped on. (#4434) 2021-09-06 12:55:52 +01:00
931c3ed77d Entity: fixed current movement not being accounted for in fall height
this caused incorrect damage when falling from heights, as well as a bug in #4434.
2021-09-06 12:53:52 +01:00
956780c6a6 Entity: add getters and setters for fallDistance 2021-09-05 23:59:04 +01:00
df3b112877 Implemented slime blocks 2021-09-05 20:46:59 +01:00
8e2486b96a Bed: bounce doesn't apply if the entity was sneaking 2021-09-05 20:14:17 +01:00
ded778f422 Implemented bed bouncing 2021-09-05 20:11:49 +01:00
b0b28ec6ed 3.22.5 is next 2021-09-05 15:47:54 +01:00
2fb4704269 Release 3.22.4 2021-09-05 15:47:54 +01:00
0c0eb72b1b make-release: display the current and next version numbers 2021-09-05 15:46:40 +01:00
466107d3b8 actions: fix release build shitting the bed 2021-09-05 15:45:07 +01:00
4f59d3487a 3.22.4 is next 2021-09-05 15:42:39 +01:00
65220b4f7f Release 3.22.3 2021-09-05 15:42:38 +01:00
85eb6b30a5 Player: do not allow doFirstSpawn() to be executed before the constructor is called
this problem doesn't exist on PM4.
2021-09-05 15:38:14 +01:00
1c2eb35025 actions: fixed bad git hash on published releases 2021-09-05 15:32:31 +01:00
92f3a7d206 make-release: allow specifying the nextVer as well as currentVer 2021-09-05 15:29:55 +01:00
e1b7bf31bb World: make the second parameter for getCollidingEntities() mandatory and non-nullable
the only reason to use getCollidingEntities() instead of getNearbyEntities() is if you have an entity that may or may not be collidable depending on certain conditions.
Really, I don't think this logic belongs in World at all, but for now it has to stay, because some other stuff depends on it.
2021-09-05 15:22:12 +01:00
2fc33d3bff World: remove unused variable 2021-09-05 15:15:48 +01:00
19513c65f0 World: avoid code duplication between getCollidingEntities() and getNearbyEntities()
these two methods are very misleadingly named, but they do almost exactly the same thing - the only difference is that getCollidingEntities() does a couple of additional checks.
2021-09-05 15:13:22 +01:00
d4d00a9b80 Living: added calculateFallDamage()
to clean up the way that fall damage is handled for flying players; also, onHitGround() isn't only doing fall damage things these days.
2021-09-05 14:36:58 +01:00
6b7e671794 Living: use Vector3->down() instead of subtract(). 2021-09-05 14:12:04 +01:00
17dfd2cc52 Living: Trigger fall sounds on the nearest collidable block below
we can't have landed on it unless it actually has a collision box - otherwise, we only landed _in_ it.
This assumes, of course, that no blocks have bounding boxes >= 2 blocks tall, which currently none do.
2021-09-05 14:10:54 +01:00
d329bfb25d Entity: rename movX/movY/movZ to wantedX/wantedY/wantedZ
this makes the code much easier to understand.
2021-09-05 14:06:53 +01:00
73cc841d0b Entity: rename checkBlockCollisions() to checkBlockIntersections() 2021-09-05 14:00:27 +01:00
8be1f34736 Entity: Rename fall() to onHitGround(), and make it protected
this had no business being exposed to public API in the first place.
2021-09-05 13:36:40 +01:00
6ecad153ea Entity: remove fallDistance parameter from fall() 2021-09-05 13:34:43 +01:00
7e82cafdeb Entity: remove a bunch of commented code that no one cares about 2021-09-05 13:27:48 +01:00
7d5b9295cb PoisonEffect should accept Translatable|string, like its parent
this doesn't really break anything, but someone will likely whine about consistency if it's not fixed now.
2021-09-03 21:33:55 +01:00
0404298c74 Effect: get rid of runtimeIDs 2021-09-03 21:25:06 +01:00
c062282954 Drop enchantment runtime IDs 2021-09-03 21:20:43 +01:00
ed1e7322dd be quiet phpstan 2021-09-03 21:16:37 +01:00
f95eb6a218 Server is not cloneable 2021-09-03 21:08:29 +01:00
62435fe935 Standardize clone denying 2021-09-03 21:07:39 +01:00
b026ada489 Standardize serialize denying 2021-09-03 21:07:10 +01:00
aa5a9f6d12 Enchantment: use Translatable instead of hardcoded translation keys 2021-09-03 20:52:05 +01:00
fbbaef4401 Enchantment: use promoted properties 2021-09-03 20:41:43 +01:00
665f2473e1 Effect: stop using hardcoded translation keys for names 2021-09-03 20:39:02 +01:00
8e58beef7f Effect: use promoted properties 2021-09-03 20:32:13 +01:00
078347b44a MemoryManager: fixed a PHPStan error 2021-09-03 20:26:58 +01:00
f207f9e3e9 Merge remote-tracking branch 'origin/stable' 2021-09-03 20:00:15 +01:00
2e153624ad Anvil: actually add slot constants, this time 2021-09-03 12:44:41 +01:00
963f4a9cf3 Added constant slot IDs for Furnace, Enchanting, Anvil and Brewing Stand inventories 2021-09-03 12:16:07 +01:00
85ed7efcb4 PHPStan 0.12.98 2021-09-03 11:50:18 +01:00
183489e863 PHPUnit 9.5.9 2021-09-03 11:47:31 +01:00
ac060f2ec6 Update build/php submodule to pmmp/php-build-scripts@e55c60f176 2021-09-03 11:45:43 +01:00
2fe03757d5 PopulationTask: fixed PHPStan errors 2021-08-30 00:26:54 +01:00
e0d6357eb7 OreType: use promoted constructo properties 2021-08-30 00:18:34 +01:00
0289b45202 Chunk: Drop dirty flags for tiles and entities
instead, just ungate this and allow the provider to decide what to do.
Any chunk that contains entities or tiles is already always considered dirty, so the only thing the flags are good for is flagging chunks that previously had tiles and/or entities but no longer do.
In those cases, it's just removing keys from LevelDB anyway, so it's already very cheap.
Avoiding these redundant deletions is not worth the extra complexity and fragility of relying on flags to track this stuff.
2021-08-30 00:09:36 +01:00
6c85d4d254 CommandReader: fixed CS with php-cs-fixer 3.1.0 2021-08-29 23:35:07 +01:00
4b06e19d28 Cover tools/ in php-cs-fixer 2021-08-29 23:33:07 +01:00
7def3db781 Fixed generate-known-translation-apis script not getting PHPStan'd 2021-08-29 23:32:08 +01:00
ee8b854f30 Add tools/ to PHPStan analysis 2021-08-29 23:31:24 +01:00
6bbc0aae7d Merge branch 'stable' 2021-08-29 23:23:30 +01:00
f506c922b5 phpstan.neon.dist: fix indentation inconsistency
fuck you, phpstorm!

it doesn't have an option to use tabs for indentation in YAML, and YAML is the closest thing to NEON, so ...
2021-08-29 23:19:35 +01:00
994a2c9eb9 Clean up entity/tile data loading from world providers 2021-08-29 23:11:18 +01:00
533b0d0724 Updated convert-world CLI tool 2021-08-29 21:04:59 +01:00
b4e23a57d2 CraftingDataCache: Replace hardcoded recipe block names with constants from BedrockProtocol 2021-08-29 16:26:18 +01:00
510b75ef38 Use tagged version of BedrockProtocol 2021-08-29 16:23:56 +01:00
8847aa2d7f LegacyStringToItemParser: mark as deprecated, and point people towards StringToItemParser, which is much nicer 2021-08-29 16:13:19 +01:00
dee2062b1b CraftingManager: Reduce footprint of recipe keys
this was using json before, which is horribly inefficient.
This saved about 200 KB of memory on initial startup (which isn't much, but for more complex recipes, it might have been significantly worse.
2021-08-29 15:49:18 +01:00
c2558573e2 Fix offhand pickup (#4412) 2021-08-29 12:45:23 +01:00
2139171a55 added BlockItemPickupEvent class (#4402) 2021-08-29 00:40:09 +01:00
3fe6ce7d1f [ci skip] changelog: mention StructureGrowEvent 2021-08-27 21:02:52 +01:00
43d90d621d [ci skip] update changelog 2021-08-27 20:55:19 +01:00
938e430b0f Convert Populator into an interface 2021-08-27 20:41:54 +01:00
c7f78bec15 Added missing change to complete beba0ffe15 2021-08-27 20:33:17 +01:00
6c1fec8a29 Tree: renamed generateChunkHeight to generateTrunkHeight
I guess it must have been late at night when I originally wrote this code.
2021-08-27 20:32:07 +01:00
beba0ffe15 Remove circular dependency between Tree and its children 2021-08-27 20:25:21 +01:00
4778c1483a Tree: fixed formatting error 2021-08-27 20:14:31 +01:00
8f89c04c51 Refactor Tree classes (#4407) 2021-08-27 20:11:05 +01:00
a5b08fc8f2 Rewrite CONTRIBUTING.md to be more developer-oriented 2021-08-27 15:05:57 +01:00
c3c4c80b70 SECURITY: drop supported versions table
this isn't actively maintained, so it's misleading.
[ci skip]
2021-08-27 13:53:01 +01:00
5695fa9086 CONTRIBUTING: fixed a broken link
[ci skip]
2021-08-27 13:51:16 +01:00
ee16a00c57 World: do not attempt placement of itemblock if stack size is zero (#4410)
This doesn't make any sense, and also caused a crash.
2021-08-27 13:14:56 +01:00
d9b9aed2cc Fixed CS 2021-08-26 15:31:28 +01:00
7919a1a1c5 Drop support for commands with spaces in the names
the use case for this is basically zero, since the community prefers implementing their own subcommand systems instead (which are much more flexible).
In addition, allowing spaces in command names makes it extra complicated to display helpful information to the user, such as the command that was actually accepted by the command map (which would be useful for identifying accidental invisible characters / control characters when sending commands).
2021-08-26 15:24:35 +01:00
e140614a63 Localize /gc 2021-08-26 15:06:43 +01:00
239534995f Update preprocessor submodule to pmmp/PreProcessor@8a3163aad6 2021-08-26 13:32:50 +01:00
47120022c2 Localize messages for /op and /deop 2021-08-26 13:31:19 +01:00
f78808bad0 Bump phpstan/phpstan-strict-rules from 0.12.10 to 0.12.11 (#4401)
Bumps [phpstan/phpstan-strict-rules](https://github.com/phpstan/phpstan-strict-rules) from 0.12.10 to 0.12.11.
- [Release notes](https://github.com/phpstan/phpstan-strict-rules/releases)
- [Commits](https://github.com/phpstan/phpstan-strict-rules/compare/0.12.10...0.12.11)

---
updated-dependencies:
- dependency-name: phpstan/phpstan-strict-rules
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-25 20:41:11 +01:00
4189fbdaef Added StructureGrowEvent (#4354)
This event is currently fired for tree and bamboo growth. Its intended use is for any plant growth that affects multiple blocks at once.

TODO: We could explore using this for cacti and sugarcane?
2021-08-25 14:05:30 +01:00
6e68e99ec0 Added PlayerEntityInteractEvent (#4374) 2021-08-24 11:56:10 +01:00
224d71f272 World: renamed getChunks() to getLoadedChunks() (#4393) 2021-08-23 21:23:35 +01:00
2d025bf02f Populate StringToItemParser with some names from VanillaBlocks
this makes just about everything easily accessible via commands.
There are some stuff that shouldn't be here due to not being actual items (e.g. door blocks, bed blocks, wall coral fans) but since there were legacy aliases for all those things already, I figured what the heck - it's more effort to exclude them, so whatever.
2021-08-23 14:49:30 +01:00
78b0275a6c StringToItemParser: added a bunch of nice new aliases
this should especially make potions less cancerous to /give.
2021-08-23 14:25:00 +01:00
7fd712c1ff Refactor Block & Tile: getPos() to getPosition() (#4395)
this also changes the name of the class property 'pos' to 'position' as well as Block->getPosOffset() to Block->getPositionOffset()
2021-08-23 14:01:32 +01:00
dc0082162b Bump phpstan/phpstan from 0.12.95 to 0.12.96 (#4397)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.95 to 0.12.96.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.95...0.12.96)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-23 13:53:20 +01:00
22316976fa Introduce next-generation StringToItemParser
this isn't specced up with some of the finer features of LegacyStringToItemParser such as metadata parsing, but those are still a work in progress (and probably limited to specific items like durable stuff).
The goal is to unbind these aliases from legacy internal IDs, while also providing a nice flexible way for plugins to add their own items and aliases to the existing system.

This system allows mapping a string to any item at all, irrespective of state, internal IDs, or any of that nonsense. This means it's finally possible to have stuff like lapis_lazuli and bone_meal aliases in commands.
2021-08-23 00:39:20 +01:00
044b2f54ac Fixed build 2021-08-22 23:13:25 +01:00
270ee5c085 Simplify registry method generation 2021-08-22 23:02:36 +01:00
1ce9474fce Picked up items can now be added to offhand slots. (#4360) 2021-08-22 20:36:12 +01:00
cd9af7f9f6 Utils: be explicit about class existence checking in testValidInstance() 2021-08-21 15:57:57 +01:00
4d73c93886 fix CS 2021-08-21 15:54:11 +01:00
7d9f8ff4ed World: do not use static:: for private property access 2021-08-21 15:46:19 +01:00
5f3c9e6f19 Timezone: fix some implicit boolean type conversions 2021-08-21 15:43:30 +01:00
686bf398d5 BlockFactory: simplify get() code 2021-08-21 15:41:00 +01:00
4023a024ce [ci skip] update changelog 2021-08-21 00:15:38 +01:00
14577daae3 fixed build 2021-08-20 23:52:34 +01:00
668df85e3f Merge branch 'stable' 2021-08-20 23:08:17 +01:00
f5a4baf3cf AsyncTask: regroup some methods into more sensible places
how the fuck is anyone supposed to find anything??
2021-08-20 23:00:39 +01:00
eb9188c309 Replace InventoryPickup*Event with EntityItemPickupEvent (#4384)
The rationale here is that inventories don't actually pick items up - their holders do.
It's especially misleading to say that an inventory is picking up an item in creative mode when the picked-up item can't actually be added to the target inventory in the first place.

This change allows a range of new functionality, such as:
- Allowing survival players to pick items up even when their inventories are full, similarly to creative players
- Changing the destination inventory of collected items (e.g. items could be redirected to the offhand or ender chest inventory, while still allowing other plugins to understand what's happening)

As an added bonus, this obsoletes one more use case for Inventory->getHolder(), bringing us one step closer to removing the cyclic reference nightmare from inventories.

The choice of naming (EntityItemPickup, instead of EntityPickupItem) is to be consistent with other events, where the word order is SubjectObjectActionEvent.
2021-08-20 22:59:35 +01:00
34a7405820 Player: fixed player can fly after respawn (#4388) 2021-08-20 22:51:36 +01:00
ff4aa148ef phpstan 0.12.95 2021-08-20 22:47:29 +01:00
e43d39c0bc UpdateChecker: improve type handling 2021-08-20 20:06:09 +01:00
e113981750 UpdateChecker: be less wordy 2021-08-20 19:59:55 +01:00
950dadab0c UpdateChecker: be less noisy
we already have a log prefix, so there's no need for this spam as well.
2021-08-20 19:56:55 +01:00
d488c25a1a Rename AutoUpdater -> UpdateChecker 2021-08-20 19:54:08 +01:00
63e86fe806 Config: fixed incorrect fluent @return annotations 2021-08-20 14:44:59 +01:00
ab05bc7379 Replace some references to Pocket Edition with Bedrock Edition
closes #4387
2021-08-20 14:23:11 +01:00
17c7e25346 resourcepacks: use typed properties in JSON models 2021-08-19 16:12:04 +01:00
5478b7cb63 UpdateInfo: use typed properties 2021-08-19 16:07:11 +01:00
7ba34927c9 Update UpdateInfo JSON model to be compatible with new updater API 2021-08-19 15:57:53 +01:00
bf8b5905e4 Player: Play ItemBreakSounds when items break due to usage
closes #4381
2021-08-19 15:56:40 +01:00
a5b85e095a Fixed some missing function imports
these weren't getting corrected since php-cs-fixer 3.0 due to a change in the default configuration for native_function_invocation. Since the builds are randomly choosing to use php-cs-fixer 2.19 at the moment, the consistency is a problem.
2021-08-19 15:40:43 +01:00
b4b3c21d30 Merge branch 'stable' 2021-08-19 15:39:16 +01:00
1a395a51c9 Fixing function import inconsistencies since php-cs-fixer 3.0 migration 2021-08-19 15:26:45 +01:00
142c8f067b fix CS in php-cs-fixer config
unfortunately i can't seem to make it fix itself
2021-08-19 15:25:20 +01:00
cd3c96aad2 shivammathur/setup-php 2.12.0 2021-08-19 02:31:18 +01:00
19c47fa71f 3.22.3 is next 2021-08-18 14:14:58 +01:00
d670bc8bf8 Release 3.22.2 2021-08-18 14:14:54 +01:00
7bd8d09023 GitHub Actions: automatically build and upload release artifacts, and auto-update update.pmmp.io (#4376) 2021-08-18 14:02:52 +01:00
83805a3406 Entity: use match in checkObstruction() 2021-08-17 20:44:49 +01:00
5a970541f9 actions: use newer pthreads version 2021-08-16 23:15:47 +01:00
e561fa6222 actions: update PHP versions 2021-08-16 23:14:17 +01:00
b3298d7c77 Fix Skull->asItem() (#4375) 2021-08-16 19:06:30 +01:00
a012e7ccc0 VersionInfo: make static methods more constant-like
if we could have class constants declared at runtime, these would be constant.
2021-08-16 16:37:36 +01:00
5da90b9530 Stop auto-translating strings when not asked
fixes #4371
2021-08-15 20:44:27 +01:00
a81680c5c6 missed a few more hardcoded translation keys 2021-08-15 20:12:55 +01:00
039c59856d Remove % translation prefixes dotted around all over the place 2021-08-15 20:03:38 +01:00
39cdf23bd5 Language: Attempt to treat parameters as translation keys, even if they don't have %prefixes
%prefixes should only be necessary for embedded translations where the key isn't at the start of the string.

Longer term we should just drop raw string translation entirely and just translate Translatables exclusively, but this is a stepping stone.
2021-08-15 20:00:58 +01:00
1aa541aefe Utils: remove useless commented code 2021-08-15 19:38:55 +01:00
dfc82f6820 VanillaCommand: fix bogus mixed typehints 2021-08-15 19:32:33 +01:00
60ac76a3bc Remove more usages of hardcoded translation keys 2021-08-15 19:22:40 +01:00
752d1179a1 Do not rely on random translation keys prefixed with % getting translated 2021-08-15 19:05:05 +01:00
715fbc9ee5 fix last remaining non-usages of KnownTranslationFactory 2021-08-15 16:35:51 +01:00
789a669395 Rename TranslationContainer -> Translatable 2021-08-15 16:17:46 +01:00
5bdcc0339f build/generate-known-translation-apis: make the ref to TranslationContainer statically analysable
this ensures that it will follow refactors automatically with no additional changes.
2021-08-15 16:13:07 +01:00
177eecf9ee [ci skip] changelog: mention recent translation changes 2021-08-15 16:04:27 +01:00
db90b40bdd Command: remove unnecessary branching in broadcastCommandMessage()
this problem is handled automatically now that nested translations are supported.
2021-08-15 16:00:16 +01:00
4748b0db37 PluginManager: remove unused import 2021-08-14 21:28:38 +01:00
8b9d7d6390 Support for nested TranslationContainers 2021-08-14 20:57:13 +01:00
804d02b086 TranslationContainer: added prefix(), postfix() and format() 2021-08-14 16:08:22 +01:00
13d4131d0d Remove player update warnings
a player ingame is not going to have access to the terminal to update PM, and if they do, they can see the warning on the console themselves anyway.
2021-08-14 13:27:21 +01:00
ecdfd9ea26 Terminal: reduce code duplication in getFallbackEscapeCodes() 2021-08-13 14:04:13 +01:00
78c2dcaee5 Terminal: fixed crash on platforms which don't support tput fully
in 8-bit colour mode, it seems that ITALIC is not supported. This only showed its face now because of typed properties.
closes #4365
closes #4366
2021-08-13 14:00:17 +01:00
025dde19ce Bump phpstan/phpstan-phpunit from 0.12.21 to 0.12.22 (#4367)
Bumps [phpstan/phpstan-phpunit](https://github.com/phpstan/phpstan-phpunit) from 0.12.21 to 0.12.22.
- [Release notes](https://github.com/phpstan/phpstan-phpunit/releases)
- [Commits](https://github.com/phpstan/phpstan-phpunit/compare/0.12.21...0.12.22)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-13 12:51:34 +01:00
2ca7fc7254 Server: add native return types to getters that were skipped first time 2021-08-12 23:56:43 +01:00
0e0bbdfb70 Use typed properties in Server 2021-08-12 23:52:39 +01:00
e907c70160 ... 2021-08-12 23:37:24 +01:00
34309bc810 TextFormat: do not assume that an array given to toHTML() is actually a tokenized string
this is a far stretch, since the documentation doesn't mention that the string needs to be tokenized. Anyone passing an array in here is most likely doing so by mistake.
2021-08-12 23:37:00 +01:00
a59ac522ee Terminal: do not assume that an array given to toANSI() is actually a tokenized string
this is a far stretch, since the documentation doesn't mention that the string needs to be tokenized. Anyone passing an array in here is most likely doing so by mistake.
2021-08-12 23:35:45 +01:00
ab232ee759 Merge branch 'master' of github.com:pmmp/PocketMine-MP 2021-08-12 23:32:05 +01:00
d30371be11 Command: Assume that TranslationContainer->getText() returns a valid translation key
there's no reason for it not to be.
2021-08-12 23:31:37 +01:00
58bc9332cd Workaround for offhand sync (#4359)
fixes #4231
2021-08-12 23:27:53 +01:00
27e0ecf7ee Implemented Blast Furnace and Smoker (#4362) 2021-08-12 23:27:05 +01:00
483c16cc41 Updated to ramsey/uuid 4.2.1 2021-08-12 20:42:23 +01:00
ce70dc48c0 composer.json: added update-translation-apis custom command 2021-08-12 20:37:03 +01:00
fd41a0f510 Remove colors from VersionCommand
these will have to stay gone for now, until we have some way to terminate formatting codes without breaking logger output. (we need &p!! #4364)
2021-08-12 20:35:34 +01:00
d18b5cb306 composer.json: added update-registry-annotations command 2021-08-12 20:30:21 +01:00
662d1a35ff generate-registry-annotations: skip files that don't contain classes 2021-08-12 20:29:21 +01:00
6a2a4cca4d Terminal: use match instead of switch in toANSI()
phpstan seems to have some trouble with large match statements (phpstan/phpstan#5454)
2021-08-12 20:13:44 +01:00
2782af7e22 Terminal: use typed properties 2021-08-12 19:41:16 +01:00
4d683c63d8 TextFormat: remove toJSON()
this is not used in the PM core, and is only used by 1 plugin in the whole public ecosystem: BigBrother. It makes more sense to make BigBrother maintainers shoulder the responsibility of maintaining this code, since they are the only ones that need it - besides, if this changed in any MCJE update in the last 5y, nobody has updated it, and nobody has maintained it either due to not having a fucking clue what the thing is for (the documentation is basically nonexistent).
2021-08-12 13:43:58 +01:00
eb24e040f3 TextFormat: add COLORS and FORMATS constants 2021-08-12 13:13:33 +01:00
28bfe9fbb4 emit_performance_warnings(): Log a warning when using a PHP debug build 2021-08-11 20:14:03 +01:00
99e68fb5d3 Merge branch 'master' of github.com:pmmp/PocketMine-MP 2021-08-10 19:48:39 +01:00
f42c9bb6d6 Removed unused translation 2021-08-10 19:48:30 +01:00
cf77b33c3b Bows can now use offhand arrows (#4356) 2021-08-10 19:36:57 +01:00
2cdd6e634f New /version format 2021-08-10 19:32:28 +01:00
2ad5de379f HandlerListManager::unregisterAll() accepts RegisteredListener
since all this function is doing is passing the object on to the HandlerList, it should accept RegisteredListener, like HandlerList::unregister().
2021-08-10 15:28:11 +01:00
b4c0ddd155 Use native union types for TranslationContainer|string 2021-08-10 15:17:26 +01:00
27a2d06083 Fix CS 2021-08-10 14:53:03 +01:00
2293bd948d Added KnownTranslationFactory and use it in as many places as possible
this makes translation usage much more statically analysable.
The only places this isn't used are:
- places that prefix translations with colours (those are still a problem)
- places where server/client translations don't match (e.g. gameMode.changed accepts different parameters in vanilla than in PM)
2021-08-10 14:50:40 +01:00
d39080c45a TranslationContainer: Add support for named translation parameters
this also fixes use cases like:

[1] = something;
[0] = match(...)

It made no sense whatsoever to discard the keys anyway.

Language::translateString() already supported named parameters since
forever anyway.
2021-08-10 14:26:54 +01:00
de61417bb6 Simplify console subprocess require hack 2021-08-08 18:53:13 +01:00
4c10dcaa53 ConsoleReaderThread: fixed UTF-8 paths getting corrupted on the way to the subprocess in some cases
I was never able to reproduce this, but it appears that Windows breaks the character encoding of command parameters (and also unicode environment variables, even though UNICODE_ENVIRONMENT should be set in php-src) when the file path contains Unicode characters (such as Cyrillic).
We workaround this problem using base64, which is an abysmally shitty hack, but not worse than using a subprocess for ConsoleReader in the first place. PHP fucking sucks, and so does Windows.
closes #4353
2021-08-08 16:19:08 +01:00
91cb374220 LevelDB: fixed isPopulated state getting lost after chunk unload/reload 2021-08-08 16:01:45 +01:00
041d314190 HandlerListManager: apply class-string type for getListFor() parameter 2021-08-05 20:11:58 +01:00
b72d81be5e Cleanup PHPStan baselines 2021-08-04 21:24:13 +01:00
b31dce2119 Player: fixed type of loadQueue field 2021-08-04 21:17:44 +01:00
61b7faae08 Simplify BaseInventoryTest 2021-08-04 21:01:01 +01:00
00984c1b9f BaseInventory: Move contents of InventoryHelpersTrait back inline
I moved these to a trait in anticipation of having multiple full Inventory implementations. That's no longer necessary because of the abstraction of SimpleInventory.
2021-08-04 20:57:20 +01:00
bb79797b68 WhitelistCommand: fixed permission checking
closes #4349
2021-08-04 20:34:54 +01:00
71c6f69fd3 Command: standardise permission checking
if subcommands had different permissions, the permissionMessage would not be used.
2021-08-04 20:29:07 +01:00
cd53fa162b Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2021-08-03 20:22:41 +01:00
efb677d5d5 Merge branch 'stable' 2021-08-03 20:22:17 +01:00
748e9705ba Updated build/php submodule to pmmp/php-build-scripts@49971716b0 2021-08-03 20:20:56 +01:00
50b4ec0d20 Override timeout for the subprocess also 2021-08-03 18:50:36 +01:00
16965fa742 ConsoleReaderThread: override default socket timeout for accept
otherwise, people can break the console reader by setting the default timeout to zero or some other small value.
2021-08-03 18:48:18 +01:00
c567ed4b7a fix build error 2021-08-03 15:32:21 +01:00
565cf84e1b MemoryManager: use typed properties 2021-08-03 15:13:28 +01:00
dcd203370b Player: make use of typed properties
readability significantly benefits from use of typed properties here.
2021-08-03 15:02:32 +01:00
219ed81389 Player: Fixed items on the crafting grid disappearing when the player disconnects (#4344) 2021-08-02 19:48:36 +01:00
8221475ce2 BlockDataSerializer: fix wrong exception type being thrown 2021-08-02 19:20:19 +01:00
bdac98beaf Block: get rid of getNonPersistentStateBitmask(), add writeStateToItemMeta()
this is more flexible and less confusing.
2021-08-02 19:17:24 +01:00
01b48a21d9 Simplify NetworkSession ticking
we need to tick sessions every tick anyway, because other stuff is happening (e.g. sync attributes/entity metadata, batch buffer flush).
2021-08-02 14:32:00 +01:00
6a7196530c Bump phpunit/phpunit from 9.5.7 to 9.5.8 (#4345)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.7 to 9.5.8.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.7...9.5.8)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-02 11:52:17 +01:00
eb23d27004 composer: accept ext-leveldb ^0.3.0 2021-07-31 18:11:34 +01:00
1bbf739385 the function stringToLegacy gives already null useless to put a default null (#4338) 2021-07-31 16:54:31 +01:00
22c3736d63 LightUpdate: micro optimisations opcache isn't smart enough for
this removes 6 unnecessary opcodes from computeSpreadLight() and 3 from computeRemoveLight(). Tested with opcache.opt_debug_level=0x20000.
2021-07-30 23:30:28 +01:00
3319fad863 Fix build error 2021-07-26 20:33:44 +01:00
2b5667a56b Move PHP minimum to 8.0 2021-07-26 20:29:39 +01:00
09eac0e129 Merge remote-tracking branch 'origin/stable' 2021-07-26 20:14:33 +01:00
f9863acadc Restart console reader subprocess if it dies
this can happen for a bunch of different reasons, which are all indistinguishable. This also fixes pmmp/PcntlSignalHandler#3.
2021-07-26 15:38:38 +01:00
c2c9132812 ConsoleReaderThread: say what actually happened when we fail to read commands 2021-07-26 15:17:24 +01:00
c7bb77e24a ConsoleReaderChildProcess: die voluntarily if connection to server process is closed
this happens if the parent process is killed via SIGINT, because its stdin will be closed, interrupting a blocking read. This might also happen if the user pressed CTRL+D, so we don't die unless end of socket stream was also detected.

closes #4335
2021-07-26 15:07:47 +01:00
01fe497c49 phpstan: use PHP 8.0 as primary version
I'm using 8.0 for local development now, so having the phpstan configs targeted at 7.4 by default makes things inconvenient.
2021-07-26 14:34:47 +01:00
1afda04620 PrimedTNT: fixed fuse not getting updated client-side, closes #4333 2021-07-25 12:27:25 +01:00
8f01caf335 Merge branch 'stable' 2021-07-24 22:42:06 +01:00
3bbd088a09 Update build/php submodule to pmmp/php-build-scripts@280dd0524a 2021-07-24 22:40:28 +01:00
1246d1b7ef Use a subprocess for reading lines from STDIN (#4332)
this FINALLY provides us with a way to deal with Windows without needing to forcibly terminate the entire server on shutdown.
2021-07-24 22:10:50 +01:00
772935cd7e Updated biome ID constants 2021-07-23 22:39:54 +01:00
58498c2b0b Merge remote-tracking branch 'origin/stable' 2021-07-23 16:40:19 +01:00
f89e10e684 Silence openssl_free_key() deprecation warnings on 8.0
we don't give a shit and these calls are currently needed for 7.4.
2021-07-23 16:30:22 +01:00
85effa5240 Remove junk from php8 baseline 2021-07-23 15:56:06 +01:00
81c5b83bd9 actions: test on 8.0 2021-07-23 15:55:01 +01:00
ef31a9fc66 Update bug_report.md 2021-07-23 13:32:18 +01:00
dc56a99473 3.22.2 is next 2021-07-23 13:03:27 +01:00
9477034a4a Release 3.22.1 2021-07-23 13:03:27 +01:00
5844b59b12 Fixed incorrect encoding of NpcDialoguePacket
this is in fact an ActorUniqueID, but for some reason written as a uint64 instead of a varint.
2021-07-23 12:53:30 +01:00
0eb4231b51 Use OpenSSL for ECDH during client login, drop mdanter/ecc (#4328)
This brings a significant performance improvement to login sequence handling, reducing CPU cost of `PrepareEncryptionTask` by over 90% and `ProcessLoginTask` by over 60%. It also allows us to shed a dependency.
2021-07-22 23:04:00 +01:00
3af18917f0 Player: remove note about bans from getUniqueId()
while it's true that you might be able to skip the CPU waste from verifying a player's login just to find out that they are banned, this is generally a minority case anyway, so it doesn't make a lot of difference overall. This additional note is essentially a recommendation premature optimisation, which will likely lead to people making security mistakes.
2021-07-22 22:14:14 +01:00
61528393c2 Player: rewrite the confusing documentation of getUniqueId() 2021-07-22 21:14:31 +01:00
59b8453228 Player: added extra debug message for XUID mismatches 2021-07-22 21:04:40 +01:00
83016a97bd Added getMushroomBlockType() / setMushroomBlockType() APIs to Red/BrownMushroomBlock 2021-07-22 19:13:26 +01:00
41d9bf8a2e PthreadsChannelWriter: remove unused import 2021-07-22 19:08:21 +01:00
832a156fc7 RakLib: split PthreadsChannelWriter into two implementations
this gains a very small performance improvement by avoiding unnecessary !== null checks on every packet written in either direction. It's insignificant for sure, but I just found this code in an old stash, so what the heck.
2021-07-22 18:52:58 +01:00
5c609cc1c1 Added getShape() and setShape() APIs to StraightOnlyRail and Rail 2021-07-22 18:37:30 +01:00
e97234d420 Refactor Rail handling to allow LSP-complaint shape handling
the reason there hasn't been any API until now is because of how inconvenient it was to expose a LSP-compliant API _and_ use the same base class for handling all the connection logic. This commit fixes that problem by abstracting shape handling away from BaseRail entirely, so that now it deals exclusively with connections. Deciding the shape of rail to use is now the job of the subclasses.
2021-07-22 17:35:10 +01:00
2476f40cc6 Rail: store shape instead of connections
shape is what we'll eventually expose on the API.
2021-07-22 16:45:42 +01:00
77138c5c06 Living: changed bad parameter name 2021-07-22 15:46:08 +01:00
e803ca0e06 Living: Limit vertical knockback to 0.4 by default
this will break non-standard use cases with large forces, but they only have to stick a 'null' at the end of the parameter list.
Since this function should be primarily used for vanilla knockback, it makes more sense to keep the default as vanilla, but allow people to change it if they want to.

closes #4106 (this is close to #4106 anyway, but small enough that it was easier to recreate it than pull and modify it)
closes #2707
2021-07-22 14:27:20 +01:00
3466fbe3e3 MemoryManager: remove unused variable declaration
it's overwritten further down anyway.
2021-07-21 19:25:01 +01:00
309bed414f Implemented sweet berries (#4164)
this doesn't implement the server-side logic for the "stickiness" (slowdown) because we don't have the system needed for it yet.
It also doesn't have parity with vanilla on the damage.
2021-07-19 20:01:33 +01:00
f64ef50ce3 ShulkerBox: fixed incorrect block-picking behaviour 2021-07-19 18:08:13 +01:00
dcbc0bc2a6 BrownMushroomBlock: remove useless function 2021-07-19 17:58:24 +01:00
71df15b4cc Removed FlowerPot update_bit hack 2021-07-19 17:39:35 +01:00
5874ce582a Implemented bells 2021-07-19 17:00:56 +01:00
8cb48bfe1d Bump phpunit/phpunit from 9.5.6 to 9.5.7 (#4322)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.6 to 9.5.7.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.6...9.5.7)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-19 12:48:11 +01:00
e0a9fb6eac Merge remote-tracking branch 'origin/stable' 2021-07-19 00:16:04 +01:00
8fb4d7b982 BUILDING.md: Changed pre-requisites PHP version to 7.4 or newer (#4319)
[ci skip]
2021-07-18 00:08:14 +01:00
c5abae9eaa Fixed merge error in bbf3f4c476
the corresponding code on PM3 was originally removed here: 485f573955 (diff-cf181dff0292664e4aa13c8a1731dc62131489fa404f4ac1357493d320264cceL2263)
2021-07-17 22:59:45 +01:00
13f114f30e bootstrap: report loaded php.ini in error, as well as php binary path
in some cases extension loading issues are caused by incorrect php.ini path, which should be easy to spot if the path is given.
2021-07-17 21:50:30 +01:00
eccd258aeb start.cmd: fixed incorrect php.ini scan dir when using a non-local binary 2021-07-17 21:49:11 +01:00
bd5f379c4c apparently opcache_get_status() may return false? 2021-07-17 21:11:12 +01:00
d35e818ea0 BlockLegacyMetadata: added constants for bell attachment types 2021-07-17 19:11:28 +01:00
19e81b0cd3 BlockFactory: Be aware of potential size changes to metadata bits
during testing I found the need to use more bits (for example, bells have 32 states in 1.12).
2021-07-17 19:06:49 +01:00
2588895ab0 bootstrap: add a giant yellow warning about JIT 2021-07-17 19:00:19 +01:00
17d0767db5 ChunkSerializer: implement support for persistent network chunk format 2021-07-17 18:45:04 +01:00
e5327a0f3e ChunkSerializer: Extract serializeSubChunk() from main serialize() routine
this will be used in the future for cache-based chunk sends.
2021-07-17 18:29:14 +01:00
432999a7d7 Bump phpstan/phpstan-phpunit from 0.12.20 to 0.12.21 (#4313)
Bumps [phpstan/phpstan-phpunit](https://github.com/phpstan/phpstan-phpunit) from 0.12.20 to 0.12.21.
- [Release notes](https://github.com/phpstan/phpstan-phpunit/releases)
- [Commits](https://github.com/phpstan/phpstan-phpunit/compare/0.12.20...0.12.21)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-15 22:32:47 +01:00
5fbc7681b0 Allow registering multiple ClassLoaders for a thread 2021-07-15 19:00:40 +01:00
68699dbff9 PlayerAuthInputFlags: Fixed a mistake in the documentation 2021-07-14 21:08:23 +01:00
ac8b13ee36 actions: don't preprocess anything except dependency src 2021-07-14 20:47:07 +01:00
53d7ed2b5c these tests are now done by pocketmine/bedrock-protocol 2021-07-14 20:39:32 +01:00
a2e2196a90 Start using pocketmine/bedrock-protocol library 2021-07-14 20:32:15 +01:00
b86d682793 Update to released version of pocketmine/math 2021-07-14 20:14:33 +01:00
9f11be25cb LevelSoundEventPacket: fixed bad null assignment in ::create() 2021-07-14 15:21:33 +01:00
c474aa42e5 ClientDataToSkinDataHelper: Remove SingletonTrait
SingletonTrait is pointless here for multiple reasons:
1) the class is final
2) this is protocol-specific translation of types, no loss of data or alternative mutation of it needs to occur

Using SingletonTrait is an obstacle to separating the protocol library from the core code, so it has to go.
2021-07-14 14:50:59 +01:00
1ad38d499c Deglobalize ItemTypeDictionary usage, at least for the protocol
while this is a bit hacky outside of the protocol namespace, it makes it much easier to use the protocol library for alternative purposes, such as for a client or MITM proxy.
It also removes all but one remaining core dependency of the protocol library, making it very close to being able to be separated from the server core entirely.
2021-07-14 14:26:32 +01:00
bfbe3d83de 3.22.1 is next 2021-07-13 18:31:34 +01:00
c32c21464c Release 3.22.0 2021-07-13 18:31:28 +01:00
0c2917f2aa Merge branch 'pm4-bedrock-1.17.10' 2021-07-13 18:20:00 +01:00
28ede7273f Fixed CS 2021-07-13 18:16:25 +01:00
16faafa1ef Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2021-07-13 18:11:03 +01:00
a182b36b71 Merge branch 'pm4-bedrock-1.17.10' 2021-07-13 18:04:24 +01:00
f77da60dd3 Merge branch 'pm3-bedrock-1.17.10' into pm4-bedrock-1.17.10 2021-07-13 18:02:29 +01:00
4d6ac57a26 Fixed particle IDs 2021-07-13 17:54:40 +01:00
676bacbee1 Improve the flexibility of WorldProvider registration
WorldProviders now have the following requirements removed:
- __construct() is no longer required to have a specific signature
- static isValid() no longer needs to be implemented (you will still need it for registering, but it can be declared anywhere now)
- static generate() no longer needs to be implemented

This paves the way for more interesting types of world providers that use something other than local disk to store chunks (e.g. a mysql database).

WorldProviderManager no longer accepts class-string<WorldProvider>. Instead, WorldProviderManagerEntry is required, with 2 or 3 callbacks:
- ReadOnlyWorldProviderManager must provide a callback for isValid, and a callback for fromPath
- WritableWorldProviderManagerEntry must provide the same, and also a generate() callback

In practice, this requires zero changes to the WorldProviders themselves, since a WorldProviderManagerEntry can be created like this:
`new WritableWorldProviderManagerEntry(\Closure::fromCallable([LevelDB::class, 'isValid']), fn(string ) => new LevelDB(), \Closure::fromCallable([LevelDB::class, 'generate']))`

This provides identical functionality to before for the provider itself; only registration is changed.
2021-07-13 16:55:21 +01:00
73ba1ba224 Bump phpstan/phpstan from 0.12.91 to 0.12.92 (#4309)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.91 to 0.12.92.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.91...0.12.92)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-12 12:35:35 +01:00
654fc9a2a6 LegacyStringToItemParser: Throw more specific exceptions 2021-07-10 21:03:12 +01:00
9afc5be0f5 Shulker open/close sounds != shulker box open/close sounds 2021-07-10 19:59:59 +01:00
fc090e238d Add Shulker Boxes (#3678)
this implementation is working, although incomplete:

- The shulker close sound should not be played until the end of the shulker closing animation, which takes approximately 1 second.
- An open shulker box has a different collision box than a closed one - it should be +0.5 in whichever direction the shulker is facing. (During the animation, the bounding box also dynamically changes size - you can see this in vanilla by shooting an arrow into the top of an open shulkerbox facing UP, and then closing it - the arrow will fall and collide with the lid multiple times.

However, resolving both of these issues requires significant internal changes which are beyond the scope of this PR.
2021-07-10 19:48:38 +01:00
b07000f613 Merge branch 'pm3-bedrock-1.17.10' into pm4-bedrock-1.17.10 2021-07-09 20:02:30 +01:00
3997e612b1 silence phpstan bug phpstan/phpstan#5271 2021-07-09 19:44:25 +01:00
9d1b2c839d this managed to get lost in the merge 2021-07-09 19:39:15 +01:00
aeb007d0a1 Merge remote-tracking branch 'origin/stable' 2021-07-09 19:36:32 +01:00
8b79253d3b Protocol changes for 1.17.10 2021-07-09 19:29:34 +01:00
4e731f61af BlockFactory: Remap double slab IDs with 0x8 bit set to their base DOUBLE state, instead of BOTTOM
this was causing problems with slabs in converted Java worlds, where the
0x8 bit means 'smooth', instead of 'double'. In MCPE it has no effect.

Since Slab doesn't retain the high/low flag for DOUBLE type slabs, this
caused BlockFactory to assume that those states were invalid, and
remapped them to their base state instead.

The following changes resulted in the consistency check:

Remap changed for 43:8 (44:0 (Smooth Stone Slab) -> 43:0 (Smooth Stone Slab))
Remap changed for 43:9 (44:1 (Sandstone Slab) -> 43:1 (Sandstone Slab))
Remap changed for 43:10 (44:2 (Fake Wooden Slab) -> 43:2 (Fake Wooden Slab))
Remap changed for 43:11 (44:3 (Cobblestone Slab) -> 43:3 (Cobblestone Slab))
Remap changed for 43:12 (44:4 (Brick Slab) -> 43:4 (Brick Slab))
Remap changed for 43:13 (44:5 (Stone Brick Slab) -> 43:5 (Stone Brick Slab))
Remap changed for 43:14 (44:6 (Quartz Slab) -> 43:6 (Quartz Slab))
Remap changed for 43:15 (44:7 (Nether Brick Slab) -> 43:7 (Nether Brick Slab))
Remap changed for 157:8 (158:0 (Oak Slab) -> 157:0 (Oak Slab))
Remap changed for 157:9 (158:1 (Spruce Slab) -> 157:1 (Spruce Slab))
Remap changed for 157:10 (158:2 (Birch Slab) -> 157:2 (Birch Slab))
Remap changed for 157:11 (158:3 (Jungle Slab) -> 157:3 (Jungle Slab))
Remap changed for 157:12 (158:4 (Acacia Slab) -> 157:4 (Acacia Slab))
Remap changed for 157:13 (158:5 (Dark Oak Slab) -> 157:5 (Dark Oak Slab))
Remap changed for 181:8 (182:0 (Red Sandstone Slab) -> 181:0 (Red Sandstone Slab))
Remap changed for 181:9 (182:1 (Purpur Slab) -> 181:1 (Purpur Slab))
Remap changed for 181:10 (182:2 (Prismarine Slab) -> 181:2 (Prismarine Slab))
Remap changed for 181:11 (182:3 (Dark Prismarine Slab) -> 181:3 (Dark Prismarine Slab))
Remap changed for 181:12 (182:4 (Prismarine Bricks Slab) -> 181:4 (Prismarine Bricks Slab))
Remap changed for 181:13 (182:5 (Mossy Cobblestone Slab) -> 181:5 (Mossy Cobblestone Slab))
Remap changed for 181:14 (182:6 (Smooth Sandstone Slab) -> 181:6 (Smooth Sandstone Slab))
Remap changed for 181:15 (182:7 (Red Nether Brick Slab) -> 181:7 (Red Nether Brick Slab))
Remap changed for 422:8 (417:0 (End Stone Brick Slab) -> 422:0 (End Stone Brick Slab))
Remap changed for 422:9 (417:1 (Smooth Red Sandstone Slab) -> 422:1 (Smooth Red Sandstone Slab))
Remap changed for 422:10 (417:2 (Polished Andesite Slab) -> 422:2 (Polished Andesite Slab))
Remap changed for 422:11 (417:3 (Andesite Slab) -> 422:3 (Andesite Slab))
Remap changed for 422:12 (417:4 (Diorite Slab) -> 422:4 (Diorite Slab))
Remap changed for 422:13 (417:5 (Polished Diorite Slab) -> 422:5 (Polished Diorite Slab))
Remap changed for 422:14 (417:6 (Granite Slab) -> 422:6 (Granite Slab))
Remap changed for 422:15 (417:7 (Polished Granite Slab) -> 422:7 (Polished Granite Slab))
Remap changed for 423:8 (421:0 (Mossy Stone Brick Slab) -> 423:0 (Mossy Stone Brick Slab))
Remap changed for 423:9 (421:1 (Smooth Quartz Slab) -> 423:1 (Smooth Quartz Slab))
Remap changed for 423:10 (421:2 (Stone Slab) -> 423:2 (Stone Slab))
Remap changed for 423:11 (421:3 (Cut Sandstone Slab) -> 423:3 (Cut Sandstone Slab))
Remap changed for 423:12 (421:4 (Cut Red Sandstone Slab) -> 423:4 (Cut Red Sandstone Slab))
2021-07-08 20:37:19 +01:00
605e26d584 remove unused import 2021-07-05 20:03:11 +01:00
5130a32333 GameMode: removed dead property (leftover from 902ea515f7) 2021-07-05 20:00:24 +01:00
b7ea10b905 MainLogger: do not assume that exception codes are always integers
PDOException most notably breaks this rule.
closes #4294
2021-07-05 19:20:59 +01:00
1122131c8d 3.21.2 is next 2021-07-05 18:49:26 +01:00
a50ef2af6f Release 3.21.1 2021-07-05 18:49:26 +01:00
72e4660800 Updated build/php submodule to pmmp/php-build-scripts@4bf8ec1ad0 2021-07-05 18:42:35 +01:00
e6285a0312 Update composer transitive dependencies 2021-07-05 17:22:32 +01:00
5420e76a9a Bump phpstan/phpstan-strict-rules from 0.12.9 to 0.12.10 (#4295) 2021-07-05 13:20:03 +00:00
de46a81cf4 Bump phpstan/phpstan from 0.12.90 to 0.12.91 (#4296)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.90 to 0.12.91.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.90...0.12.91)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-05 14:07:49 +01:00
1d8f0033af BlockBreakInfo: Expose hardness multipliers as constants 2021-06-30 19:47:11 +01:00
7a35fdb1bb Allow Blocks to specify their max stack size 2021-06-30 19:28:16 +01:00
91d54ff0ad Removed unnecessary and/or obsolete GC hacks
the intent of these hacks was to break cyclic references to avoid having objects lingering in memory. However, all of the stuff that's being removed in this commit no longer has any effect anyway, due to the fact that these things don't circularly reference each other anymore. Notably, Tile inventories now keep Position instead of a Tile ref.
2021-06-30 19:16:25 +01:00
c05f6db8d9 Bed and Skull items now return a correct block, with appropriate type information
I wanted to do the same for banners, but unfortunately banners are a tad more complicated.
2021-06-30 17:27:14 +01:00
12905d8c27 BlockFactory: remove some TODOs 2021-06-30 17:03:20 +01:00
2b4a1ffdfb Bed: use ColoredTrait 2021-06-30 16:07:46 +01:00
9e79d48aeb BaseBanner: use ColoredTrait 2021-06-30 16:07:45 +01:00
a888ab0257 GiveCommand: remove useless clone
addItem() clones this anyway.
2021-06-30 14:07:58 +01:00
f3bd48e6cb Updated some more hardcoded translation key usages missed by 94e16f416d 2021-06-30 14:02:55 +01:00
76a74b3931 Revert "Item: skip a step when decoding PC itemstacks"
This reverts commit 9b52af62b6.

We shouldn't assume that a string maps directly to a legacy ID,
because we might want string aliases (e.g. dark_oak_boat) which refer to
items that have a specific meta value in the MCPE system.

Overall, I want to get rid of the reliance on IDs here and register all
this stuff using closure callbacks on VanillaItems, so getting rid of
this assumption also serves that goal.
2021-06-30 13:13:53 +01:00
2312511be6 Living: remove unnecessary double CompoundTag::getTag() call 2021-06-29 23:54:52 +01:00
316e2654cc Fixed CS 2021-06-29 22:50:08 +01:00
94e16f416d Added KnownTranslationKeys (generated) and start using it 2021-06-29 22:46:04 +01:00
f02817bcd3 Player: fixed toString() on TranslationContainer exposed by previous commit
this code looks smelly...
2021-06-29 20:14:11 +01:00
83332024df TranslationContainer: remove __toString()
it doesn't make any sense to use TranslationContainer in this way.
2021-06-29 20:07:39 +01:00
1170c8fe13 EnumTrait: override __clone, __sleep, __wakeup to prevent duplication 2021-06-29 19:55:43 +01:00
7ba573db77 Added API method Item::canStackWith() 2021-06-29 19:52:52 +01:00
32d7b1e6af Start using webmozart/pathutil for joining paths (#4287) 2021-06-29 19:40:43 +01:00
aee7b03c1d changelog: fix outdated mention of ProjectileItem::getProjectileEntityClass()
[ci skip]
2021-06-29 19:26:02 +01:00
35ad199b11 changelog: mention Potion API changes
[ci skip]
2021-06-29 19:24:28 +01:00
7029f85c1c Regenerated VanillaItems 2021-06-29 18:23:24 +01:00
0ec869823b Added potion display names to Potion and SplashPotion 2021-06-29 18:21:41 +01:00
07d97bbdeb PotionType: Added display names 2021-06-29 18:19:27 +01:00
f68caa878a Potion: added getType() 2021-06-29 16:53:26 +01:00
6fb8ac211e Make GameMode::fromString() and PluginEnableOrder::fromString() return null, instead of throwing exceptions
since these are always used for handling userdata, it doesn't make sense for them to throw exceptions.
2021-06-27 20:56:51 +01:00
3dd33cd35e Get rid of EnumTrait::fromString()
it's better to just implement this for stuff where there's explicitly designated aliases, otherwise we could end up with unexpected BC breaks (e.g. hardcoding POSTWORLD in plugin.yml would suddenly break if the core enum was changed, even though it remained valid).
2021-06-27 20:52:56 +01:00
902ea515f7 Separate ID handling from GameMode
the aliases of 0,1,2,3 remain for user-interface level compatibility.
2021-06-27 20:32:35 +01:00
5cdf0b169f PluginManager: Separate listener method filtering to its own method
this makes registerEvents() easier to read.
2021-06-27 20:25:28 +01:00
db28358316 Player: Assume that usedChunks was cleared by the previous loop 2021-06-27 17:50:39 +01:00
ede4d58394 Automatic permission calculation on PermissibleBase construction
thanks to the PermissibleInternal/PermissibleBase architectural change, there's no longer any concern regarding cyclic refs.
2021-06-26 22:15:22 +01:00
02fab77e55 World: change 'closed' to 'unloaded'
this makes more sense overall from a reader's perspective.
and also provide a rug-jerk for any idiots using World->close() when they aren't supposed to? ....
2021-06-26 21:54:18 +01:00
b8ebf8936e InventoryManager: fix container open callbacks not working
this was reported to me on socials by multiple different people, but nobody reported an issue so I almost forgot. >.<
2021-06-26 21:21:23 +01:00
9b30c2feda Extract a DelegateInventory from EnderChestInventory 2021-06-26 21:01:40 +01:00
8cd7cc7c00 pacify php-cs-fixer 2021-06-26 19:32:05 +01:00
e14bad4ea6 Rename CommandReader and friends to ConsoleReader 2021-06-26 19:29:58 +01:00
a70bd115f1 Moved console-specific stuff to its own namespace
this stuff has different functionality than everything else in the
command namespace (specifically console handling), so it doesn't belong
in here.

I know that this will probably break some plugins, but I don't care,
because plugins shouldn't have been abusing ConsoleCommandSender in the
first place.
2021-06-26 19:24:46 +01:00
bf7d69b69e Stop hardcoding permission names everywhere
using strings for permission names is nearly as shitty, but this is at least cross-referencable and statically analysable.
2021-06-26 19:14:51 +01:00
0cdc04f9b5 Player: Fixed so-called 'pot lag'
this occurred because of transactions arriving before MobEquipmentPacket updating the player's own held item slot. This was only a problem while rapidly changing hotbar slots and simultaneously using items, like projectiles.
closes #4168
2021-06-26 18:56:30 +01:00
0910054c41 NetworkSession: Fixed InventoryManager nullability disaster
fixes #4277
fixes #4275
fixes #3139
2021-06-26 17:44:42 +01:00
e43bca95bf Fixed build 2021-06-26 17:40:43 +01:00
4a5bdefe8b Player: Explicitly clear permission recalculation callbacks
this is necessary to get rid of the broadcast permission callbacks, which retain references to the Player itself, forming a cycle which would prevent PermissibleBase->__destruct() from cleaning up.
2021-06-26 17:18:17 +01:00
8b1a84f2bf Bump phpunit/phpunit from 9.5.5 to 9.5.6 (#4282)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.5 to 9.5.6.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.5...9.5.6)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-26 16:49:19 +01:00
a6039ad733 Fixed InventoryHelpersTrait::addItem() cannot add items with a count greater than maxstack (#4283) 2021-06-26 16:48:53 +01:00
444d902990 Fix CS 2021-06-21 20:45:31 +01:00
2a6009f8bf Check consistency of block remaps 2021-06-21 20:45:30 +01:00
85ee628a74 Player: remove sendPosition() from public API
plugins shouldn't be touching this for any reason now.
2021-06-21 20:08:43 +01:00
60d80e173b Fixed player sounds not being broadcasted to the player itself
fixes #4259
fixes #4270
2021-06-21 20:03:32 +01:00
5d6146a01f Register missing potion types 2021-06-19 21:53:08 +01:00
5387456e44 Move potion types to enum 2021-06-19 21:39:23 +01:00
908fa5f901 changelog: rewrite a whole lot of confusing bullshit
EntityFactory doesn't exist at all on PM3, so mentioning changes in its
behaviour here is only going to confuse people.
2021-06-19 19:53:55 +01:00
c07f3f5e12 fix CS 2021-06-19 19:48:30 +01:00
6fea09ded4 SplashPotion: Require potionId in constructor 2021-06-19 19:47:44 +01:00
fc70b625b3 ExperienceOrb: Require providing XP value in constructor 2021-06-19 19:42:13 +01:00
981b0285d1 Isolate config casting nastiness in one place
this doesn't solve the underlying problem, but it does reduce the amount of noise made by PHPStan about it, as well as avoiding code litter.
2021-06-19 19:14:02 +01:00
11b483f2dc Inline EntityDataHelper::createBaseNBT()
this is only used for saving entity data now, and its presence here is allowing plugin devs to keep abusing it.
2021-06-19 18:45:21 +01:00
745f455bd2 Door: change thickness to match MCPE
since MCPE-19214 still hasn't been fixed after all these years, it's safe to say they won't fix it in the near future, and this causes placement glitches in PM.
2021-06-18 19:10:50 +01:00
d96fc17339 World: Check placed block collision boxes after place()
since we write these into a transaction instead of actually modifying the world directly, we can use the transaction to verify that the placement location is OK before setting the blocks.
closes #4248
2021-06-18 19:07:38 +01:00
735c656f9d Merge remote-tracking branch 'origin/stable' 2021-06-18 18:52:04 +01:00
155e516f74 phpstan 0.12.90 2021-06-18 18:46:30 +01:00
ea0a47dff7 Updated transitive composer dependency junk 2021-06-18 18:42:08 +01:00
f1583f44df LightArray: Avoid allocating 7 useless arrays for every node processed
instead, use a const array of the offsets and add them to the coordinates, which avoids the allocations.
In synthetic benchmarks, this method takes 40-50% less CPU time by eliding ZEND_INIT_ARRAY and ZEND_ADD_ARRAY opcodes. In practice, the benefit will likely be much smaller (perhaps even irrelevant).
2021-06-17 22:21:58 +01:00
15e5bdb210 BaseInventory::addItem(item1,item2,item3) now has the same behaviour as multiple separate addItem() calls (#4237)
fixes #1412
2021-06-17 21:05:24 +01:00
71a4ea2a95 FastChunkSerializer: remove useless variable initialization 2021-06-17 20:59:40 +01:00
0a6ce18322 CrashDump: Sort plugins list 2021-06-17 20:56:49 +01:00
43f71d0d63 FormatConverter: Copy worlds for backup if rename fails
this can fail if the backups directory points to a different drive than the original worlds location. In this case, we have to copy and delete the files instead, which is much slower, but works.
I REALLY advise against putting backups on a different mount point than worlds if you plan to convert large worlds.
2021-06-17 20:46:34 +01:00
ec6103d61e Leaves can now be silk touched, closes #3714 (#4240) 2021-06-17 15:37:02 +01:00
11d73e5bb8 Bump phpstan/phpstan-phpunit from 0.12.19 to 0.12.20 (#4273)
Bumps [phpstan/phpstan-phpunit](https://github.com/phpstan/phpstan-phpunit) from 0.12.19 to 0.12.20.
- [Release notes](https://github.com/phpstan/phpstan-phpunit/releases)
- [Commits](https://github.com/phpstan/phpstan-phpunit/compare/0.12.19...0.12.20)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-17 15:30:01 +01:00
61c59be299 Replace hardcoded block metadata shifts and masks with constants
we might want to make these bigger than 4 bits in the future.
2021-06-16 12:48:09 +01:00
c22f793521 RakLibInterface: Log a message when a non-0xfe packet is received 2021-06-15 19:20:31 +01:00
2ee86f0edf Improved UPnP exception handling 2021-06-13 23:02:42 +01:00
ec7ea98ead UPnP: expose more functionality 2021-06-13 22:48:38 +01:00
80bf948588 Separate UPnPNetworkInterface from UPnP implementation 2021-06-13 22:41:36 +01:00
3d0b21f30c Denoise NetworkSession with typed properties 2021-06-13 22:27:23 +01:00
e5dd5a5745 NetworkSession: Fixed missing nullable declarations
phpstan doesn't report these because .. reasons .. @ondrejmirtes this is causing bugs to go unfound :(
I'm aware of the irony that I just silenced the bugs that were exposed by this commit .. that's an architectural problem for another day
2021-06-13 22:24:12 +01:00
04a6e89d6f Change encryption to use CTR instead of GCM
despite MCPE claiming to use GCM, it omits the auth tag, which defeats the whole point of using GCM.
CTR can be used instead, with the final 4 bytes of the IV being 0002.
2021-06-13 21:57:23 +01:00
0df2677464 EncryptionContext: Allow passing encryption algo as a constructor parameter 2021-06-13 19:57:48 +01:00
492ad6bb66 3.21.1 is next 2021-06-13 15:38:22 +01:00
82e8eb46ac Release 3.21.0 2021-06-13 15:38:22 +01:00
c7868a810d Move PHP minimum to 7.4
7.3 isn't actively tested anymore, and since 7.4 has been out for so long already, it doesn't make sense to keep pandering to users who can't be bothered to update their PHP binaries.
In most cases, these users are also experiencing problems caused by older versions of pthreads that were long since fixed.
In addition, pthreads is no longer tested or supported on 7.3, so users can't get newer bug fixes even if they wanted to.
2021-06-13 15:34:24 +01:00
cc00b3e19b Merge remote-tracking branch 'origin/stable' 2021-06-13 15:27:29 +01:00
4df536fee7 Bump Snooze to 0.3.0 2021-06-13 15:22:12 +01:00
d8b56a1219 Update transient composer junk that we don't care about, but have to update so that it doesn't slip in to some other commit 2021-06-13 14:48:51 +01:00
a676dba9f0 Updated ClassLoader dependency 2021-06-13 14:48:51 +01:00
2cc22a29c1 Update composer dependencies 2021-06-13 14:40:46 +01:00
6fb364b16f Store ender chest viewer count on the tile, instead of relying on the inventory's viewer count (#4238)
Fixes #4021
2021-06-13 14:37:09 +01:00
8e2829bdd4 Remove movement workaround from 1.14.30 (#4246) 2021-06-13 14:32:40 +01:00
408e29da90 Removed PermissionRemovedExecutor
this interface is just about the most pointless code in all of PM or Bukkit. In over 4 million lines of code on Poggit, a Google search and a GitHub search, I didn't find a single usage of it that wasn't just bukkit internals code copy pasta, a spoon, a port of PM/Bukkit/whatever into a different language, or someone's generated javadoc.
2021-06-12 21:55:59 +01:00
b525f45bf8 Fixed CS 2021-06-12 21:51:08 +01:00
8e1d27a719 Constrain types to PermissibleInternal on internal permission subscription methods 2021-06-12 21:28:19 +01:00
bfcf4a25d4 Automatic cleanup of permission subscriptions on PermissibleBase destructor calls
this has gotten too complex ...
2021-06-12 21:12:39 +01:00
0ebafbd224 .... adding the most important part would probably help 2021-06-12 20:46:53 +01:00
7dcc4891ca Block: added getDropsForIncompatibleTool() 2021-06-11 19:09:14 +01:00
e4ed7bc4ea Fixed Mushroom Stem blocks never dropping anything 2021-06-11 19:04:12 +01:00
22b5e5db5e AsyncPool: Do not drop pending tasks on shutdown
this creates an extra element of uncertainty for async pool usage.
2021-06-11 18:30:32 +01:00
f245147c11 AsyncPool: make collectTasks() return value more accurate
during onCompletion() anything may happen, including scheduling new tasks, which the previous code did not account for.
2021-06-11 18:30:32 +01:00
af79e787ea Bump phpstan/phpstan from 0.12.88 to 0.12.89 (#4262)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.88 to 0.12.89.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.88...0.12.89)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-10 15:10:45 +01:00
532d57eec7 Arrow: Save and load critical state (#4241)
Fixes #3596
2021-06-09 14:00:36 +01:00
920eb7cce5 Merge branch 'stable' 2021-06-09 13:46:00 +01:00
65c53e6512 actions: use PHP 7.4.20 2021-06-09 13:44:00 +01:00
38a32c6540 changelog: remove mentions of unsupported / corrupted world handling
the fixes for these problems were backported to PM3 during the PHPStan integration.

[ci skip]
2021-06-09 13:19:40 +01:00
2fff3fa60c changelog: be more specific about the range of Bedrock worlds supported
this was written 2 years ago, before 1.13 was released to disrupt everything all over again.

[ci skip]
2021-06-09 13:16:57 +01:00
5503fadf13 3.20.1 is next 2021-06-08 20:21:55 +01:00
99964709c9 Release 3.20.0 2021-06-08 20:21:55 +01:00
b85f3bd149 make-release: abort on no changelog changes 2021-06-08 20:20:30 +01:00
2bbb24fab7 Merge branch 'stable' 2021-06-08 20:00:08 +01:00
57d274901d Protocol changes for 1.17.0 2021-06-08 19:40:28 +01:00
f3e1c82246 this again :thonkingtempered: 2021-06-08 19:27:49 +01:00
908b627846 3.19.4 is next 2021-06-08 18:52:01 +01:00
afb21c1df2 Release 3.19.3 2021-06-08 18:51:48 +01:00
988be2a96b Bump phpunit/phpunit from 9.5.4 to 9.5.5 (#4247)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.4 to 9.5.5.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.4...9.5.5)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-07 21:57:21 +01:00
afe67f7502 Updated build/php submodule to pmmp/php-build-scripts@0a0ac2abb3 2021-06-05 20:18:58 +01:00
2d686e6dc0 Merge remote-tracking branch 'origin/stable' 2021-06-04 18:03:32 +01:00
b257348a3a Renamed fields of AddEntityPacket and RemoveEntityPacket 2021-06-04 17:18:24 +01:00
12c66d3362 CraftingDataPacket: fixed assert failure on debug builds 2021-06-04 17:13:50 +01:00
9702b51bd1 Utils: improve how boolean arguments are displayed in stack traces 2021-06-02 21:36:47 +01:00
fadc96bb0e Utils: include spl_object_id() in stack traces 2021-06-02 21:34:19 +01:00
493977661f Require pocketmine/binaryutils ^0.2.1 2021-05-30 20:46:39 +01:00
7d99b0115c Added a getName() override for RakLibServer 2021-05-29 23:51:46 +01:00
0402e7e697 Separate CommandReader impl from CommandReaderThread 2021-05-29 23:41:11 +01:00
4bcc7e09cb PacketSerializer: fix unnecessary FQN 2021-05-29 14:24:48 +01:00
8171b18002 Separate ItemTypeDictionary implementation from initialization
we're not going to want implementation details like how it's setup getting in the way when we separate protocol from the core.
2021-05-29 14:24:05 +01:00
92fd2d35a4 SetDisplayObjectivePacket: added order and display slot constants (#4232) 2021-05-24 20:33:24 +01:00
f68b9e79e1 Use typed properties in block namespace 2021-05-22 23:52:31 +01:00
73c229a236 Block: fixed LSP violations in blocks using BlockIdentifierFlattened
a property's type can't be changed by a subclass
2021-05-22 23:40:54 +01:00
285ad25168 BlockFactory: use the vars we already have, instead of repeated method calls 2021-05-22 12:45:08 +01:00
f655d262be Added stripped all-sided-log variants
again, these should be dynamic; but right now it's not possible.
2021-05-22 12:43:07 +01:00
ac04911e88 BlockFactory: fix potential crash 2021-05-21 21:44:17 +01:00
24405b63c1 Coarse is now a state of Dirt, instead of a separate block 2021-05-21 21:36:49 +01:00
df260034cd BlockFactory: Fill default state for all variants covered by bitmask when mismatch occurs 2021-05-21 21:12:34 +01:00
e7b21cf9dc World: remove obsolete TODO comment
[ci skip]
2021-05-21 13:10:48 +01:00
2ab751f985 World: fixed potential bug scheduling async light updates multiple times 2021-05-21 13:09:38 +01:00
f6f0938b3b Merge branch 'stable' 2021-05-21 01:27:35 +01:00
61077c48f1 Worker: fixed quit() usually being useless
Worker::isRunning() returns false after it exits the run() function, even if tasks are stacked and it isn't shutdown.
While this is mostly harmless (since the internal destructor will join the thread anyway), this should be fixed anyway.
2021-05-21 01:24:07 +01:00
7968a72f0e Eliminate some duplicated breakinfos 2021-05-20 23:18:33 +01:00
376d2c4cd4 Consistently declare BlockBreakInfo at the constructor call site
instead of inside the class
2021-05-20 22:49:51 +01:00
e0c61071e1 3.19.3 is next 2021-05-19 22:53:31 +01:00
813d431208 Release 3.19.2 2021-05-19 22:53:30 +01:00
8b4aa36e16 Merge branch 'master' of github.com:pmmp/PocketMine-MP 2021-05-19 22:50:15 +01:00
af678f985d All types of coral now have fully dynamic types 2021-05-19 22:49:44 +01:00
4a367b4b0e ... 2021-05-19 00:49:10 +01:00
821c9c550b github web editor sucks 2021-05-19 00:48:25 +01:00
ee112b992d Bump phpstan/phpstan from 0.12.87 to 0.12.88 (#4222)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.87 to 0.12.88.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.87...0.12.88)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-19 00:18:48 +01:00
69fa8e8db7 Added documentation to BlockFormEvent 2021-05-19 00:17:39 +01:00
f8cfa191dd Fixed confusing hierarchy of BlockGrow/Form/SpreadEvent, closes #2792 2021-05-19 00:17:38 +01:00
4122517292 [ci skip] update changelog 2021-05-18 23:51:58 +01:00
1d8680aaa9 Update to released versions of BinaryUtils, Log, LogPthreads, NBT, RakLib and RakLibIpc
these all had to be updated in tandem because of the dependency tree - RakLib, RakLibIpc and NBT -> BinaryUtils, RakLib and LogPthreads -> Log, RakLibIpc -> RakLib.
2021-05-18 23:25:19 +01:00
f5da91b42a changelog: added a Configuration section
this might be incomplete.
[ci skip]
2021-05-17 23:49:47 +01:00
e4750ad2cd WorldTimings: apply native typehints 2021-05-17 23:23:46 +01:00
7217ff5ff5 World: added an extra subtiming for random chunk updates 2021-05-17 23:18:56 +01:00
4736b5968d WorldTimings: change some idiotic timer names 2021-05-17 23:14:30 +01:00
cdaf734470 World: Clean up ticking chunk loader tracking 2021-05-17 23:07:48 +01:00
643c3ed14e World: Require all adjacent chunks to a ticking chunk candidate to be unlocked, generated, loaded and light-populated
this should address the remaining problems with grass spread/death.
2021-05-17 20:59:40 +01:00
7abf50f503 World: Extracted a tickChunk() method from tickChunks()
most of what's left in tickChunks() is just selecting the chunks, rather than actually ticking them.
2021-05-17 20:54:51 +01:00
bab76f4a6e World: extract some blocks of logic from tickChunks() into their own methods
the amount of nested loops, cx/dx/chunkx/etc clusterfuck in this code makes it very difficult to work with...
2021-05-17 20:50:46 +01:00
10391be615 Remove useless class 2021-05-17 20:06:28 +01:00
5a14c1cb89 Entity: don't rebuild metadata every tick unless an associated property changed
this should improve performance back to PM3 levels.
2021-05-17 20:05:52 +01:00
c9b33e2b9f Bump phpstan/phpstan-phpunit from 0.12.18 to 0.12.19 (#4214)
Bumps [phpstan/phpstan-phpunit](https://github.com/phpstan/phpstan-phpunit) from 0.12.18 to 0.12.19.
- [Release notes](https://github.com/phpstan/phpstan-phpunit/releases)
- [Commits](https://github.com/phpstan/phpstan-phpunit/compare/0.12.18...0.12.19)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-13 15:17:18 +01:00
2f2be84b12 Bump phpstan/phpstan from 0.12.86 to 0.12.87 (#4217)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.86 to 0.12.87.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.86...0.12.87)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-13 12:25:25 +01:00
bdce781c6d Chunk: do not close preexisting tiles in addTile()
if it's desired to actually replace a tile, the old tile should be explicitly removed and closed first.
2021-05-12 12:32:36 +01:00
b2e806e2fa World: Harden chunk loading against bad data in entity/tile NBT 2021-05-12 12:26:41 +01:00
80e4da85df Fixed PHPStan build 2021-05-12 12:12:29 +01:00
42e915b902 Player: added locking variable to prevent reentry into respawn() while awaiting spawn terrain generation 2021-05-12 12:10:32 +01:00
34ee1c2354 pocketmine.yml: update preset example for worlds
preset is now supported as its own key, and it's less confusing to present it separately, since that's how it's displayed in the server.properties also.
2021-05-12 12:00:52 +01:00
4a68e0219e shut 2021-05-11 19:29:30 +01:00
4c4db1836f Merge remote-tracking branch 'origin/stable' 2021-05-11 19:28:09 +01:00
dfdd59734c [ci skip] update changelog 2021-05-11 19:26:01 +01:00
ab0500ae4f Player: Fixed a multitude of bugs with respawning
the following things are changed:
- Player->getSpawn() no longer returns a safe spawn by default. Instead, if the player doesn't have a spawn set, it returns the world's stored spawn directly. This allows consistent behaviour of locating safe respawn positions without double calculation of safe spawn position, and also fixes crash issues during the login sequence if the player's spawn position referred to ungenerated terrain.
- Player->respawn() is now asynchronous, using the promise returned by orderChunkPopulation() to complete respawn after the terrain is generated. This allows consistently selecting a safe respawn position and fixes crashes when respawning if the spawn location was in ungenerated terrain.

There remains a problem that ragequit respawns are still only handled right after PlayerJoinEvent, which leads to the original spawn terrain being sent to the player, which is obviously very wasteful. However, that's a problem for a later commit.
2021-05-11 19:15:31 +01:00
094c949e86 Entity: fixed extremely stupid bug with player respawning after ragequit 2021-05-11 19:08:56 +01:00
5a7736b179 actions: go with PHP 7.4.19 2021-05-10 20:30:08 +01:00
e648f1c91e Remove unnecessary script copy 2021-05-10 17:55:52 +01:00
5116e11cea Only install the stuff we need to run PHP, not to build it 2021-05-10 17:55:52 +01:00
0ff21557e4 World: fixed generation requests being rejected during resolution
when a chunk population is ordered, its only chunk loader is the one that the World installed to keep the chunk loaded while it was generated. So, when the resolver removes its chunk loader from the chunk, it triggers the chunk unloading mechanism, which causes the promise to directly be rejected.
2021-05-10 17:20:04 +01:00
9c05e37fbe Bump phpstan/phpstan from 0.12.85 to 0.12.86 (#4212)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.85 to 0.12.86.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.85...0.12.86)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-10 16:53:43 +01:00
f909557529 Cleaned up implementations for EnderChestInventory/DoubleChestInventory
previously, these were forced to extend BaseInventory because of the amount of crap in Inventory's interface.
This meant that these inventories had their own slots storage, which would be _mostly_ unused because these inventories aren't real inventories, but rather just delegates.
This lead to a variety of bugs in the past, such as certain API methods on BaseInventory not working correctly for DoubleChestInventory in particular.

Now, BaseInventory just implements the functional part of the inventory implementation, leaving the storage system up to the implementation.
A SimpleInventory class is provided with a simple SplFixedArray storage backing, which is used by most inventories.
EnderChestInventory and DoubleChestInventory now extend BaseInventory directly, and implement custom methods for dealing with their delegates.
2021-05-09 20:51:16 +01:00
1533789f35 Player: fixed not subscribing to own inventory updates
fixes #4211
2021-05-09 19:36:36 +01:00
922164ff2c Updated composer dependencies 2021-05-08 21:15:13 +01:00
20197e6813 RakLibServer: clean up constructor parameters 2021-05-08 20:13:29 +01:00
1003fde2fc RakLibServer: make all parameters mandatory 2021-05-08 20:11:16 +01:00
2ce6a87d05 getSafeSpawn() may throw if the target terrain is not generated 2021-05-08 16:22:13 +01:00
e9f3cefe94 Default world might be null 2021-05-08 16:21:34 +01:00
027109075c WorldManager: don't recalculate the spawn point for every player teleported during world unload 2021-05-08 16:19:22 +01:00
624495f4d3 Added a generic Promise type
I anticipate increasing demand for promises, and since all the libraries I could find suck, we'll stick to our own impl for now.
2021-05-08 15:57:30 +01:00
33eb97da97 Remove dead PHPStan pattern 2021-05-08 15:53:55 +01:00
6384b6602c phpstorm you piece of shit 2021-05-07 23:55:49 +01:00
998a583815 World: Fixed inverted completion callbacks for chunk population
this would have caused any chunk populated by a plugin to remain loaded forever.
2021-05-07 23:39:44 +01:00
f9bfc0df73 NetworkSession: don't crash on teleporting to other world during PlayerLoginEvent 2021-05-07 22:47:06 +01:00
5324474194 Merge remote-tracking branch 'origin/stable' 2021-05-07 20:47:35 +01:00
fb4796f35e Added PhpStorm code style and file templates 2021-05-07 20:44:46 +01:00
6cb285d4a9 Added constants for the handler tag types 2021-05-06 18:40:14 +01:00
742f86e022 Rename DestroyBlockParticle -> BlockBreakParticle
closes #3461

literally every other particle/sound has the subject first, followed by the (optional) verb, and finally Particle (or Sound).
In addition, we refer to breaking blocks as 'break' everywhere except here, where we refer to it as 'destroy'.
2021-05-06 18:33:18 +01:00
7d1c4efdfb Updated composer dependencies 2021-05-06 18:17:05 +01:00
7b2c6c5ceb Avoid more $this refs on long-life closures 2021-05-06 14:27:56 +01:00
c356abb917 BlockTransaction: remove cyclic reference to self in callbacks 2021-05-06 14:27:08 +01:00
01794adef1 ... 2021-05-05 22:24:23 +01:00
5e5277acb5 Merge branch 'stable' 2021-05-05 22:22:32 +01:00
0c2ba66078 Updated build/php submodule to pmmp/php-build-scripts@07129c61d6 2021-05-05 22:15:48 +01:00
17bbb9330f Updated RakLib, require pocketmine/raklib-ipc 2021-05-05 21:31:48 +01:00
cc73571307 Updated composer dependencies 2021-05-05 19:43:39 +01:00
73420819f6 Clean PHPStan baselines 2021-05-05 14:51:39 +01:00
652de2632a Rough OffHand implementation
this doesn't do stuff like taking arrows from offhand yet.
2021-05-05 14:46:51 +01:00
e8cb49f7ae php-cs-fixer fixing php-cs-fixer's own mess 2021-05-05 11:25:11 +01:00
4ca5558ec1 Merge remote-tracking branch 'origin/stable' 2021-05-05 11:14:01 +01:00
267b49247e Updated composer deps (except pocketmine/nbt) 2021-05-04 22:27:34 +01:00
c29cd8e2eb actions: added PHP script to update versions 2021-05-04 22:21:45 +01:00
a13b0c98a1 Updated to PHP-CS-Fixer 3.0.0 2021-05-04 22:18:18 +01:00
e6ff908e18 actions: update PHP versions 2021-05-04 21:52:17 +01:00
176ca3fd2f shut 2021-05-02 14:56:56 +01:00
b8645f5c15 Clean up EnderChestInventory implementation
now, EnderChestInventory is just a temporary window, much like anvil/enchanting windows. It provides a gateway to the player's PlayerEnderInventory.

This removes one of the remaining obstacles to disallowing null World in Position constructor.
2021-05-02 14:26:27 +01:00
129ca7fee0 Silence a PHPStan bug
I'm not able to reproduce this one on the playground, but it still shows up even when disabling certain phpdocs...
2021-05-02 13:55:32 +01:00
4c783f1037 shut 2021-05-02 13:43:37 +01:00
988c976459 Remove unused import 2021-05-02 13:40:18 +01:00
9b8f32c584 Extract inventory helper methods from BaseInventory to a trait
this allows easier alternate implementations of Inventory that don't extend BaseInventory (e.g. double chest, or delegate inventory).
2021-05-02 13:38:49 +01:00
c47ecb55c0 Sign: Do not allow edits by any player except the one who placed it, and only while that player is online
signs now become finalized if:
- the player quits and rejoins (because the entity runtime ID of the player will not be the same)
- the chunk is unloaded and reloaded (because the tagged entity runtime ID is not saved).

closes #4198
2021-05-02 13:22:31 +01:00
c19d2fe891 Bump phpstan/phpstan from 0.12.84 to 0.12.85 (#4199)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.84 to 0.12.85.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.84...0.12.85)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-05-01 23:24:49 +01:00
f195f24f4f Upgrade to GitHub-native Dependabot (#4201) 2021-05-01 23:24:35 +01:00
f538440bce De-spaghettify the hierarchy for chest inventories 2021-04-30 13:44:39 +01:00
d37016f43b Vine: added API to get/set faces 2021-04-30 13:35:38 +01:00
726978b8f1 Migrate all coloured blocks (except glazed terracotta) to dynamic colours 2021-04-29 20:11:03 +01:00
593a8ac529 Added Loom blocks
these don't support doing patterns yet, but their inventories work.
2021-04-29 19:51:09 +01:00
4b5f279a3e UseItemOnEntityTransactionData: added missing type 2021-04-29 19:13:52 +01:00
b33bf1f433 Unfuck banners ... 2021-04-28 18:44:21 +01:00
d5e5a81cff Don't explode when data contains invalid dye colour IDs 2021-04-28 13:39:03 +01:00
a44203a3d4 Separate BannerPatternLayer from BannerPatternType 2021-04-28 12:47:42 +01:00
2bc0f9f7a2 TimingsCommand: do not enable timings if they are already enabled
this causes timings to be reset, which is potentially undesirable (loss of already-collected timing data).
closes #4194
2021-04-27 22:39:13 +01:00
8a3df1212a Added a trait for blocks which face opposite their placing player 2021-04-27 21:28:26 +01:00
72045b3d7e CoralBlock: added setCoralType() 2021-04-27 21:03:23 +01:00
2eb05a2420 Updated block factory consistency check 2021-04-27 21:00:22 +01:00
f204d6b3dd Make a trait for blocks which share the same horizontal facing metadata logic 2021-04-27 20:59:20 +01:00
11263909ab Added stripped logs (incomplete)
this isn't practical to fully implement right now due to limitations
imposed by the legacy shitfest system we're using. To make stripped
dynamic, we would need to switch the IDs _and_ variant info dynamically,
and I have no idea what bizarre side effects that might have.
2021-04-27 20:35:58 +01:00
ed80490234 Added more APIs to Skull
setRotation() is conditionally useless, but there's not much we can do about this right now; and exposing it like this is better than having plugins interacting with tiles.
2021-04-27 19:31:08 +01:00
c9cf33b21b Skull: added block property APIs
I need these for my R13 block deserializer.
2021-04-27 19:22:45 +01:00
0aa0d77307 Skull: recognize noDrops flag 2021-04-27 19:21:29 +01:00
017ca55a58 Vine: use facing as both keys and values 2021-04-27 15:19:55 +01:00
845819123d Player: drop perm nulling
this is no longer necessary because the PermissibleBase doesn't keep a ref to the Player anymore.
2021-04-27 14:49:26 +01:00
8364bc51ac ... 2021-04-27 14:47:11 +01:00
7ce77713dd InventoryManager: add a mechanism to allow plugins to inject their own container open packet creators
closes #4008
2021-04-27 14:40:43 +01:00
f37c414298 Merge remote-tracking branch 'origin/stable' 2021-04-27 14:25:54 +01:00
89260d788c 3.19.2 is next 2021-04-25 20:34:13 +01:00
a7cd081002 Release 3.19.1 2021-04-25 20:34:13 +01:00
361be8fe36 Normal: drop MOUNTAINS and SMALL_MOUNTAINS from biome selection
this would cause disruption to generation on a patch release, which is unacceptable.
This would be better for 3.20 or 4.0.
2021-04-25 20:27:19 +01:00
127b57048c Allow plugins to use PSR-4 namespace mapping (#4188)
* Allow plugins to use PSR-4 namespace mapping
this is a reduced implementation which serves the 99% use case without being horribly breakable.

Plugins may now specify a `src-namespace-prefix`, which should be set to the namespace of the classes in `src`.
If the old system is used, `src-namespace-prefix` can be omitted, or set to an empty string.

Examples:
- If `src-namespace-prefix` is `dktapps\test`, `dktapps\test\Main` will be searched for in `src/Main.php`, instead of `src/dktapps/test/Main.php`.

* Migrate TesterPlugin to PSR-4
2021-04-23 19:34:46 +01:00
b01e4ab417 Bump phpstan/phpstan from 0.12.83 to 0.12.84 (#4189) 2021-04-21 18:49:08 +00:00
fc01735b6f Fixed infinite loop when placing two coral plants next to each other
the dead flag is not persisted in their metadata, so they forget their state when next read from the world.
2021-04-19 23:01:57 +01:00
4e0bc6c98e Scrub PHPStan baselines 2021-04-19 16:18:22 +01:00
73f913e279 Modernize TesterPlugin 2021-04-19 14:16:05 +01:00
dc51af8b66 changelog: mention CancelTaskException addition
[ci skip]
2021-04-19 14:00:54 +01:00
94928c030a Removed CancellableClosureTask 2021-04-19 14:00:23 +01:00
9c1b4fd1cd Added CancelTaskException (#4186) 2021-04-19 13:41:51 +01:00
5872b2fe23 Merge remote-tracking branch 'origin/stable' 2021-04-19 13:32:15 +01:00
177b963d8e TaskScheduler: do not push cancelled repeating tasks back onto the queue 2021-04-19 13:23:31 +01:00
66fdf526d4 Remove GarbageServerboundPacket
it's not the protocol implementation's job to decide what's garbage. It should only indicate that a packet MAY be sent by the client. It should then be up to the handler to decide what to do with it.
2021-04-19 01:07:21 +01:00
6845cbb2b3 Silence LevelSoundEventPacket noise 2021-04-19 01:02:22 +01:00
4f4069d403 World: remove another noisy debug message 2021-04-19 00:55:42 +01:00
09a2402f01 Fixed precondition on double chunk send being useless
this is messy, but necessary for now.
2021-04-19 00:50:43 +01:00
d19c21e2e1 Updated PHPStan baseline 2021-04-19 00:38:27 +01:00
6d38922af0 Undo my -100IQ fuckup with chunk sending precondition
the commit I reverted put the preconditions in the completion handler,
which is executed AFTER THE CHUNK IS SENT.

Revert "NetworkSession: allow Player to handle its own business in chunk sending"

This reverts commit a223d1cbf3.
2021-04-19 00:36:13 +01:00
35a3522b4e Player: fixed chunks getting spammed like crazy during generation
because of the shitty way that the chunk resending is handled, it causes all kinds of problems with the async system because of potential reversions of the state during the process.
2021-04-19 00:30:34 +01:00
0251359179 ChunkCache: remove outdated TODO comment
we don't set the entire chunk during lighting updates anymore, so updating light doesn't trigger onChunkChanged().
2021-04-19 00:20:03 +01:00
b4afa46fad Player: don't re-request chunks unless they've already been sent
if they've been requested, the ChunkCache will take care of rebuilding the chunk packet before sending it.
2021-04-18 23:53:34 +01:00
8d1a1628de Item: Remove "ench" tag when all enchantments are removed from an item (#4184)
fixes #4144
2021-04-18 20:56:07 +01:00
129c638e29 Remove unused import 2021-04-18 20:33:49 +01:00
caf3ec1b54 World: improve documentation of World::getPotentialBlockSkyLightAt() 2021-04-18 20:31:42 +01:00
53ebe4f9f9 World: added getHighestAdjacentFullLightAt() 2021-04-18 20:20:08 +01:00
51b0685881 World: document getFullLight() and getFullLightAt() 2021-04-18 20:14:16 +01:00
f29ababf8d World: Rearrange some light-related methods
these things are all over the place ...
2021-04-18 20:07:36 +01:00
5dfa6a2296 Fix dragon egg teleporting in creative (#4180)
closes #4179
2021-04-17 19:11:10 +01:00
a32eb4ebc3 Implemented coral and coral fans
this implementation is very rough due to having to hack around lots more MCPE bullshit, and currently doesn't allow dynamic coral types; but it's there. We'll clean this up after 1.13 migration is done.
2021-04-17 02:04:10 +01:00
d5e1b4bd39 Furnace: Separate light/extinguish code into onStartSmelting() and onStopSmelting() hooks
this is a preparation for other kinds of furnaces which might not be plain old Furnaces.
2021-04-17 01:36:16 +01:00
9abdcd8ee5 shut 2021-04-16 21:45:22 +01:00
01c3668375 ItemFactory: Check the bounds of durability, instead of trying to catch exceptions 2021-04-16 21:30:48 +01:00
da51f106de ItemFactory/BlockFactory: give more specific class descriptions
these classes both have a very specific purpose now, which is much lesser than it was in PM3.
2021-04-16 21:27:28 +01:00
c979ab8aa0 Be more specific with documentation of ItemFactory::register() and BlockFactory::register() 2021-04-16 21:24:16 +01:00
6071746993 Mark ItemFactory::get() and BlockFactory::get() as @deprecated 2021-04-16 21:16:27 +01:00
81ced66bd0 BlockIdentifier: variant parameter of constructor is now mandatory 2021-04-16 20:14:29 +01:00
8d2ee516f0 Merge branch 'stable' 2021-04-16 18:26:33 +01:00
6f80b8979d Particle: added some missing IDs 2021-04-16 18:20:47 +01:00
b31b097b8e LightPopulationTask no longer hard-depends on Server 2021-04-16 15:41:14 +01:00
3c8eb29d4e Limit blockitem metadata hack to just blockitems
for some reason putting NBT on some items makes the creative inventory go haywire. Sadly, we currently need this hack, so I limit it to only stuff which actually needs it (blockitems).
closes #4159
2021-04-16 00:41:19 +01:00
b94bbf6f5e Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2021-04-16 00:11:01 +01:00
314a8a1297 protocol: updated particle type constants
closes #4173
2021-04-16 00:10:48 +01:00
ebd19f5a70 SubChunkExplorer: Protect world field 2021-04-15 23:32:30 +01:00
bf67170504 SubChunk: don't assume 15 sky light when not allocated
closes #2533
at long last...
2021-04-15 23:22:53 +01:00
5d83f4670a RegionLoader: Switch to using named constructors
this makes the code more self-descriptive, and also helps to detect potential bugs.
2021-04-15 21:57:23 +01:00
e8dd4de5c8 SubChunk: Lazily allocate LightArrays as needed
this is slightly slower, but saves a significant amount of memory (~80 KB per chunk).
Since ext-chunkutils2 doesn't do copy-on-write trickery like the PHP impl did, we need this to get the memory advantages back.
2021-04-15 21:43:46 +01:00
e6ecacbb2b World: do not access chunks for light if they aren't yet light-populated 2021-04-15 21:21:34 +01:00
ab9615fb9c World: fixed documentation for getHighestAdjacentPotentialBlockSkyLight()
[ci skip]
2021-04-15 21:19:58 +01:00
0f14c589f7 [ci skip] changelog: added a table of contents
generated using https://ecotrust-canada.github.io/markdown-toc/
2021-04-15 20:48:54 +01:00
9655cb819d World: Remove duplicated code 2021-04-15 19:41:03 +01:00
99ed87bc29 NetworkSession: changed misleading debug message in beginSpawnSequence() 2021-04-15 19:27:51 +01:00
ec32848a97 [ci skip] changelog: world spawn generation progress is now logged 2021-04-15 19:27:17 +01:00
a0c3102b05 FormatConverter: add @phpstan-param for newProvider ctor parameter 2021-04-15 19:14:52 +01:00
8e3f5737a0 RegionWorldProvider: fix CS 2021-04-15 15:39:08 +01:00
32c4a165cf Removed RegionLoader::open()
this is nothing but a source of bugs.
2021-04-15 15:38:18 +01:00
edb590f681 missed one ... 2021-04-15 15:23:15 +01:00
08f0c9a244 Separate writable parts of RegionWorldProvider into WritableRegionWorldProvider 2021-04-15 15:20:57 +01:00
e6fb6b1f27 BaseLevelProvider: Remove obsolete proxy methods 2021-04-15 15:15:16 +01:00
be190fc41b gitignore: add backups 2021-04-15 15:01:01 +01:00
dc5b1efa66 Merge remote-tracking branch 'origin/stable' 2021-04-15 14:04:27 +01:00
8af6b112d2 WorldManager: log after first chunk's generation has been completed
this is as close as we can get to the actual start of generation.
2021-04-15 14:01:28 +01:00
506a235d7a [ci skip] changelog: remove mention of ext-ds 2021-04-15 14:00:45 +01:00
3e1ff2a63b [ci skip] mention WorldCreationOptions changes in changelog 2021-04-15 13:57:20 +01:00
7b21fc8e9d WorldCreationOptions are now mandatory during creation of worlds 2021-04-15 13:54:58 +01:00
203cc7fcef World: Removed noisy debug message 2021-04-13 22:32:00 +01:00
ecf6de3430 WorldManager: Pre-generate a radius of 8 chunks
3 is absurdly small. 8 is a more realistic estimation of what the average player's render distance will be (it's also the default server.properties limit).
3 doesn't even fill the default spawn-radius setting, meaning that delays during player connection would occur anyway due to generation.
2021-04-13 22:15:47 +01:00
0f3147f49b WorldManager: Log progress of spawn terrain generation 2021-04-13 21:28:17 +01:00
c90ca37ea3 Fix CS 2021-04-13 21:10:18 +01:00
ab176264b4 ... 2021-04-13 21:06:37 +01:00
9c1b274499 WorldManager::createWorld() now accepts WorldCreationOptions instead of mixed[] 2021-04-13 21:03:25 +01:00
6ce15854af Clean up generator preset handling 2021-04-13 20:19:53 +01:00
547503e8f4 Normal: Fixed bug that never lets mountainous terrain generate (#4170) 2021-04-13 17:56:57 +01:00
bfa1b4384b Updated composer dependencies 2021-04-13 15:48:14 +01:00
c42a00641f [ci skip] changelog: mention more Permission API changes 2021-04-12 16:25:50 +01:00
666670bc6f PermissionAttachment may now reference zero or more permissibles
this makes PermissionAttachment more and more like Permission, except that it doesn't have a name.
Right now, the only value of this API change is that it allows breaking references to dead Permissibles, but in the future it should be possible to reuse a single PermissionAttachment on multiple Permissibles.
2021-04-12 15:57:24 +01:00
4b715aaba7 Document API changes related to broadcast channels
closes #2960
2021-04-11 20:59:09 +01:00
e720c001a9 ConsoleCommandSender: ensure that PermissibleBase doesn't leak
if recalculatePermissions() was called, the PermissionManager will reference it, preventing it from being GC'd.
2021-04-11 17:21:29 +01:00
66622defae PacketSerializer: fix merge error 2021-04-11 16:49:57 +01:00
74d103a56f Merge remote-tracking branch 'origin/stable' 2021-04-11 16:36:39 +01:00
f74ff1fcd4 Bump adhocore/json-comment from 1.1.0 to 1.1.2 (#4158)
Bumps [adhocore/json-comment](https://github.com/adhocore/php-json-comment) from 1.1.0 to 1.1.2.
- [Release notes](https://github.com/adhocore/php-json-comment/releases)
- [Changelog](https://github.com/adhocore/php-json-comment/blob/main/CHANGELOG.md)
- [Commits](https://github.com/adhocore/php-json-comment/compare/1.1.0...1.1.2)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-04-11 16:03:41 +01:00
6c351357ab NetworkBinaryStream: bail if finding unexpected trailing data on item extradata
this may help to discover additional bugs and/or missing data on items that we don't know about yet.
2021-04-11 16:02:41 +01:00
0312b62c8a DataPacket no longer keeps its own serializer
since a while ago, we're anyway just discarding the internal buffer anyway when the packet is repeatedly encoded, so this doesn't serve any advantage anymore.
We do need a system to be able to reuse encoded packet buffers, but right now we're not reusing them anyway.
2021-04-09 15:37:58 +01:00
19f536d68a ... 2021-04-07 21:54:21 +01:00
1e6d97a157 Merge branch 'stable' 2021-04-07 21:25:39 +01:00
540dadbda0 Merge commit 'e22b6ff5667534c6cdeef55913e46f973772663f' 2021-04-07 20:25:24 +01:00
7aa336f5e4 Remove dead baseline 2021-04-07 19:44:00 +01:00
7578bca006 Merge tag '3.18.2' 2021-04-07 19:41:57 +01:00
3433406cff 3.19.1 is next 2021-04-07 19:03:36 +01:00
b307cd0aa1 Release 3.19.0 2021-04-07 19:03:36 +01:00
c9b83d7276 Protocol changes for 1.16.220 2021-04-07 18:59:01 +01:00
e22b6ff566 Revert "Revert "Backport InventoryTransactionPacket impl from PM4""
This reverts commit c7cdaeae85.
2021-04-07 18:42:07 +01:00
af88f49a21 3.18.3 is next 2021-04-07 18:32:14 +01:00
599d5253db Release 3.18.2 2021-04-07 18:32:10 +01:00
54cb5ee0fa ItemTranslator: ensure that the correct meta value is returned after translation
-1 is a PM-specific thing. Right now there is a hack in the NetworkBinaryStream which prevents this from becoming a problem, but that might not be the case in future.
2021-04-07 13:10:29 +01:00
cdae8b42eb Bump adhocore/json-comment to ^1.1.0, new version strips trailing comma as well (#4146) 2021-04-06 11:58:23 +01:00
Ali
a45a4a91ae Call InventoryCloseEvent in Player::removeWindow() (#4142)
closes #4130
2021-04-04 01:07:58 +01:00
21378b7f27 Regenerate PHPStan baselines
this should be the last time we get baselines randomly rearranging themselves on changes ...
2021-04-03 22:36:15 +01:00
502aed41b0 phpstan 0.12.83 2021-04-03 22:34:48 +01:00
1898d4b42c Fixed corner case with player spawning in ungenerated terrain
we can't get the safe spawn location of a set of coordinates if the coordinates are in an ungenerated chunk. This can happen if doing /setworldspawn <somewhere ungenerated> and then having a new player join the server.
2021-04-03 22:20:19 +01:00
125837324f Player: don't dump cursor contents on mouseover interaction
this can fire while the player has the inventory window open, because it also gets sent when the player swaps their held itemstack for something new.

We already had a special-case for mouseover with entity ID 0, but since
this isn't just a zero problem, a more general fix suits better
(particularly since we might need to handle the 0 case anyway).

closes #4140
closes #4141
2021-04-02 21:35:38 +01:00
Ali
609dff1aae Player: Revert invalid attempts to toggle flight, instead of kicking (#4139)
If allowFlight was toggled by the server (e.g. due to gamemode change), a race could occur due to network latency where the client could try to enable flight, and then get kicked for cheating.

Since this can happen in legitimate, non-cheating cases, we can't make any assumptions about whether a player is cheating, so instead we just revert it, like we do with every other bad input.
2021-04-01 17:57:26 +01:00
4eaa600f35 actions: clone submodules in PHPUnit job 2021-03-31 21:54:27 +01:00
cd71fec53d fucking phpstorm 2020.3 and its broken autocomplete 2021-03-31 21:41:50 +01:00
5e8078f3dd PacketSerializer: Improved performance of item serialize/deserialize 2021-03-31 21:39:55 +01:00
b7a6c9dc17 Renamed BadPacketException -> PacketHandlingException
this better describes the intent, instead of just vaguely describing a packet as 'bad'.
2021-03-30 01:15:28 +01:00
b03212053c 3.18.2 is next 2021-03-28 21:24:07 +01:00
fd4ac885bb Release 3.18.1 2021-03-28 21:24:03 +01:00
f35886f18a Updated composer dependencies 2021-03-28 21:14:02 +01:00
25998720ce Fixed server crash on invalid gamemode in SetPlayerGameTypePacket
this really ought to be detected at the decode layer, but right now that's a bit difficult ...
2021-03-28 21:11:07 +01:00
7fe6815f7c Merge branch 'stable' 2021-03-28 20:39:59 +01:00
a9eaa55427 actions: added a php-cs-fixer run 2021-03-28 20:38:56 +01:00
b032d49722 Merge branch 'stable' 2021-03-28 19:41:23 +01:00
5c41f79be4 Added php-cs-fixer configuration
this is by no means a complete code style guide, but it fixes a lot of common issues that show up, particularly in PRs.
2021-03-28 19:21:41 +01:00
34c2b62ffe Remove unused import 2021-03-28 19:12:18 +01:00
e42a691da9 Strip trailing whitespace 2021-03-28 19:02:51 +01:00
Ali
3b3fb5e662 fix ItemFrames (#4101)
removing items from item frames was broken due to behavioural changes in 1.16.210.
2021-03-28 18:53:46 +01:00
01ffe8bf57 Updated build/php submodule to pmmp/php-build-scripts@c64baa0f1c 2021-03-28 18:14:40 +01:00
7139eccfbe Merge branch 'stable' 2021-03-28 18:11:53 +01:00
4abf4aecad MainLogger: fixed potential deadlock during syncFlushBuffer()
the notify() to flush the buffer might arrive in between the writeLogStream() and synchronized() calls in the thread body, resulting in a deadlock if the logger thread managed to call wait() before the main thread did.
2021-03-28 18:10:23 +01:00
d5549b72de ... 2021-03-27 00:08:23 +00:00
9137666952 Fixed build 2021-03-26 22:57:21 +00:00
06f20234f7 Scrub unused imports 2021-03-26 22:56:09 +00:00
adbc58f326 TickingChunkLoader: use native return types 2021-03-26 22:55:48 +00:00
cdeedbad8b Player: extract some entity spawning logic into a separate function 2021-03-26 22:51:56 +00:00
de49a361c0 NetworkSession: Remove parameters from startUsingChunk() callback
these can easily be use()d into the closure (which also has slightly better performance, because no type checks - not that anyone will notice).
2021-03-26 22:45:36 +00:00
49cf009017 Remove unused variable 2021-03-26 22:43:21 +00:00
a223d1cbf3 NetworkSession: allow Player to handle its own business in chunk sending
these checks should appear consistently in all of these async callbacks.
2021-03-26 22:00:42 +00:00
f047ecfd2d Fixed player spawning in ungenerated terrain (#4087)
fixes #4044
fixes #2724

this is significantly more complex than I hoped for, but it's a start... and it works.
2021-03-26 21:36:27 +00:00
64886707b2 SubChunkExplorer: avoid repeated shift-right instructions 2021-03-25 23:36:10 +00:00
5e9ce92b55 Explosion: don't depend on air having stateID 0 2021-03-25 23:17:33 +00:00
52ce8ad8ae Plugin: removed useless shit
Plugin is the interface by which the server core interacts with plugins, so it should be limited only to the stuff that the server actually uses.
These methods are still provided by PluginBase, so in 99.9% of cases there will be no BC break.
2021-03-25 19:17:16 +00:00
d9b548bfde Fixed unintentional formatting change introduced by ae75d73f48 2021-03-25 01:37:26 +00:00
9c10599c30 Updated PreProcessor to pmmp/PreProcessor@6e223fa9a0 2021-03-25 01:33:05 +00:00
61bca7cfbc master supports 7.4 only 2021-03-25 01:31:25 +00:00
95eb70a924 Merge branch 'stable' 2021-03-25 01:30:52 +00:00
b29f83ee99 Added preprocessor test build job to Actions
this should catch problems like the one that broke 3.17.6 at the root.
2021-03-25 01:25:04 +00:00
4bc57f00b8 Updated LevelSoundEventPacket constants 2021-03-23 23:36:48 +00:00
0d775f8731 Require ext-chunkutils2 at ^0.2.0 2021-03-23 22:23:17 +00:00
aa8c13ec45 Remove dynamic LightArray constants
sad, no constexpr functions :(
2021-03-23 20:23:56 +00:00
17dd574814 Fixed composer lockfile 2021-03-23 20:00:37 +00:00
f2a320bb5c Merge branch 'stable' 2021-03-23 19:57:54 +00:00
ff61e1e018 ClientCacheBlobStatusPacket: fixed field order
miss comes first, not hit.
2021-03-23 19:52:25 +00:00
9ee80357b0 phpstan baselines cleanup 2021-03-23 15:24:20 +00:00
ad048f0b7f Merge remote-tracking branch 'origin/stable' 2021-03-23 15:17:10 +00:00
51449265ee Updated composer dependencies
this should also bring the phar back down to a sensible size ...
2021-03-23 15:04:51 +00:00
fb20bb3832 Don't handle NAN/INF in movements 2021-03-23 14:54:39 +00:00
3333df31df Bump phpunit/phpunit from 9.5.3 to 9.5.4 (#4104)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.3 to 9.5.4.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.3...9.5.4)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-03-23 13:53:45 +00:00
8dd900a2c6 Sugarcane: allow placement on podzol (#4094) 2021-03-23 00:00:13 +00:00
eb9b644447 PressurePlate: remove collision boxes, closes #4045 2021-03-22 21:54:27 +00:00
c09fcb2df2 Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2021-03-22 21:22:56 +00:00
c7cdaeae85 Revert "Backport InventoryTransactionPacket impl from PM4"
This reverts commit cb06be615a.

we can't push this to stable because it would break plugins without any
way to know (no protocol or API change).

At most, this should have been wrapped into a protocol change.
2021-03-22 21:21:11 +00:00
49438d360d RegistryUtils: generate ordered doc comments
this makes things easier to find, especially in the large ones like VanillaBlocks.
2021-03-22 16:16:28 +00:00
90161f24e3 Added script to update registry/enum docblocks 2021-03-22 16:00:09 +00:00
4416cd5a28 Bump phpstan/phpstan from 0.12.81 to 0.12.82 (#4088)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.81 to 0.12.82.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.81...0.12.82)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-03-22 13:26:07 +00:00
cb93095857 [ci skip] readme: added link to devdoc.pmmp.io 2021-03-21 16:59:58 +00:00
c8f396ecbc [ci skip] doxygen: link to devdoc.pmmp.io instead of the github repo 2021-03-21 16:56:23 +00:00
cb06be615a Backport InventoryTransactionPacket impl from PM4
this version is far better, and we're going to need it to deal with the PlayerAuthInputPacket bullshit.
2021-03-19 22:16:30 +00:00
0d3c11699c Clean up PHPStan baselines 2021-03-19 22:14:07 +00:00
3667e95ff6 Added PlayerAuthInputFlags 2021-03-19 21:41:22 +00:00
a515b5e1b8 World: remove dead constant Y_MASK 2021-03-19 21:13:56 +00:00
5dd0b3ac35 OOOPS
it's a bit too early for this
2021-03-19 21:12:46 +00:00
0e2dc51ec8 added some missing things to the protocol 2021-03-19 21:09:53 +00:00
eaf85b028a fix prebuilt binaries link (#4090) 2021-03-19 20:42:21 +00:00
69cb0ba1bb Entity: don't flag as closed until just before cycle destruction
this allows stuff that requires a non-cycle-destroyed state to still operate during onDispose().
2021-03-19 01:00:49 +00:00
c092a2e836 Separate TickingChunkLoader from ChunkLoader
this makes it possible to keep chunks loaded without ticking them.
2021-03-18 23:19:27 +00:00
d1387ebd0a World: assume that the primary active chunk is not NULL in generateChunkCallback() 2021-03-18 21:56:17 +00:00
34bb225566 World: rename some poorly-named fields 2021-03-18 21:33:17 +00:00
7f177328ca [ci skip] changelog: fix typo 2021-03-18 20:18:55 +00:00
eb9a68edee Further refactors to prepare for y=-64 lower limit 2021-03-18 00:08:16 +00:00
b844c4266d Added World::Y_MIN
preparation for Y axis expansion in 1.17
2021-03-17 23:19:49 +00:00
9479a1a0ab Bump phpunit/phpunit from 9.5.2 to 9.5.3 (#4084)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.2 to 9.5.3.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.2...9.5.3)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-03-17 14:08:44 +00:00
5a59afbe2c Place world conversion backups in <pwd>/backups/worlds instead of <pwd>/world_conversion_backups 2021-03-17 01:21:11 +00:00
fe3b493cdb UPnP: restore 'attempting to portforward' log message
sometimes this takes a long time (usually in the failure case).
2021-03-17 01:06:05 +00:00
b3c6c11b20 BulkCurlTask now accepts a closure callback for onCompletion
this requires much less boilerplate code than an anonymous class.
2021-03-16 23:56:14 +00:00
dcf53bd06d BulkCurlTask: fixed reference to removed function [ci skip] 2021-03-16 23:38:07 +00:00
83d1051a06 changelog: mention performance improvements in event handling 2021-03-16 23:32:23 +00:00
eba6899065 changelog: mention performance improvements caused by morton codes and libdeflate
these two things provide a significant performance improvement over PM3, so they should be noted.
2021-03-16 23:19:33 +00:00
72de45f0e9 Drop pocketmine/uuid for ramsey/uuid 2021-03-16 23:03:00 +00:00
1bb2d162ab Simplify CommandReader
while stream_select() doesn't work on pipes, if it ever starts working properly in the future, we'll need this code. In the meantime, it's harmless (it just immediately returns 1 anyway).
2021-03-16 21:42:35 +00:00
ee868bcccc update argument type constants (#4082) 2021-03-15 18:22:01 +00:00
6d622c4020 Merge branch 'stable' 2021-03-14 23:32:09 +00:00
cbc8576d4a Implement UPnP support without dotNET (#3378)
UPnP forwarding is now available on all supported platforms.
com_dotnet is no longer required for UPnP forwarding to work.

Closes #3216 .
2021-03-14 22:50:33 +00:00
edcf296086 RakLibInterface: fixed server being unjoinable if gamemode is Spectator
closes #4069
this happens because the client bans any server that has an invalid pong, which is very stupid in this case because the gamemode isn't even shown on the UI anyway ...
2021-03-14 20:35:17 +00:00
3fe0adbd7f Merge branch 'stable' 2021-03-14 20:14:08 +00:00
a7dbc2c77b Merge tag '3.17.7' 2021-03-14 19:29:32 +00:00
9e27c47116 Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2021-03-12 22:08:20 +00:00
a0368a843e 3.18.1 is next 2021-03-12 22:07:01 +00:00
3f64906263 Release 3.18.0 2021-03-12 22:07:01 +00:00
19bb8a00df Updated PHPStan baselines 2021-03-12 22:05:15 +00:00
4816a66fb8 Baseline protocol changes for 1.16.210
this is not a complete changeset, but it's sufficient to get servers back online.
There are additional changes to PlayerAuthInputPacket which need to be reversed.
2021-03-12 21:41:48 +00:00
06f4e1e4c2 Bump phpstan/phpstan from 0.12.80 to 0.12.81 (#4063) 2021-03-11 00:33:05 +00:00
30c5cad5b3 Release 3.17.7 2021-03-11 00:22:17 +00:00
5b8166c1f0 3.17.8 is next 2021-03-11 00:22:17 +00:00
a7a7fe3895 Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2021-03-11 00:15:48 +00:00
55ac2f07dc Updated PreProcessor submodule to pmmp/PreProcessor@1b9304de61 2021-03-11 00:15:33 +00:00
0660888029 Updated NBT dependency (again) 2021-03-11 00:15:00 +00:00
0476e6bcfc Updated PreProcessor submodule to pmmp/PreProcessor@934f92d388 2021-03-10 23:33:45 +00:00
72bd37e442 Updated PreProcessor submodule to pmmp/PreProcessor@652c6d8b4c 2021-03-10 23:02:47 +00:00
f95fcecb5b 3.17.7 is next 2021-03-10 20:49:10 +00:00
61391b6e23 Release 3.17.6 2021-03-10 20:48:57 +00:00
fbb6f1f81c Workaround for cursor sync in 1.13+, closes #4059 2021-03-07 21:17:52 +00:00
3dbf27e0f1 Merge branch 'stable' 2021-03-07 21:07:58 +00:00
712df04bc4 Updated NBT dependency to 0.2.17 2021-03-07 21:06:08 +00:00
c1e5dd2a4e Merge branch 'stable' 2021-03-07 20:15:11 +00:00
1563e25378 Updated composer dependencies 2021-03-07 19:57:16 +00:00
ed84252942 Player: Improved XUID verification
we check if an existing player is online with a matching XUID first; if there isn't, we don't bother loading the playerdata, since that other player couldn't have joined unless they had a match or were allowed to bypass.
2021-03-07 19:53:19 +00:00
3d90625020 Revert "Revert "Use PHP 7.4.16 for Actions""
This reverts commit 9f6b914925.
2021-03-07 16:37:33 +00:00
9f6b914925 Revert "Use PHP 7.4.16 for Actions"
This reverts commit 0e614ea8fd.

apparently php-build doesn't have 7.4.16 yet ...
2021-03-06 00:41:19 +00:00
0e614ea8fd Use PHP 7.4.16 for Actions 2021-03-06 00:32:56 +00:00
401bd09d60 Bump phpstan/phpstan from 0.12.79 to 0.12.80 (#4054) 2021-03-01 16:56:23 +00:00
649671cc69 Bump phpstan/phpstan from 0.12.78 to 0.12.79 (#4051) 2021-02-27 17:42:19 +00:00
e755e1dc23 ResourcePackClientResponsePacket: fixed non-deterministic decoding 2021-02-27 01:08:18 +00:00
e34a444dde Bump phpstan/phpstan from 0.12.77 to 0.12.78 (#4046) 2021-02-26 00:34:38 +00:00
78f9985377 Player: fixed PlayerMoveEvent->getFrom() returning unexpected results on movement reversion
fixes #4043
2021-02-26 00:30:42 +00:00
fac2bd3379 Liquid: mark getSmallestFlowDecay() as impure
this fixes two bogus PHPStan warnings.
2021-02-25 22:41:07 +00:00
b5361d5831 Falling lava may not harden
fixes #4050
this was not an issue on PM3 because the decay and falling state were both combined into the meta.
2021-02-25 22:36:53 +00:00
a49ee0d6b0 World: mark addTile() and removeTile() as @internal 2021-02-24 23:42:09 +00:00
fcfd51dfc7 CrashDump: do not put FALSE into crashdumps in case file_get_contents() failed 2021-02-23 19:39:21 +00:00
ccc76cf338 Make less noise about XBL being enabled
this has been in force for years now, it's expected by now.
2021-02-23 19:25:22 +00:00
10a73488ed Merge branch 'stable' of https://github.com/pmmp/pocketmine-mp into stable 2021-02-22 16:43:51 +00:00
9c5114084b Updated Snooze to fix race conditions 2021-02-22 16:42:54 +00:00
11630ab1aa Bump phpstan/phpstan from 0.12.76 to 0.12.77 (#4041) 2021-02-18 11:34:42 +00:00
a3068b39a2 Update composer dependencies 2021-02-16 22:31:01 +00:00
3907ae6726 Merge remote-tracking branch 'origin/stable' 2021-02-16 22:19:54 +00:00
edbc73a72c 3.17.6 is next 2021-02-16 22:13:05 +00:00
3a0c8dd594 Release 3.17.5 2021-02-16 22:13:05 +00:00
8dd61df7ac Fixed server crash on truncated varint in packet header 2021-02-16 20:38:15 +00:00
16fa26405a Remove remaining usages of LevelDB::close()
this is handled by the object destructor.

closes #4035
2021-02-15 20:10:11 +00:00
57423540f0 BUILDING.md: Document server-phar.php's compression bug (#4037)
This bug is not fixable on PM's side because the fault lies with php-src. It was fixed recently in 1bb2a4f91c.
2021-02-15 19:53:44 +00:00
8f8821c904 Bump phpstan/phpstan from 0.12.75 to 0.12.76 (#4038) 2021-02-15 11:25:36 +00:00
dff13a884f Merge branch 'stable' 2021-02-12 17:34:25 +00:00
094102fe92 fopen() might return FALSE if permission was denied to read/write the file 2021-02-12 16:16:36 +00:00
2aef83e7d7 MainLogger: fix type ambiguity 2021-02-12 15:05:24 +00:00
5c3e78e1d3 Bump phpstan/phpstan from 0.12.74 to 0.12.75 (#4033) 2021-02-12 14:58:01 +00:00
9a1cef0d4f Merge branch 'stable' 2021-02-11 22:35:33 +00:00
18666e5a60 Be compatible with newest versions of php-leveldb 2021-02-11 22:33:29 +00:00
f72163c173 Fixed build not failing when PHP build gets borked 2021-02-11 17:06:03 +00:00
fd5141745d Use a valid commit hash for pmmp/leveldb
the previous one pointed to the main repository, and not the pmmp fork. (Why am I maintaining a fork again? ...)
2021-02-11 17:01:10 +00:00
c21ec614fc Fixed PHPStan 0.12.74 error in WorldManager 2021-02-11 16:54:14 +00:00
de0766dbef actions: update PM4-specific extensions to PHP 8.0 compatible versions 2021-02-11 16:48:10 +00:00
7573a01b17 Merge branch 'stable' 2021-02-11 16:42:23 +00:00
7407e504b6 actions: bump PHP versions to 7.3.27 and 7.4.15 2021-02-11 16:35:19 +00:00
0e396dc47d actions: update PHP extension versions 2021-02-11 16:24:09 +00:00
d2204da1d5 [ci skip] center the build badges 2021-02-11 16:05:55 +00:00
2a51269305 Merge branch 'stable' of https://github.com/pmmp/pocketmine-mp into stable 2021-02-11 16:05:24 +00:00
298034549e actions: drop ext-ds from PHP build 2021-02-11 15:56:19 +00:00
672622950f ObjectSet: make add() and remove() variadic to match ds
there are still some variadic usages in the code, which, infuriatingly, phpstan does not detect (phpstan/phpstan#4528).
2021-02-11 15:54:05 +00:00
c61f66d973 Removed ext-ds dependency 2021-02-11 15:40:37 +00:00
b03ca1953a Remove usage of Ds\Deque from WritableBookBase
ext-ds is not well maintained, and also not very well written. I'm planning to drop this extension for stability's sake.
2021-02-11 14:07:49 +00:00
e061028b69 Added Hopper::setFacing() and Hopper::getFacing() (#4030) 2021-02-09 16:04:05 +00:00
928041ddf1 Bump phpstan/phpstan from 0.12.71 to 0.12.74 (#4028)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.71 to 0.12.74.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.71...0.12.74)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-02-08 21:42:08 +00:00
007f4f9350 CraftingDataPacket: Remove useless @var comment 2021-02-08 11:53:50 +00:00
e80c1a0ce9 Split Mushroom Stem away from other mushroom variants
mushroom stem (and all-sided stem) are unique blocks, which don't drop anything and which don't stack with other shroom variants when block-picked.
They also get mapped to the same block when placed, and there's no distinction between red mushroom stem and brown mushroom stem.
2021-02-07 22:02:50 +00:00
edfe9ae745 Merge branch 'stable' 2021-02-07 21:11:24 +00:00
46e9f0cec6 Player: fixed verify-xuid not kicking in by default on old configs 2021-02-07 21:10:23 +00:00
8d5cc9adc3 Merge branch 'stable' 2021-02-07 20:57:19 +00:00
c05779314d Allow offline player data to be provided from a custom source 2021-02-07 20:29:37 +00:00
7745310870 Use native property types for login JSON models
this significantly reduces the amount of PHPDoc boilerplate, because the remaining doc comments can mostly be reduced to 1 line.
2021-02-07 17:54:38 +00:00
c456f21df8 one more 2021-02-07 17:36:49 +00:00
f952a6643c Accept PHP 8.0 compatible dependency versions in composer.json
composer decided that this was a good time to reorganize composer.json for me, and... well, fuck it.
2021-02-07 17:33:33 +00:00
606d56b55d Composer: lock in PHP at ^7.3 || ^8.0, don't leave it unbounded 2021-02-07 17:31:32 +00:00
da7c97f885 Updated composer dependencies 2021-02-07 17:27:01 +00:00
bd4ce8d941 TNT: expose unstable flag 2021-02-06 23:46:51 +00:00
fd2ebd84b4 Recognize underwater TNT 2021-02-06 23:37:05 +00:00
609b21679f Added Torch::setFacing() and Torch::getFacing()
these are not implemented with AnyFacingTrait because it would break LSP to have a setFacing that doesn't accept DOWN.
2021-02-06 22:31:36 +00:00
ce855f2133 Added isPressed() and setPressed() to PressurePlate 2021-02-06 21:20:38 +00:00
7c1f0ecb8b Fixed getAxis()/setAxis() not being seen by static analysers for some blocks
when using VanillaBlocks::CHISELED_QUARTZ(), VanillaBlocks::PURPUR_PILLAR() or VanillaBlocks::QUARTZ_PILLAR(), static analysis was unable to detect getAxis() and setAxis(), because these blocks were implemented using anonymous classes.
2021-02-06 20:39:23 +00:00
9887138ac1 Get rid of anonymous classes for infested stone 2021-02-06 20:30:25 +00:00
21bafd9f07 PluginBase: add void return typehints to onLoad(), onEnable() and onDisable() 2021-02-06 20:20:36 +00:00
82bb83211f CocoaBlock: deduplicate attachment condition checking 2021-02-06 19:34:52 +00:00
9ab3c57789 RedstoneRepeater: added getDelay() and setDelay() 2021-02-06 19:03:33 +00:00
233616aa6a RedstoneLamp now uses PoweredByRedstoneTrait 2021-02-06 19:02:13 +00:00
5be03c3196 Make more use of PoweredByRedstoneTrait 2021-02-06 18:43:33 +00:00
48ef8771cd Added AnalogRedstoneSignalEmitterTrait 2021-02-06 18:33:14 +00:00
02b0036cbe DaylightSensor: refactor power -> signalStrength 2021-02-06 17:47:29 +00:00
4fc3bc53f7 Clean up hierarchy of rails
detector rail has fundamentally different functionality than activator and powered rails, so it's misleading to present the same APIs for both.
detector rail's 'powered' state is better referred to as 'activated', since it means the detector rail is actually _producing_ power, and not _receiving_ power.
2021-02-05 22:00:17 +00:00
78a62a8b27 Remember and verify player XUIDs (controlled by player.verify-xuid in pocketmine.yml) 2021-02-05 14:42:57 +00:00
6ccfe21d57 Block: improved accuracy of isFullCube() 2021-02-04 23:10:13 +00:00
c5bdd7dd64 Added a unit test to ensure valid format of MINECRAFT_VERSION_NETWORK 2021-02-04 22:36:40 +00:00
169650dc5b MainLogger: accept timezone as a constructor parameter
this makes it easier to unit-test, as well as making it independent of Timezone.
2021-02-04 21:50:06 +00:00
54d9342ed9 AsyncPool: Always collect workers, even if the task queue is empty
because of the way async tasks are processed, we might collect results from a task before it's able to be collected by collect(). Therefore, the queue might be empty, even though there are still tasks to be collected.
2021-02-04 21:43:53 +00:00
27b1951df7 MainLogger: accept main thread name as a constructor parameter 2021-02-04 20:55:50 +00:00
709b4154d7 MainLogger: Require useFormattingCodes as a constructor parameter
this avoids needing to call Terminal::init() before starting a MainLogger. Since it inits the formatting codes anyway when log messages are first recorded, it shouldn't be necessary to pre-initialize it.
2021-02-04 19:16:22 +00:00
6d64fb9af8 MainLogger: remove obsolete logFile field 2021-02-04 16:51:02 +00:00
8ee37a3033 Bump phpunit/phpunit from 9.5.1 to 9.5.2 (#4023) 2021-02-04 16:46:22 +00:00
7684dc03fa Merge remote-tracking branch 'origin/stable' 2021-02-04 16:45:34 +00:00
7e3e63f342 Fixed race condition in MainLogger shutdown
this resulted in a deadlock in https://github.com/pmmp/PocketMine-MP/runs/1831812620?check_suite_focus=true because the notify() arrived while writeLogStream() was executing.
This ensures that either:
- the notification will occur before the sleep, and therefore no sleeping will occur (this->shutdown = true before the wait)
- the notification will arrive during the sleep.
2021-02-04 16:40:10 +00:00
ae75d73f48 Extract MainLoggerThread unit from MainLogger
MainLogger is no longer a Thread, as per the recent changes to pocketmine/log-pthreads.
2021-02-04 16:28:49 +00:00
4b9639f6c9 Merge branch 'stable' 2021-02-04 15:55:39 +00:00
8ef1e54e20 MainLogger: fixing CPU waste on logger thread
this doesn't need to keep spinning every 25ms; it can just wake up when there's actually log messages to write into the buffer.
2021-02-04 15:07:40 +00:00
eaf3a86981 MainLogger: fixed UB in writeLogStream()
notify() has to be used inside a synchronized block.
2021-02-04 15:03:14 +00:00
317a48d9b0 ItemStackRequest: expose filterStrings 2021-02-03 23:40:34 +00:00
bc14660e55 Added missing ItemStackRequest protocol changes 2021-02-03 23:37:41 +00:00
4158f77110 Merge remote-tracking branch 'origin/stable' 2021-02-03 17:52:28 +00:00
b1bb9fbd1c Reinstall PHP deps on cache hit
the 20.04 actions image doesn't have libzip5 and who knows what else is missing ...
2021-02-03 17:42:11 +00:00
561fc62232 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	.github/workflows/main.yml
#	resources/vanilla
#	src/pocketmine/VersionInfo.php
#	src/world/format/io/region/RegionLoader.php
2021-02-03 17:32:47 +00:00
96181f8cf5 Version PHP build caches by image version
we can't safely use `ubuntu-latest` because the build caches will break if they were built for 18.04 and used on 20.04, or vice versa. Instead, we pin the images (and caches) to a specific version.
2021-02-03 17:24:50 +00:00
079e794339 Armor: fixed item disappearing when switching two of the same armour pieces
Player->useHeldItem() assumes that if the old item == the new item, we want to set the item back into the inventory if it's modified in-place. Therefore, we don't modify the item in-place to bypass the problem.

closes #4022
2021-02-03 17:05:16 +00:00
4771e3dc28 3.17.5 is next 2021-02-02 14:04:51 +00:00
2e9117d102 Release 3.17.4 2021-02-02 14:04:50 +00:00
06493da7d9 Imports cleanup 2021-02-02 13:58:07 +00:00
d4290837f3 fix build failure 2021-02-02 13:55:56 +00:00
3e1ac66abf Merge branch 'stable' 2021-02-02 13:46:29 +00:00
bd303b1062 RegionLoader: fixed flaky region header validation since 3.17.3 2021-02-02 13:43:52 +00:00
fe731b9018 Added failing test case for region header validation
fucking PHP... what genius thought it was a good idea to cache file stats without even an attempt at keeping the cache up to date on modifications?
2021-02-02 13:43:12 +00:00
1a24afc6d1 InventoryTransaction: Fixed indexes persisting from balance calculation in crafting input/outputs
fixes #4019
the order of the actual items may not be the same across runs, but index 0 will at least be sure to exist.
2021-02-02 00:13:58 +00:00
bef906b0f0 phpstan 0.12.71 2021-02-02 00:05:53 +00:00
37e8dd6444 Fix PHP 8 optional before required parameters deprecation warnings (#4016) 2021-01-31 12:08:47 +00:00
02ee0f23c0 Removed old support requests configuration 2021-01-27 22:53:37 +00:00
cda472333c Add workflow for dessant/support-requests
we're using the legacy github app right now.
2021-01-27 22:47:33 +00:00
02a4f0a170 Mark metadata as nullable in resource pack manifest data
if the metadata isn't provided, it won't be initialized during decoding.
2021-01-27 22:05:43 +00:00
5a1131d72d Populator: require dependencies explicitly, don't make bad assumptions about fields
this also leaks ChunkManagers on the worker threads because the generator context is long-lived.
2021-01-27 21:08:46 +00:00
47cf58be8a phpstan 0.12.70 2021-01-27 20:11:37 +00:00
bbae02264d Merge branch 'stable' 2021-01-27 20:04:13 +00:00
ccf9691927 Bump phpunit/phpunit from 9.5.0 to 9.5.1 (#4010) 2021-01-27 19:28:36 +00:00
16fa958416 phpstan: better hack for any-callable parameters
variadics are a bad fit for this because what we really need is to accept callable with any number of arguments. LSP requires that the provided number of arguments must be >= than the required number of arguments.
2021-01-27 19:25:28 +00:00
bac57c159f Player: fix bridging, towering and various other fast building bugs
clickPos is relative to the base block position, so if you keep aiming at the same spot on the block and jump, it thinks you're still spamming.
closes #2730
2021-01-27 00:11:14 +00:00
38b2d83799 MemoryManager: fixed protected properties being dumped multiple times
we don't need to scan the parent classes for anything other than private properties, because protected and public properties will appear on the main reflection as if they were declared directly as such.
2021-01-26 20:32:23 +00:00
5384e2ba9d Revert "MemoryDump: fixed duplicated properties, reduce useless noise"
This reverts commit efd67a132e.
2021-01-26 20:26:35 +00:00
c134b1cd8a [ci skip] README: add some badges 2021-01-26 17:34:05 +00:00
269a389a97 BlockTransaction: added phpstan return type info for getBlocks() 2021-01-25 18:04:42 +00:00
62deafda48 CommandReader: removed readline support
readline has been borked for a long time and it's not thread safe.
2021-01-25 17:53:25 +00:00
31b6df4376 3.17.4 is next 2021-01-25 17:15:43 +00:00
b296ae1b87 Release 3.17.3 2021-01-25 17:15:31 +00:00
f9e42b716a Scrub PHPStan baselines
these are now always generated with level 8.
2021-01-24 20:31:22 +00:00
34c1d455a7 phpstan: enable checkMissingCallableSignature 2021-01-24 20:27:53 +00:00
af8936dba5 phpstan 0.12.69 2021-01-24 20:14:42 +00:00
74902d9926 [ci skip] changelog: mention InventoryPickupItemEvent->getItemEntity() rename 2021-01-21 13:58:08 +00:00
2064b411f2 fix build 2021-01-20 22:53:51 +00:00
69a829db91 Merge remote-tracking branch 'origin/stable' 2021-01-20 22:16:44 +00:00
3fb4b30742 InventoryPickupItemEvent: rename item to itemEntity (#4007) 2021-01-20 21:09:59 +00:00
e8ffab1787 RegionLoader: avoid hitting the disk twice during chunk reads
this provides some performance improvement (although it's difficult to measure because of cache).
this does mean that we read some garbage data during chunk reads, but it's less costly than hitting the disk twice.
2021-01-20 21:05:44 +00:00
ecc1e1f698 RegionLoader: improve performance of region header validation
I was unaware that fseek actually makes a syscall which is rather costly, which became painfully obvious during large world conversions on PM4.
On average this problem appeared to be adding about 5ms to the load time for a newly loaded region, which is insanely expensive.
2021-01-20 20:04:21 +00:00
487b5dd11d Merge branch 'stable' 2021-01-16 19:44:15 +00:00
ea5931e274 Updated build/php submodule to pmmp/php-build-scripts@60194e8b14 2021-01-16 19:34:06 +00:00
988cf7f535 Fixed PHP 8.0 deprecation error 2021-01-16 19:31:07 +00:00
e156fb47e8 Disable xdebug on Actions 2021-01-15 21:09:45 +00:00
efc5f34877 wrong place ... when shared defaults :( 2021-01-15 17:53:39 +00:00
dd0d8842d5 actions: disable fail-fast 2021-01-15 17:35:27 +00:00
7bdc564ccc Update first-party dependencies to PHP 8.0 compatible versions
all deps of PM3 are ready (at least as far as PHPStan can show).
2021-01-15 16:59:51 +00:00
69fff23f1a LevelProviderManager: removed bogus @var
I'm not sure why this wasn't detected until 0.12.67...
2021-01-15 16:53:49 +00:00
ae43698e88 phpstan 0.12.67
for some reason dependabot shit itself while trying to scan for updates and thought this wasn't updatable ...
2021-01-15 16:53:49 +00:00
a9f8afa077 Banner: remove Deque usages
originally I introduced this to make it easier to implement the various APIs addPattern removePattern etc, but those were later removed in favour of simple getPatterns() and setPatterns(), allowing plugin developers to use ext-ds APIs to manipulate patterns.
However, ds poses a number of headaches because of mutability combined with by-ref semantics, which make it a pain to use these on the APIs because we can't guarantee that they won't be modified.
As much as arrays suck, they have two significant advantages over ext-ds: 1) they have copy-on-write semantics, and 2) they support PHP 8.0 without any extra work from me.
2021-01-15 00:17:56 +00:00
0987e03c03 Bump phpstan/phpstan-strict-rules from 0.12.8 to 0.12.9 (#4003) 2021-01-13 10:55:54 +00:00
4c0d3d68af Bump PHP requirement to 7.4.0 2021-01-12 21:53:41 +00:00
bbe9c01b46 Merge branch 'stable'
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/pocketmine/metadata/MetadataStore.php
#	src/pocketmine/scheduler/AsyncTask.php
#	tests/phpstan/configs/actual-problems.neon
2021-01-12 21:48:24 +00:00
97c124edf9 thanks git, this just sneaked in without any questions ................ 2021-01-12 21:43:34 +00:00
56501178b7 Updated composer dependencies 2021-01-12 21:41:25 +00:00
120b224e41 Updated composer dependencies 2021-01-12 21:34:04 +00:00
a90f8601d4 [ci skip] changelog: fixed typo 2021-01-12 21:29:23 +00:00
c70c0b55df Separate held item index change listener logic from PlayerInventory 2021-01-12 16:44:25 +00:00
da663deea1 Bump phpstan/phpstan from 0.12.65 to 0.12.66 (#4001) 2021-01-12 10:41:59 +00:00
01c867b608 Human: make held item sync on inventory content change more consistent
before this change, setContents() wouldn't trigger a held item sync, nor would setItem(heldItemIndex, someItem).
2021-01-10 20:30:39 +00:00
c4845ab6b1 Use Player->getNetworkSession() in places where it's assumed the player will be connected 2021-01-10 19:51:41 +00:00
5e73417fa9 Player::getNetworkSession() now explicitly handles disconnected state by throwing an exception
instead of just allowing return of possibly-null networkSession
2021-01-10 19:50:13 +00:00
972c911485 phpstan 0.12.65 2021-01-09 18:04:42 +00:00
0d8858f948 composer.json: sort packages automatically 2021-01-09 17:38:22 +00:00
3ef2a19527 Player: don't kick for attacking non-attackable entities
this is quite out-of-character for PM - it usually handles bad network requests by ignoring them, not by kicking the player off the server.
2021-01-08 20:58:15 +00:00
3dd01781d5 [ci skip] changelog: PlayerDisplayNameChangeEvent is new in this version 2021-01-08 20:52:21 +00:00
f4d81c0997 [ci skip] changelog: mention DedicatedQueryNetworkInterface 2021-01-08 20:51:56 +00:00
eb1c59597d [ci skip] changelog: mention newly added blocks and items 2021-01-08 20:51:23 +00:00
80198daba0 [ci skip] changelog: mention changes to Cancellable 2021-01-08 19:53:15 +00:00
f383685c9b [ci skip] update changelog 2021-01-08 19:44:28 +00:00
053a7a1a61 Entity: split getSyncedNetworkData() into two functions
to avoid opaque boolean parameters
2021-01-08 13:59:52 +00:00
e53b57732b Entity: replace separate height/width/eyeHeight fields with an EntitySizeInfo structure
this will make it easier to implement stuff like sleeping (properly), swimming and gliding without needing to duplicate all the fields.
2021-01-08 00:11:01 +00:00
574b615b4c Player: fixed attack sounds being added at the wrong position 2021-01-08 00:04:05 +00:00
a3597e195a Player: extract getSaveData() from save()
this allows plugins to request this data whenever they want it (e.g. to save offline any time they want, instead of being confined to the server autosave interval).
2021-01-07 23:37:47 +00:00
eaaed79b93 Player: remove useless check from save()
this exception is only thrown if the player is closed, which is already unexpected in the first place and will actually crash if it's not kosher. This prevents doing stuff like saving players during onDispose(), which crashes the server if a player is disconnected due to flagForDespawn().
2021-01-07 23:33:10 +00:00
7b806e74b8 Player: use own logger for movement debug 2021-01-07 22:06:55 +00:00
5392ddf0b9 Fixed TNT broadcasting ignition sound (#3996)
closes #3952
2021-01-07 21:18:18 +00:00
82c8fa696a Relocate teleport ACK checks to InGamePacketHandler 2021-01-07 20:43:31 +00:00
555eb464b6 build.sh: fix formatting 2021-01-06 20:10:14 +00:00
abd9e2dd4c ... 2021-01-06 19:41:08 +00:00
e8d319d87d attempt #2 2021-01-06 18:48:14 +00:00
aadbdb375b Merge remote-tracking branch 'origin/stable' into gh-actions-multi-php-master 2021-01-06 18:32:34 +00:00
da71540fce first shot building multi PHP versions on actions 2021-01-05 22:03:51 +00:00
d76883a5f8 Merge branch 'stable' 2020-12-29 18:00:09 +00:00
ec9b39862b bootstrap: commit suicide if composer dependencies are not in sync 2020-12-29 17:47:32 +00:00
efca8077d5 3.17.3 is next 2020-12-28 23:03:37 +00:00
5066d5225b Release 3.17.2 2020-12-28 23:03:32 +00:00
aefaf73685 Living: extract an applyConsumptionResults() method from consumeObject()
inspired by #3592, which has gone stale
2020-12-28 22:27:29 +00:00
5fa4e284bf Merge branch 'stable' 2020-12-27 19:35:27 +00:00
793081d803 Entity: assume that position has a valid World during setPosition() 2020-12-27 19:20:37 +00:00
15401d740f RegionLoader: mark area as garbage in removeChunk() 2020-12-27 19:16:05 +00:00
5920b0ba40 Remove _PHPSTAN_ANALYSIS constant
we don't need this anymore since PHPStan is able to intelligently decide whether to autoload a file or not.
2020-12-27 19:10:40 +00:00
dea75a0687 RegionLoader: do not attempt to auto-repair chunks with oversized lengths
In the old days, we used to try to correct this problem by adjusting the region header to match the
length found at the start of the chunk payload. However, this has a very good chance to cause corruption
of other chunks, since we can't do any fast overlap checks (an upsize might cause the chunk's alloocated
area to overlap into another one, causing corruption when either chunk's space gets written to).

This corruption risk has become more problematic since the
introduction of region garbage sector reuse, since a broken location
header could cause chunks to trash each others' saved data.

In addition, if there is a length mismatch, there's a good chance that the oversized chunk itself will
already be corrupted, so we'd just fail trying to decompress it later on.

So, instead of trying to fix this automatically, we bail and hope this doesn't occur often enough for
users to get upset, and allow external offline tools to attempt to repair the mess instead.
2020-12-27 18:50:52 +00:00
f215207a27 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/CrashDump.php
#	src/pocketmine/VersionInfo.php
#	src/pocketmine/network/mcpe/protocol/DataPacket.php
2020-12-23 22:34:25 +00:00
873e8740e0 3.17.2 is next 2020-12-23 22:20:24 +00:00
260c55f23a Release 3.17.1 2020-12-23 22:20:19 +00:00
9ed430acb9 CrashDump: fixed a bug in crashdump generation 2020-12-23 21:53:12 +00:00
f0241043de CrashDump: add server uptime to crash information 2020-12-23 20:26:18 +00:00
135f1c95e4 phpstan 0.12.64 2020-12-23 20:04:40 +00:00
8b5529fe17 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
2020-12-23 19:53:45 +00:00
5431807e43 Split tests up into multiple jobs
this gives a more granular view of test failures and also allows independent steps to run in parallel.
2020-12-23 19:48:39 +00:00
bcc3e87730 Timings: rename core timers to remove 'timer' from the names
this makes them shorter and more consistent.
2020-12-23 17:52:25 +00:00
d49ae832e8 actions: rename cache miss fallback build step 2020-12-21 21:32:27 +00:00
1d7b65e0c2 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	resources/vanilla
#	tests/gh-actions/build.sh
2020-12-21 00:16:12 +00:00
e762b79aae Player: fixed setPosition() resending all the chunks
closes #3977
2020-12-21 00:09:49 +00:00
ff9d013005 build: hash composer cache by lockfile instead of composer.json
this ensures a cache refresh when transitive dependencies are updated.
2020-12-20 23:58:37 +00:00
b0e1317818 Merge branch 'stable' of https://github.com/pmmp/pocketmine-mp into stable 2020-12-20 23:53:26 +00:00
8653afb0fb Updated composer dependencies 2020-12-20 23:53:09 +00:00
995b56aaa0 Fixed Composer package cache 2020-12-20 23:49:28 +00:00
3ecddf312d build.sh: sort configure parameters 2020-12-20 22:49:39 +00:00
470243ca6f experimental: build PHP in a separate build job 2020-12-20 22:30:47 +00:00
2ba47a80a4 updated build.sh to build PM4 binaries for gh actions 2020-12-20 22:18:04 +00:00
c5693598aa BulkCurlTask constructor now accepts BulkCurlTaskOperation[] instead of shaped arrays 2020-12-20 22:18:03 +00:00
9228f006d4 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	composer.json
#	composer.lock
#	resources/vanilla
#	src/CrashDump.php
#	src/PocketMine.php
#	src/pocketmine/Server.php
#	src/pocketmine/item/Bucket.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/Chunk.php
#	src/pocketmine/level/format/io/leveldb/LevelDB.php
#	src/pocketmine/level/format/io/region/McRegion.php
#	src/pocketmine/network/mcpe/protocol/BatchPacket.php
#	src/pocketmine/tile/Furnace.php
#	src/pocketmine/utils/UUID.php
#	src/utils/ServerKiller.php
2020-12-20 20:54:13 +00:00
3f21e59917 Bump phpstan/phpstan-strict-rules from 0.12.5 to 0.12.7 (#3976) 2020-12-18 13:44:19 +00:00
fdd74a4f46 Bump phpstan/phpstan-phpunit from 0.12.16 to 0.12.17 (#3975) 2020-12-18 13:15:05 +00:00
a43b46a93c Merge branch 'stable' of https://github.com/pmmp/pocketmine-mp into stable 2020-12-18 00:33:10 +00:00
0604dfc9e5 phpstan 0.12.63 2020-12-18 00:32:55 +00:00
dd2c3db285 Fixed a bucket of lava disappearing when used in a furnace (#3973)
fixes #2385
2020-12-17 23:57:34 +00:00
1e737644de World: split populateChunk() into two functions
requestChunkPopulation() respects the queue size, orderChunkPopulation() does not.
requestChunkPopulation() should be used for non-essential generation (which mainly includes generation for player use).
orderChunkPopulation() should probably be used by plugins.
2020-12-17 23:49:37 +00:00
c95e283507 fix CXXFLAGS 2020-12-14 22:02:16 +00:00
6afbd1f55c Squashed commit of the following:
commit 1f42169f0f929958f7d68a68f194c6f3492b7eb4
Author: Dylan K. Taylor <odigiman@gmail.com>
Date:   Mon Dec 14 21:23:44 2020 +0000

    ... install it in the right fucking place

commit d2a88abeda5fa937d3f508c4e0300a949af97846
Author: Dylan K. Taylor <odigiman@gmail.com>
Date:   Mon Dec 14 21:14:21 2020 +0000

    Build PHP using system libraries to reduce rebuild time
2020-12-14 21:58:58 +00:00
0682c93f5a Drop bcmath dependency
we haven't used bcmath since the days of 32-bit.
2020-12-14 20:59:07 +00:00
da90ae85da Updated composer dependencies 2020-12-14 19:24:36 +00:00
48623f4e79 World: add additional checks to addEntity() and removeEntity() 2020-12-14 18:55:52 +00:00
24ac5f8be0 Fixed craftingDataCacheRebuildTimer never being stopped 2020-12-13 21:41:22 +00:00
9e11cc03de Server: get rid of matchPlayer()
the functionality of this API method is too specialized to be of any practical use.
In addition, a search on Poggit reveals that the only uses of this API method are abuses or incorrect uses anyway.
2020-12-13 21:38:11 +00:00
c0438f1ddb Move player creation out of NetworkSession 2020-12-13 21:20:37 +00:00
6f09d472e2 WorldTimings: give timers names that actually make sense 2020-12-13 20:17:46 +00:00
1de5fc86c4 PopulationTask: assume that generator has been initialized 2020-12-13 20:00:57 +00:00
eaf6e19a6f RakLib sync n.2 2020-12-12 19:54:17 +00:00
5f4ef84d52 Clean up imports 2020-12-12 19:48:00 +00:00
f81d061ea9 Updated to newest RakLib 2020-12-12 19:06:45 +00:00
3e0cf30285 fixed phpstan failures caused by 5282ae3298 2020-12-11 23:00:14 +00:00
6a314c7d70 Updated build/php submodule to pmmp/php-build-scripts@bdce80c6c2 2020-12-11 22:44:44 +00:00
2af15557b9 Merge branch 'stable'
# Conflicts:
#	.travis.yml
#	resources/vanilla
#	src/block/BlockToolType.php
#	src/network/mcpe/protocol/types/entity/MetadataProperty.php
#	tests/travis/setup-php.yml
2020-12-11 22:44:04 +00:00
e87127f309 readme: drop travis badge in favour of GH Actions badge 2020-12-11 22:38:14 +00:00
0237a50d90 thank you for your service travis 2020-12-11 22:26:53 +00:00
8b53e4150e Setup GitHub Actions (#3966) 2020-12-11 22:25:08 +00:00
1c43538238 Fix that a hoe gets damage applied to it, when it's used to break a block (#3967)
closes #3965
2020-12-11 21:14:52 +00:00
61de84373a PermissionParser: simplify code 2020-12-11 19:09:01 +00:00
bee770ebf5 Drop nested permissions support in plugin.yml 2020-12-11 19:03:52 +00:00
dd58a95ae5 Move last-known-position tracking to World instead of Entity 2020-12-10 18:28:40 +00:00
e925423749 Entity: fix chunk tracking consistency issues, fixed attempted chunk loading in origin world when teleporting to a different position in a different world 2020-12-10 18:13:18 +00:00
5282ae3298 TimingsHandler::printTimings() now returns a list of strings instead of requiring a resource 2020-12-09 22:32:32 +00:00
58db3531c7 Use hrtime() for collecting timings
this allows nanosecond resolution and generally better accuracy than microtime(), which is subject to floating-point errors.
2020-12-09 22:24:31 +00:00
d39348929f Removed PLUGIN_PATH constant 2020-12-09 20:48:50 +00:00
ff6672ba85 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/utils/Utils.php
2020-12-09 20:27:19 +00:00
68887105b2 Utils::cleanPath(): drop the square braces
this looks ugly, as well as breaking plugin crash detection (which tbh is too fragile, but it is what it is ...)
2020-12-09 20:26:08 +00:00
22c8bdeeeb Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/CrashDump.php
#	src/utils/Utils.php
2020-12-09 01:47:05 +00:00
794bb0a71d PermissionParser: bail on encountering permissions whose names are not strings 2020-12-09 00:32:50 +00:00
104e90b794 CrashDump: more robust core crash detection 2020-12-08 23:27:03 +00:00
994062f6dc CrashDump: fixed plugin detection on eval()'d code
it's possible we could clean the path up to detect which plugin caused the crash, but for now I'll be happy to not have them showing up as core crashes ...
2020-12-08 23:11:29 +00:00
197b1a8566 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/network/mcpe/protocol/types/inventory/stackresponse/ItemStackResponseSlotInfo.php
#	src/network/mcpe/raklib/FilterTextPacket.php
#	src/pocketmine/VersionInfo.php
#	src/pocketmine/network/mcpe/protocol/PacketPool.php
#	src/pocketmine/network/mcpe/protocol/ResourcePacksInfoPacket.php
2020-12-08 21:34:06 +00:00
69a41a5ed4 3.17.1 is next 2020-12-08 21:02:14 +00:00
3903b70ef5 Release 3.17.0 2020-12-08 21:02:13 +00:00
692e63ad7c Protocol changes for 1.16.200 2020-12-08 20:31:17 +00:00
05a1f45111 PluginGraylist: all fields are mandatory 2020-12-08 13:38:44 +00:00
219cf2126b RegionWorldProvider: make loadRegion() return RegionLoader, fix 3 PHPStan null-reference errors 2020-12-07 19:04:52 +00:00
e810a68dd7 Merge branch 'stable'
# Conflicts:
#	build/php
#	composer.lock
#	resources/vanilla
#	src/pocketmine/VersionInfo.php
#	src/pocketmine/level/format/io/region/McRegion.php
2020-12-07 18:57:58 +00:00
4d1be4d41d McRegion: do not create a region file when trying to read a chunk that doesn't exist
fixes #3953
2020-12-07 18:44:49 +00:00
5f0310a8b6 3.16.2 is next 2020-12-07 17:16:11 +00:00
9b01fb3d89 Release 3.16.1 2020-12-07 17:16:10 +00:00
f28405fcfb phpstan 0.12.59 2020-12-07 17:12:55 +00:00
c4b47c6c06 Implemented /clear command (#3854)
closes #3854
2020-12-06 15:26:12 +00:00
d9de775c27 Updated DevTools submodule to pmmp/DevTools@888d021260 2020-12-05 22:56:27 +00:00
0bbceee86d PermissionParser: give permissions default FALSE if they don't specify their own default 2020-12-05 21:06:07 +00:00
9c07c206f6 Updated DevTools submodule to pmmp/DevTools@1606a4307b 2020-12-05 20:02:14 +00:00
d0d701f232 Updated build/php submodule to pmmp/php-build-scripts@a42c7df20a 2020-12-05 19:42:41 +00:00
07cae8a129 Updated composer dependencies 2020-12-05 19:40:30 +00:00
59cb11dc83 ChunkManager->setChunk() no longer accepts NULL 2020-12-05 18:54:30 +00:00
b6df5b974d World->getHighestBlockAt() may still return -1 if the queried column of blocks is all air 2020-12-05 18:14:38 +00:00
531c191431 Finalize Utils class 2020-12-05 18:09:23 +00:00
1f330c0f50 World: ignore entities calling onEntityMoved() who aren't members of the world
this can happen if movement or teleportation occurs during the creation of an entity.
2020-12-05 17:49:34 +00:00
b2bab6c2fb clean dead errors out of phpstan l8 baseline 2020-12-05 01:32:23 +00:00
a5315991d5 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/network/mcpe/protocol/serializer/PacketSerializer.php
#	src/world/biome/Biome.php
#	tests/phpstan/configs/l8-baseline.neon
2020-12-05 01:30:39 +00:00
6869ee1c2d Clean up nonsensical code in NetworkBinaryStream->getSlot() 2020-12-05 01:24:41 +00:00
eca0e88471 BaseInventory: fixed passing NULL slots to InventoryListener->onContentChange()
as per the documentation, InventoryListener->onContentChange() does not expect to receive NULL in the given array.
2020-12-05 01:11:30 +00:00
070d8efda3 [ci skip] more world stuff for changelog 2020-12-05 01:02:53 +00:00
d728160a77 Removed the cycle between Entity and Chunk
it's now the World's responsibility to manage adding/removing entities from appropriate chunks. Entities no longer know or care that chunks exist.
Entity->checkChunks() remains as-is for backwards compatibility - now it just calls the world to sync its position.
2020-12-05 00:59:16 +00:00
03b1ea766a Added a DedicatedQueryNetworkInterface to ensure Query functionality when RakLibInterface is disabled (#3942) 2020-12-04 21:21:25 +00:00
37b9694845 ConsumingItemAnimation: fixed itemID translation for 1.16.100 2020-12-04 20:44:03 +00:00
1c49cedc8c World: disallow block placement and breaking in unloaded, ungenerated and locked chunks 2020-12-04 15:49:35 +00:00
bacdb7bde5 Make sure generator gets preemptively registered when a worker restart is detected
if a PopulationTask took place after the target worker was garbage collected, the population would fail and the chunks it used would be copied for nothing.
This change marks workers as having unregistered generators when detecting that a worker that previously had a generator registered is restarted.
2020-12-04 15:44:17 +00:00
e056456dd1 Player: fixed crash when stopping using a chunk before it's finished being generated 2020-12-04 15:36:43 +00:00
26155acff2 register HellBiome (#3950) 2020-12-04 11:58:49 +00:00
5ba09b6a25 fix PopulationTask crash 2020-12-03 23:48:40 +00:00
5f55cdfa76 Cleaned out dead error patterns from phpstan level 8 baseline 2020-12-03 22:44:03 +00:00
b9cd633cee Chunks no longer exist in un-generated state
a non-generated chunk is now always represented by NULL. This forces the case of ungenerated chunks to be handled by all code, which is necessary because ungenerated chunks cannot be interacted with or modified in any meaningful way.
2020-12-03 22:28:43 +00:00
05ab44f768 PopulationTask no longer creates chunks if they don't exist
creating a throwaway empty chunk on the main thread is pointless.
2020-12-03 22:12:42 +00:00
c808095978 Chunks no longer contain their own coordinates 2020-12-03 21:59:30 +00:00
1f5998d24c FastChunkSerializer no longer encodes chunk coordinates
in cases like PopulationTask it makes more sense to store the coordinates separately where they can be stored more efficiently (once instead of 9 times)
In addition, PopulationTask shouldn't need to serialize an empty chunk just to copy coordinates.

I've made changes like this in other areas already in preparation for the day when chunks no longer contain their coordinates, so this brings us one step closer to that goal.
2020-12-03 20:52:33 +00:00
5b1fa25dff LightPopulationTask: remove useless @var 2020-12-03 20:29:41 +00:00
7edfa3713b Do not persist SimpleChunkManager between async tasks
this is just asking for memory leaks.
2020-12-03 19:46:23 +00:00
dde2e7e66f generation: drop AsyncWorker thread-local storage in favour of a more specialized storage 2020-12-03 19:28:22 +00:00
999defd20d World: remove create params from loadChunk() and loadChunkAtPosition() 2020-12-03 18:49:14 +00:00
a67f0d1f75 World->registerChunkLoader() no longer causes creation of an empty chunk
this only made sense to work around the server crashing when creating a player in ungenerated terrain, but spawning at y=256 is hardly preferable, and it'll crash since fd99445c5b anyway ...
2020-12-03 18:41:53 +00:00
1e7f9214cc Entity: flag for despawn if entering ungenerated terrain
previously this created an empty chunk for the entity to hang around in until the terrain was generated, but that's problematic for several reasons, most importantly the fact that non-generated chunks are not saved.
2020-12-03 18:36:54 +00:00
ec2feeffcb World->populateChunk() no longer causes ChunkLoadEvent to fire with an empty chunk
instead, it will fire when the chunk comes out of PopulationTask and is set into the world using setChunk().
There is still one place left where auto-creation of empty chunks is used by the core, and that's an issue i'm still deciding how to deal with.
2020-12-03 18:23:03 +00:00
fa9be2477d World: do not fire ChunkListener->onChunkChanged() when a new chunk is set
the documentation expressly describes a chunk being _replaced_ by a new chunk. This doesn't fit when the chunk didn't exist to begin with.
2020-12-03 18:20:43 +00:00
74744fd498 World: fire ChunkLoadEvent in setChunk() if the chunk did not previously exist
I'm of two minds whether this should continue to fire onChunkChanged() on chunk loaders or not, since the chunks won't be referenced by any chunk loader anyway by virtue of not existing ...
2020-12-03 18:15:09 +00:00
5197707d32 Separated TimingsRecord from TimingsHandler (different lifetimes)
this fixes #3906.
TimingsHandler will now be automatically destroyed when there are no TimingsRecord referencing it and its owner has no references left to it.
TimingsRecord will be automatically destroyed at the end of the timings session (if active).

This fixes records from temporary timers being lost after the timings handlers are removed, while also fixing TimingsHandlers piling up regardless of whether timings are running or not.
This opens the doors to have more volatile timers, such as per-player/per-session timers, which are destroyed on player quit, but which won't result in the timings disappearing from the final timings result.
2020-12-03 15:45:49 +00:00
29f6ed3f68 Use Snooze to improve AsyncTask collection times
regardless of how long an async task takes to run, it will take a multiple of 50ms to get the result processed. This delay causes issues in some cases for stuff like generation, which causes locking of adjacent chunks, and async packet compression, which experiences elevated latency because of this problem.
This is not an ideal solution for packet compression since it will cause the sleeper handler to get hammered, but since it's already getting hammered by every packet from RakLib, I don't think that's a big problem.
2020-12-02 19:34:34 +00:00
1775fb669b SurvivalBlockBreakHandler: fixed block break effects stopping beyond 4 blocks distance
this was actually intended to be 16 blocks ...
2020-12-02 18:56:39 +00:00
0574b59df9 Network: fixed interfaces registered after raw packet handlers not respecting raw packet handler filters 2020-12-02 17:11:15 +00:00
bc2fafca27 Fixed players losing all permissions when being de-opped after joining as op 2020-12-02 17:04:37 +00:00
687ad28fa6 Added a PacketBroadcaster interface
this gives a bit more control over how packets are broadcasted, which might be useful if the batch format changes (e.g. adding a length prefix) for multi version.
This really ought to be unique to a protocol context instead of a network interface, but for now this is the best we can do.
2020-12-02 16:34:14 +00:00
6001f69d52 Network->registerInterface() now returns whether the registration succeeded or not 2020-12-02 16:16:04 +00:00
807474b3fb PermissibleBase: do not assign any permissions by default
there is no longer such a thing as a permission granted to 'everyone', since we're no longer limited to true/false/op/notop, and regular players are now assigned the pocketmine.group.user permission.
It's possible we might want to add more restricted groups than 'user' in the future, in which case it would be behaviour-BC-breaking to change the default assigned permissions when creating a new PermissibleBase. Therefore, it's better to not assign any permissions at all and let the caller decide.
In addition, this solves the problem of implied permission subscriptions and leak on PermissibleBase construction - if base permissions are provided, it should be expected that the permissible will subscribe to those permissions.
2020-12-02 15:56:54 +00:00
05c52fef46 Updated DevTools submodule to pmmp/DevTools@7c2d05cafc 2020-12-02 14:41:28 +00:00
b51c6e89b3 Introduced pocketmine.group.console
this is only used for /dumpmemory right now, but it's planned to be used for more stuff.
2020-12-02 13:35:48 +00:00
c5e12bb11f PermissibleBase: simplify diff calculation 2020-12-02 11:29:45 +00:00
506e76917e PermissionAttachmentInfo now includes a reference to the PermissionAttachmentInfo that caused its assignment (if any)
this allows plugins to easily identify which permission group caused a permission to be assigned (particularly if multiple groups might cause it).
2020-12-02 11:23:35 +00:00
880635603c PermissibleBase: allow injecting more dynamic base permissions 2020-12-02 10:12:40 +00:00
13e8854ec0 PermissibleBase: fixed express denying of a root permission not working
this only took effect when a permission was applied as a root. When overridden with a permission attachment, the problem did not manifest.
2020-12-02 01:39:43 +00:00
f5bb5c1208 Permissible->recalculatePermissions() now returns a map of changed permissions with their old values 2020-12-02 01:13:19 +00:00
0634426c26 PermissibleBase: compute permission diff, do not fire callbacks when diff is empty
this fixes AvailableCommandsPacket getting sent twice when adding a PermissionAttachment.
2020-12-02 01:09:29 +00:00
6720e658bd Remove useless group permission nodes
the only value these have is for convenience, and a permission manager plugin can easily generate them by parsing the permission IDs.
2020-12-02 00:00:21 +00:00
07dc0f2dd5 resource packs: added metadata to manifest models 2020-12-01 23:37:36 +00:00
10067c1043 Improve painting performance
these really shouldn't hit the CPU at all considering they are simply static objects ...
2020-12-01 23:31:38 +00:00
6d6f8c3c38 custom threads: use PTHREADS_INHERIT_NONE by default
this has the most reliable behaviour, because some stuff like respect/validation likes to include files unconditionally which declare functions that are already declared, which breaks due to the lack of function autoloading.
2020-12-01 22:32:59 +00:00
541cfee615 RakLibServer: do not try to export exceptions across threads (they might contain Threaded objects whose references get invalidated) 2020-12-01 22:31:55 +00:00
cc473184ac Player: added API method getUsedChunks() 2020-12-01 19:40:22 +00:00
1905c01c87 PermissibleBase no longer circularly references its parent permissible
this was used for 2 things:
- to notify parent permissibles on recalculate permissions (not needed anymore thanks to callbacks)
- subscription to chat broadcast permissions (now handled separately, again using callbacks)

therefore, it's no longer needed for PermissibleBase to reference its parent, meaning that we can have one less circular dependency in our lives.
2020-12-01 18:46:39 +00:00
341d8747b7 Living: wipe out effect add/remove hooks onDispose() 2020-12-01 18:27:10 +00:00
8fb74258f4 Implemented a better method for detecting permission recalculation
this allows anyone to listen to permissions being recalculated, which is useful for stuff like broadcast channel subscriptions.
2020-12-01 18:23:42 +00:00
c20893aa4b PermissibleBase: more robust cycle destruction 2020-12-01 17:57:55 +00:00
87033592b1 Timings: remove obsolete timings handler 2020-12-01 17:40:09 +00:00
d602547941 PermissionAttachmentInfo no longer references Permissible
since the only way to obtain PermissionAttachmentInfo via the API is from the Permissible API, it makes zero sense to ask the attachmentinfo for its permissible, since we obviously already had it to be able to get the info in the first place. Therefore, this is just another useless reference stopping Permissibles from being garbage-collected.
2020-12-01 17:38:30 +00:00
d48af3f4ca Merge branch 'stable'
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/permission/BanEntry.php
#	src/permission/PermissionAttachmentInfo.php
2020-12-01 17:35:30 +00:00
b550cf5163 phpunit 9.4.4 2020-12-01 17:32:27 +00:00
48fa19fdcd PermissionAttachmentInfo::__construct() never throws an exception 2020-12-01 17:30:35 +00:00
f28bdb5aa2 [ci skip] update changelog to reflect permission changes 2020-12-01 17:24:38 +00:00
6d8833ccd3 Removal of permission defaults (in favour of permission cascading) (#3937) 2020-12-01 17:13:54 +00:00
bac986d0b2 Fixed crash when executing command /version with multiple authors declared in 'author' (#3940)
closes #3902
2020-12-01 15:47:55 +00:00
215bac8dd7 phpstan 0.12.58 2020-11-30 22:11:43 +00:00
3709ba172b Sync composer dependencies 2020-11-30 22:02:01 +00:00
1eabc3fe75 NetworkStackLatencyPacket: added named constructors 2020-11-30 21:29:51 +00:00
d56cf35385 Permissions are now always false when permission calculation hasn't been done yet
lack of permission calculation means that child permissions might not have been set correctly, so this might lead to users being able to access things they aren't supposed to.
2020-11-28 21:55:26 +00:00
97a4d80854 PlayerDataSaveEvent: provide online player if possible, otherwise don't load offline data from disk for no reason (we already have it, that's the whole point of the event ...) 2020-11-28 21:43:23 +00:00
614891f8a2 OfflinePlayer no longer depends on Server
it also doesn't provide stuff like isOnline() (you had to have a Server reference to get an OfflinePlayer anyway, just ask the Server if the player is online ...) and getPlayer().
2020-11-28 21:29:41 +00:00
c102477f91 OfflinePlayer: remove more useless junk
to obtain an OfflinePlayer instance you had to have a server instance to start with, which means getServer() is pointless, and also that isOp() and setOp() (which can be removed thanks to the fact that OfflinePlayer is not a Permissible) can be done by just asking the server.
2020-11-28 21:16:04 +00:00
3e9a37ca77 PermissionParser: remove unmaintained code 2020-11-28 20:51:09 +00:00
9867424117 [ci skip] reflect today's changes to Server in changelog 2020-11-28 19:35:12 +00:00
dd200ca8cd Rewrite message broadcasting system to not depend on PermissionManager subscriptions
relying on permission subscriptions for this was unreliable (a permissible is not always subscribed to a permission even when it does have it), and also difficult to control (for example there have been various bugs in the past where a Player ended up subscribed to broadcast permissions when it didn't expect to be, thanks to permission recalculation happening too early).
In addition, we might in the future want to have broadcast receivers which are not permissibles (i.e. a more general interface than CommandSender (why does a broadcast receiver need to also be a command sender, anyway?)), which the permission system wouldn't be suitable for.
2020-11-28 19:28:47 +00:00
ee7fad2271 PermissibleBase: fixed root permissible being unaware of changes in some cases
for example, Player->recalculatePermissions() was not called when a player's op status changed, nor when a permission attachment altered permissions (potential secvuln for broadcasting).
2020-11-28 19:22:30 +00:00
011d1713c0 [ci skip] changelog updates 2020-11-28 18:33:08 +00:00
b40720749b ZippedResourcePack: improved exception error on invalid manifest contents 2020-11-28 18:29:13 +00:00
c7961bfe90 Toss ServerOperator; PermissibleBase now tracks its own op status
as well as being simpler, this also allows some nice features, such as granting memory-only op state that goes away when the player quits the server.
2020-11-28 18:22:59 +00:00
4439781124 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/event/player/PlayerCreationEvent.php
2020-11-28 16:16:15 +00:00
ef034f2d68 PermissionAttachment: better document the apparently nonsensical code responsible for making sure the entire permission system doesn't burn down 2020-11-28 16:05:16 +00:00
8cf589eedd Strip some junk out of IPlayer
these methods have better pathways through Server directly.
Also, setBanned() does not allow customising the reason for banning or the duration, nor does isBanned() account for IP bans because the code is so old ... better to force dependence on a central code path to avoid these inconsistencies.
I want to do the same thing for OP, but that's a separate problem due to its effects on the permission system.
2020-11-28 15:36:46 +00:00
70b0d83258 Removed Server->broadcast()
this method has an explicit dependency on permission subscriptions, which I plan to eradicate.
The method's functionality can be replaced using Server->broadcastMessage() with a custom recipients array.
2020-11-28 13:01:10 +00:00
ecbc4e9433 Permission->getChildren() no longer returns by-ref 2020-11-27 20:31:59 +00:00
aa67c4894f Permission: added removeChild()
this probably isn't useful at all, but it's best to provide alternatives for all the stuff that getChildren() could have been used for ...
2020-11-27 20:31:24 +00:00
3849756993 Do not mutate the result of Permission->getChildren() 2020-11-27 20:28:36 +00:00
f0e43a6b22 DefaultPermissions: remove ridiculous recursion
this line is totally useless since the recursion does exactly the same thing as if it wasn't there.
2020-11-27 19:59:49 +00:00
1de486733a Permission: remove dead code
Bukkit CCC at its finest... what the fuck this was doing anyway I have no idea
an addChild() method would have made far more sense, especially considering that addParent() doesn't actually mutate the child.
2020-11-27 19:56:39 +00:00
ab18332572 PermissionManager: fixed nonsensical PHPDoc type 2020-11-27 19:54:05 +00:00
c454441646 [ci skip] updated changelog 2020-11-27 18:54:09 +00:00
9969c928a8 Player: Improved hardcore death handling
it's now possible to cancel the banning by cancelling PlayerKickEvent.
In addition, the disconnect message will now properly explain why the player is banned instead of just saying 'You have been banned',
and also banned-players.txt will show 'Died in hardcore mode' as the reason instead of being completely blank (seriously, we couldn't tell the difference between real bans and hardcore bans????)
2020-11-27 18:37:42 +00:00
5e44d5f75e Do not load playerdata from disk just to op/deop/whitelist/dewhitelist
this is an impressively dumb idea.
the playerdata is not used here in any capacity so it doesn't make sense to load it, especially considering that it takes a significant amount of time.
2020-11-27 18:12:45 +00:00
5142281cfa [ci skip] Server: remove misleading comment 2020-11-27 17:57:52 +00:00
48595630fc [ci skip] update crash issue template 2020-11-27 17:38:14 +00:00
0a7d81a2b0 FastChunkSerializer: retain emptyBlock on subchunks
I think we should probably get rid of this considering the potential for inconsistencies within a chunk, but not retaining this is a bug nonetheless, even though it doesn't have any effect in PM itself since we always use BlockLegacyIds << 4 as the empty block ID.

so, this is only really aiding (ab)use cases which weren't intended anyway ...
2020-11-27 13:41:35 +00:00
4e94025b3b SubChunk: rename defaultBlock -> emptyBlockId
this better describes the purpose, which is to identify air.
though, it might make more sense to make air just always have zero as air's runtime ID, since this parameter is apparently making plugin devs think that this is suitable to fill a chunk with a specific block ...
2020-11-27 13:33:25 +00:00
4d42f0c3db Timings: added timers for player data I/O 2020-11-27 00:02:34 +00:00
37ace19857 Updated netresearch/jsonmapper to 3.1.1 2020-11-26 23:39:57 +00:00
0be60fe1eb NetworkSession: Force use of async compression during the login sequence when latency doesn't matter
closes #3907
this reduces the impact of compression on the login sequence by about 90%; however, since compression only accounted for about 30% of said overhead at most, it's not really a massive difference.
2020-11-26 23:39:19 +00:00
4ea5401d72 World->getHighestBlockAt() now throws an exception instead of returning -1 in ungenerated terrain 2020-11-26 19:44:22 +00:00
fd99445c5b World->getSafeSpawn() now throws if the target is in ungenerated terrain, instead of silently returning the default
this WILL cause crashes in some cases on slower machines (#2724), but it's
better than randomly spawning at the top of the map.
2020-11-26 19:36:37 +00:00
4102205ba6 Enhance type information in PlayerCreationEvent 2020-11-24 16:28:36 +00:00
4520e425c1 Sync BedrockData submodule with merge
I forgot to commit this in the merge ...
2020-11-21 21:17:23 +00:00
af1fe7c293 Merge branch 'stable' 2020-11-21 21:13:48 +00:00
bc208e11f4 phpstan 0.12.57 2020-11-21 18:07:14 +00:00
9e85ee4a7a Fixed missing field on Persona skin encode 2020-11-21 18:01:56 +00:00
027ec129b6 Merge remote-tracking branch 'refs/remotes/origin/master' 2020-11-21 17:55:54 +00:00
7b865dc5a9 Updated composer dependencies 2020-11-21 17:55:32 +00:00
f2187477b1 Merge commit '8273f789ee785cda3269e3a9841e99241503dc4f'
# Conflicts:
#	resources/vanilla
#	src/utils/SingletonTrait.php
2020-11-21 17:49:07 +00:00
d2b593edf8 Updated composer dependencies 2020-11-21 17:47:54 +00:00
e8e6b9304c phpstan 0.12.57 2020-11-21 17:46:32 +00:00
23849b7f63 3.16.1 is next 2020-11-21 01:25:06 +00:00
d2f68836c6 Release 3.16.0 2020-11-21 01:25:06 +00:00
d19db5d2e4 fix phpstan warnings 2020-11-21 01:16:04 +00:00
98cdc80d37 Protocol changes for 1.16.100 2020-11-21 01:07:25 +00:00
f2bdbb0c35 TypeConverter: fix using singleton to get its own context
I guess this must have been refactored from some other class?...
2020-11-20 21:31:06 +00:00
8273f789ee Backport SingletonTrait to PM3 2020-11-20 21:00:47 +00:00
870d237260 BlockFactory::get() second parameter is now mandatory 2020-11-18 00:50:01 +00:00
29eccba5f0 Updated composer dependencies 2020-11-17 23:25:15 +00:00
28335e3c45 Player: fixed self-defeating condition in item consuming
this was giving players infinite food and potions.
2020-11-17 20:33:20 +00:00
6a1f551aab [ci skip] update TileFactory TODOs (#3912) 2020-11-17 11:04:26 +00:00
62b9d97060 Break circular dependency in Player->disconnect() usages
none of these usages require onPlayerDestroyed() to be fired since they are all being called during disconnects anyway.
2020-11-16 23:05:56 +00:00
09b22c1e79 NetworkSession: drop @var doc comment referring to nonexisting variable 2020-11-16 22:51:03 +00:00
c3c647d51e NetworkSession: remove useless disconnect() call
this can't execute here because of the disconnectGuard, so this call always does nothing.
2020-11-16 22:13:48 +00:00
d1775b166f Merge branch 'stable'
# Conflicts:
#	resources/vanilla
2020-11-16 21:35:08 +00:00
37299ab804 ChunkCache: explicitly check for requesting of unloaded chunk
NetworkSession will never do this, but other things might.
2020-11-16 19:45:46 +00:00
1d27225553 Relocate cache-related classes to mcpe\cache namespace 2020-11-16 19:39:30 +00:00
9984b15de6 fix build #3 2020-11-16 19:25:13 +00:00
6ea01e0dd4 fix build #2 2020-11-16 19:21:44 +00:00
869c9dabf1 SetCommandsEnabledPacket: added ::create() 2020-11-16 19:11:10 +00:00
ca6a892834 [ci skip] NetworkSession: added some extra TODOs 2020-11-16 19:10:27 +00:00
16b71a265f Barrel: added missing function import 2020-11-16 19:09:59 +00:00
46331df7db fix build 2020-11-16 19:06:56 +00:00
691c49fb32 I don't know how to pass custom arguments to these scripts :< 2020-11-16 19:05:04 +00:00
db815360d1 [ci skip] BUILDING.md: tell users to use 'composer make-server' instead of the server-phar script directly
this takes care of the dev dependencies automatically.
2020-11-16 19:03:39 +00:00
6e297168c2 travis.sh: use new composer commands 2020-11-16 19:01:07 +00:00
95dbb00d4c Added custom composer commands: 'composer make-devtools' and 'composer make-server' 2020-11-16 18:55:23 +00:00
50e29a5ed8 build/make-server: bail when composer dev dependencies are installed
these mess up the phar and make it extremely bloated. Almost everyone building for themselves unintentionally includes dev dependencies.
2020-11-16 18:54:07 +00:00
de40ad80a6 Updated DevTools submodule to pmmp/DevTools@0c46527bee 2020-11-16 18:33:28 +00:00
a9faed7171 [ci skip] update BlockFactory TODOs 2020-11-16 18:23:01 +00:00
430d16e5f5 fixed borked test 2020-11-16 18:17:04 +00:00
563336cdc9 CoralType: remove unused magicNumber stuff 2020-11-16 18:12:38 +00:00
fd88c78d3a added test for CoralTypeIdMap
we really need a better way to guarantee exhaustiveness for this ...
2020-11-16 18:12:01 +00:00
1eee24f1fa Implemented coral blocks
there are some complications with coral plants due to the fact we're stuck with R12 worlds right now - and also coral fans are a major pain to implement due to how messed up the metadata is.
2020-11-16 18:05:39 +00:00
55a9ce46b9 VanillaBlocks: added BARREL 2020-11-16 17:56:13 +00:00
d7c6a20b34 Barrel: added @return $this to setOpen() 2020-11-16 17:29:24 +00:00
b2765f32e9 Implemented Barrels, closes #3672 2020-11-16 17:26:07 +00:00
1cf3a500f8 Clean up ChestInventory handling
longer term I want to rip this crap out completely, but right now this provides minor maintainability benefits, while also making it slightly less nasty to deal with other containers which animate their blocks, such as barrels and shulker boxes.
2020-11-16 16:59:19 +00:00
b534ae050e DisallowEnumComparisonRule: detect bugs involving union types (Enum|null compared to Enum|null) 2020-11-14 16:51:13 +00:00
4ade7b6225 added CoralType enum 2020-11-14 16:24:13 +00:00
06efad94b6 Separated metadata handling from PillarRotationTrait 2020-11-14 16:21:50 +00:00
7469f28f24 Server: rename getPlayer() to getPlayerByPrefix()
closes #3910

the existing naming was misleading, and many plugin devs assumed that it returns an exact match. However, this is not guaranteed, and it's possible for two different players to match the same prefix.

- There is no defined behaviour for what happens when multiple players can equally match a prefix (e.g. 'fr' could match 'fred' or 'frog' equally, because the name lengths are the same)
- A prefix might match a different player at a different time (e.g. 'fr' could match 'freddie' before 'fred' joins, after which it will match 'fred' instead)

With these flaws in mind, it's better to break compatibility on this to make the intent more clear, and to make plugin developers reassess their usages of this method. In most non-command use cases, they should likely be using getPlayerExact() instead.
2020-11-14 15:49:41 +00:00
41a8007c47 phpstan: drop some error counts to account for recent Sugarcane changes 2020-11-12 22:26:04 +00:00
8e0cba56b8 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/tile/Tile.php
#	tests/phpstan/configs/check-explicit-mixed-baseline.neon
#	tests/phpstan/configs/l7-baseline.neon
2020-11-12 22:10:47 +00:00
9f3fb935b5 Update composer dependencies 2020-11-12 22:03:32 +00:00
e30b1ee2c7 Clean up entity and tile saveID handling
we only ever need the first entry, so there's no point storing all of them. In addition, the field is private, which guarantees that nothing else needs the array either.
This also fixes phpstan/phpstan@c50650c5dd.
2020-11-12 21:49:12 +00:00
04b038ff4b [ci skip] more detail to PM4 changelog 2020-11-12 21:34:12 +00:00
0d9561c93f Removed crafting data cache from CraftingManager 2020-11-12 21:30:59 +00:00
31089ce3b2 Timings: added broadcastPackets timer
the body of this function is potentially very expensive and isn't currently recorded by any timer.
2020-11-12 17:53:07 +00:00
afbef242c6 bootstrap: remove useless phpdoc 2020-11-12 17:12:08 +00:00
5efd0eba13 Imports cleanup 2020-11-12 17:11:34 +00:00
c4d35d52e8 Do not store a pre-compressed cache for crafting data
this reduces bandwidth efficiency because it can't be compressed with everything else this way. If we want to cache stuff sent during the login sequence, it's better to stuff a bunch of stuff into a batch (e.g. crafting, creative, actor ids, biome defs) and pre-compress that as one big package instead.
2020-11-11 18:20:03 +00:00
8f36957c10 phpstan: drop some dead level 8 ignoreErrors 2020-11-10 22:46:30 +00:00
21d37623f8 sync phpstan level 8 baseline with 75f2f12b99 2020-11-10 22:46:15 +00:00
d08c9ee634 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/VersionInfo.php
2020-11-10 22:44:59 +00:00
574b7f6343 3.15.5 is next 2020-11-10 16:48:18 +00:00
e8b6b56330 Release 3.15.4 2020-11-10 16:48:18 +00:00
c368ebb5e7 InventoryTransaction: beware of conflicting slot change actions with the same origin/target
these types of chains would never normally occur, but they've been seen in the wild. Attempting to resolve such chains has exponentially increasing complexity.
2020-11-10 16:45:20 +00:00
75f2f12b99 NetworkSession: rename some badly-named hooks 2020-11-10 15:01:48 +00:00
e23379c34b EncryptionContext: provide the packet ID in the exception message 2020-11-10 14:45:19 +00:00
6a266bcbd1 Separated XUID stuff from PlayerInfo into its own XboxLivePlayerInfo 2020-11-10 14:25:08 +00:00
c43f14a2d2 Updated phpstan checkExplicitMixed baseline to account for changes in 463bc044df 2020-11-10 14:06:13 +00:00
6c02bac437 Updated DevTools submodule to 66b8f7dfd77f78478a180e40137e17606301233e 2020-11-09 20:30:22 +00:00
463bc044df Rename PluginLoadOrder -> PluginEnableOrder
this more accurately describes its real purpose.
2020-11-09 20:28:08 +00:00
6cf875ca3a Item: rename onActivate() to onInteractBlock() 2020-11-09 19:33:13 +00:00
8c480ffab9 Player: fix a few more cases of held-item getting trashed after some events 2020-11-09 19:31:48 +00:00
e573226025 ItemStack: fixed phpstan failure 2020-11-09 19:10:02 +00:00
2bcb398db9 ItemStack: added jsonSerialize 2020-11-09 19:05:00 +00:00
1d02829d6f [ci skip] more detail for World API changes on PM4 2020-11-09 14:01:27 +00:00
66955d4b99 World: make loadChunk() more useful, drop useless proxy function getOrLoadChunk() 2020-11-09 13:41:46 +00:00
3c6a64f91b Fixed armour equipment logic, close #3896
this isn't perfect because the client expects to be the boss here and is also inconsistent.
2020-11-09 13:32:12 +00:00
4e91009492 Armor: fixed equipping when right-clicking air instead of a block
this action (which is more accurately referred to as 'activate item' or 'use item' in other areas) always fires on right-click when holding any item, whether aiming at a block or not.
2020-11-09 12:47:36 +00:00
3bf87378ef Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/VersionInfo.php
#	src/pocketmine/level/LevelTimings.php
2020-11-08 19:44:30 +00:00
fa920aa868 Misplaced the changelog AGAIN 2020-11-08 19:25:55 +00:00
a421d32273 3.15.4 is next 2020-11-08 14:48:31 +00:00
6c21c23444 Release 3.15.3 2020-11-08 14:48:31 +00:00
55e0d9c520 Properly time chunk loading and chunk sending on timings reports, closes #3895 2020-11-08 14:30:12 +00:00
f43d20b47a Move attribute net sync to NetworkSession 2020-11-08 14:15:11 +00:00
64afb6f2e2 Move responsibility of firing chunk requests from World to NetworkSession
this is, after all, all about sending chunks ...
2020-11-08 14:14:43 +00:00
4ae7efbfbc [ci skip] add some documentation to Player internals 2020-11-08 14:03:30 +00:00
ffff0a6244 NetworkSession: remove obsolete TODO 2020-11-08 14:03:30 +00:00
b059e0b475 Item: fixed wrong tag being removed during serialization of custom name (#3894) 2020-11-07 01:25:37 +00:00
beb6a50883 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/pocketmine/Player.php
#	tests/phpstan/configs/runtime-type-checks.neon
2020-11-06 13:18:49 +00:00
528726068e phpstan 0.12.54 2020-11-06 13:09:04 +00:00
3aa902ff77 Updated composer dependencies 2020-11-06 13:07:28 +00:00
e6348bbd34 Entity: do not assume that save IDs are always strings
this is only the first of many changes needed to make entity savedata fully format-agnostic, but it's a start.
2020-11-06 13:05:17 +00:00
37ee3f2775 Player: fixed orderChunks performance issue on newly-generated maps
every time a chunk passed through Level->generateChunkCallback(), it fired onChunkChanged() for chunk listeners, which in turn caused players to rerun chunk orders even though the target chunk had not been sent yet anyway.
2020-11-05 16:17:39 +00:00
bfdcc12e81 phpstan 0.12.54 2020-11-05 14:49:00 +00:00
4b46549cd1 fix PHPStan failure
setDirtyFlag has a void return type, so PHPStan assumes it's non-pure and invalidates the type info.
2020-11-05 14:35:23 +00:00
058a3b3fa6 relocate some world-specific logic from Chunk to World 2020-11-05 14:28:36 +00:00
8762d44506 World: skip lighting updates on chunks which are not yet light populated 2020-11-04 17:50:16 +00:00
72ace3951e InGamePacketHandler: fixed crafting table breaking when clicked while sneaking 2020-11-03 22:56:20 +00:00
142102a054 ItemFactory: remap bucket:9 and bucket:11 to their appropriate counterparts 2020-11-03 19:44:57 +00:00
518a7827a6 BlockFactory: make slab registration slightly less awful to look at 2020-11-03 19:28:32 +00:00
32929925aa Block: added a bunch of state manipulation APIs 2020-11-03 19:13:32 +00:00
0a8dc3edd3 Fixed users of ColorInMetadataTrait having uninitialized default colours 2020-11-03 18:42:40 +00:00
bcedbc364b BlockDataSerializer: added methods to read/write coral facing 2020-11-03 18:41:12 +00:00
c3af0eff93 travis: use pmmp/leveldb 2020-11-03 17:56:15 +00:00
b2299e08e0 phpstan 0.12.53 2020-11-03 15:00:56 +00:00
d7741050c5 Updated composer dependencies 2020-11-03 14:54:50 +00:00
5c5fe15483 tests: remove unused script 2020-11-03 14:42:29 +00:00
a05f67bc77 Position::fromObject() world parameter is now mandatory (although still nullable) 2020-11-03 14:33:26 +00:00
5cc2a9c3dd World: rename getChunkAtPosition() to getOrLoadChunkAtPosition()
this more accurately reflects what it does.
2020-11-03 14:12:47 +00:00
bd78d0bff8 Player: added getItemCooldownExpiry() 2020-11-03 14:11:28 +00:00
2e9b2d4aae World: fixed false unload events firing on chunk replacement when tiles and entities are deleted 2020-11-01 17:41:58 +00:00
61112e4912 World: make create params of loadChunk and getOrLoadChunk mandatory
differences in the default values almost caused me to miss some bugs while trying to remove them.
2020-11-01 17:36:56 +00:00
0bb37b5065 World: formalize setBlockAt()'s refusal to modify un-generated chunks
closes #2631
2020-11-01 17:24:09 +00:00
b7690fed04 BiomeSelector: replace phpdoc with typehints 2020-11-01 17:09:10 +00:00
12e185e3f6 Relocate EntityLegacyIds to pocketmine\data\bedrock package 2020-11-01 17:07:34 +00:00
1f2bc8cb69 World: remove rogue import 2020-11-01 17:05:57 +00:00
0ae17af1e0 BiomeRegistry: fixed EOF newline 2020-11-01 16:53:42 +00:00
4231bfdc7e Relocate biome ID constants to pocketmine\data\bedrock package 2020-11-01 16:53:06 +00:00
b176f4c12f Switch to BiomeRegistry
I accidentally committed this in c869a7f099 and didn't notice. I intended to use it and never noticed.
2020-11-01 16:47:13 +00:00
f991961d9a Generator no longer requires a ChunkManager to construct
this allows injection of arbitrary ChunkManagers into a single Generator instance.
The objective here was to remove the requirement to cache a SimpleChunkManager instance in worker-local storage, because that requires that the chunks it stores be manually removed to avoid memory leaks. However, there are some other obstacles, primarily the worldHeight which is not retained anywhere else.
2020-11-01 16:34:56 +00:00
315962c12c Added __clone() for Chunk and SubChunk
we need this because the flatworld generator uses clone to produce new chunks, so we don't want the chunks getting fucked up.
2020-11-01 16:14:25 +00:00
1d551af54a Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/level/Level.php
#	src/pocketmine/level/format/Chunk.php
#	tests/phpstan/configs/l7-baseline.neon
2020-11-01 15:58:16 +00:00
2684ee96f7 World: do not perform base lighting calculation on non-generated chunks
this was causing twice as many light calculations for freshly generated chunks.
2020-11-01 15:53:50 +00:00
6cff08cd65 Chunk: fixed hasChanged being set on fastDeserialize() chunks (caused by 2bb497b716)
this caused some performance issues and silent bugs with the generator, notably that the generator would always think all chunks had been changed, causing them to be re-set back into the world 9 times.
2020-11-01 15:50:21 +00:00
ef542880de WorldManager: allow different World instances to have different AsyncPool instances
instead of being forced to use the Server async pool
right now the intent of this is to reduce (and ultimately eliminate) the dependency of World on Server, but it might come in useful for other stuff too, for example a chunkserver-based generator implementation which blocks on network instead of eating CPU (it would just waste CPU for other tasks).
2020-11-01 15:21:15 +00:00
11434f3a27 World::setBiomeId() now bails when trying to modify a non-generated chunk (or chunk locked for generation) 2020-11-01 15:00:48 +00:00
3e21e47b7a Liquid: make getFlowVector() slightly less cancerous to read 2020-11-01 14:39:59 +00:00
fec42f16ba Level: properly define type of generator field 2020-11-01 14:36:05 +00:00
19bc879dc1 lose useless blank line 2020-11-01 14:24:02 +00:00
be1da07ee5 tests: phpdoc cleanup 2020-11-01 14:23:44 +00:00
d6d9dde0b2 imports cleanup 2020-11-01 14:23:21 +00:00
73a8c90bee Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	resources/vanilla
#	src/world/Explosion.php
#	tests/phpunit/item/ItemTest.php
#	tests/phpunit/world/format/io/region/RegionLoaderTest.php
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMainLoggerTest.php
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMemoryLeakTest.php
2020-11-01 14:21:47 +00:00
deb0cee8a0 BaseInventory::canAddItem(): consider item max stack size (#3881)
this fixes addItem() failing when canAddItem() reported that an item can be added.
2020-11-01 13:49:13 +00:00
c312c8ddd6 fix build 2020-11-01 00:11:41 +00:00
c1a451f3b1 SubChunkExplorer: ditch subChunkChangeFunc
this is better implemented by checking the moveTo() result, which also won't have circular dependencies.
2020-10-31 23:46:27 +00:00
817372c55b SkyLightUpdate: make heightmap calculation routines pure 2020-10-31 23:42:32 +00:00
c39a1407a2 Move heightmap calculation logic to SkyLightUpdate 2020-10-31 23:34:04 +00:00
59a3e8c096 BiomeArray: added ::fill() 2020-10-31 23:22:42 +00:00
05470d0621 phpstan: regenerate level 8 baseline (again) 2020-10-31 23:17:03 +00:00
4549522289 Rename Chunk::getSubChunkChecked() -> getSubChunk() 2020-10-31 23:12:03 +00:00
e09d78238f Removed EmptySubChunk and SubChunkInterface 2020-10-31 23:10:31 +00:00
13d7b7ee1a Removed final remaining usages of Chunk::getSubChunk()
this clears the way to get rid of EmptySubChunk.
2020-10-31 23:07:36 +00:00
f50be1ba63 Chunk: Use getSubChunkChecked() in getFullBlock() 2020-10-31 23:06:12 +00:00
bacfcf258e World: remove unused function 2020-10-31 23:00:27 +00:00
8ee70dc30a SimpleChunkManager: fix missing mask in getBlockAt() 2020-10-31 22:55:56 +00:00
40f9cd16cb phpstan: drop a bunch of obsolete ignoredErrors from l8 baseline 2020-10-31 22:52:00 +00:00
d94877f5d2 fix build 2020-10-31 22:51:24 +00:00
01001dca74 Use Chunk::getSubChunkChecked() in places where we know that an invalid coordinate cannot be requested 2020-10-31 22:48:41 +00:00
b270029161 Rename Chunk::getWritableSubChunk() -> Chunk::getSubChunkChecked()
this is not specific to 'writable', it's just an opt-in to checked bounds so that an EmptySubChunk will never be received.
2020-10-31 22:46:33 +00:00
5701e733cc World: fixed a crash in getFullBlock() when used on ungenerated terrain 2020-10-31 22:36:12 +00:00
f5807ac049 World::getBlockAt() now doesn't assume that AIR has a fullStateId of 0 2020-10-31 22:22:02 +00:00
d0470a80ab SimpleChunkManager: remove post-mature optimisation
these methods are not used in hot paths and are inherently slow anyway, not to mention the introduction of morton codes eliminating the hashtable indexing problem.
2020-10-31 22:02:36 +00:00
ddda2d1e64 Remove $create parameter from ChunkManager::getChunk()
this restores SimpleChunkManager's behaviour to PM3, removing the need for GeneratorChunkManager (although I'm dubious whether SubChunkExplorer makes any sense in there any more now that we have morton in the mix).
2020-10-31 21:54:51 +00:00
dec235abab World: don't create a new chunk just to read biome info
the chunk won't be generated, so we can provide the default result without creating a new chunk for no reason.
2020-10-31 21:29:39 +00:00
de867f1b86 World: don't create an empty chunk just for accessing the highest block
this is pointless since the chunk will not be generated anyway, so it serves no end to create it.
2020-10-31 21:27:16 +00:00
f0d62cf4ce World: don't try to load chunks to read light levels
sync chunk load is useless here because lighting isn't immediately calculated anyway and it isn't available directly from the chunk when loaded.
2020-10-31 20:38:15 +00:00
68f5eada32 added fire extinguishing sound, closes #2777 2020-10-31 20:18:06 +00:00
f67ab094f2 fix build 2020-10-31 16:51:14 +00:00
5f7b0994b9 World: rename get(HighestAdjacent)BlockSkyLight(At) to make it clear these are **potentials**, not the actual light level 2020-10-31 16:47:34 +00:00
241a50387b World: added getHighestAdjacentRealBlockSkyLight()
this is the same as its 'non-real' counterpart, but it accounts for time of day.
2020-10-31 16:44:42 +00:00
0b92e96e14 Player: set silent flag in spectator 2020-10-31 16:10:02 +00:00
8be0c0da0d Implemented a silent property on entities and Entity->broadcastSound()
fixes #3516
2020-10-31 16:07:18 +00:00
66edf5a165 Particle::encode() now always returns ClientboundPacket[] 2020-10-31 15:51:17 +00:00
5a320f22b7 Sound::encode() now always returns an array 2020-10-31 15:48:46 +00:00
0cbc5c9a4a region: harden handling of ByteArrayTag
previously this would just explode if the wrong length of data was given.
2020-10-31 15:37:06 +00:00
058bb3a91a World: do not execute neighbour block updates on unloaded chunks
we might also need to delay this if any adjacent chunk is also not loaded, in case the block wants to access adjacent blocks during its neighbour update.
2020-10-29 13:37:14 +00:00
c0dafe7872 Explosion: remove dead code
this was needed for the old ExplodePacket, which was removed a few versions back.
2020-10-29 13:32:56 +00:00
cfb9cc8999 fix build failure 2020-10-29 13:22:35 +00:00
b079772d32 World: do not include unloaded or unlit chunks in getHighestAdjacentBlock(Sky)Light() 2020-10-29 13:05:25 +00:00
3c892182fd World: change some usages of getOrLoadChunk() to getChunk()
these usages don't require getOrLoadChunk() because they already check for unloaded chunks anyway.
2020-10-29 12:57:33 +00:00
092a69e415 update phpstan baseline 2020-10-29 12:18:29 +00:00
3e1263eb79 Chunk: remove all proxy APIs to lighting information
these aren't used by internals and they shouldn't be used by plugins either.
2020-10-29 12:11:06 +00:00
ddc0f137e7 changelog: VanillaEffects -> VanillaEnchantments (#3884) [ci skip] 2020-10-27 21:51:55 +00:00
587a4c0095 non-exhaustive updates to changelog [ci skip] 2020-10-27 19:35:03 +00:00
797e0996f4 PopulationTask: Do not include light when serializing chunks (either way)
non-populated chunks shouldn't be light-populated anyway, but in some cases they are (bug or plugin interference).
chunks which were already populated might get modified by adjacent chunk populations, which should invalidate their lighting because generation doesn't track which blocks were changed, so the whole chunk should be recalculated.
2020-10-27 18:42:30 +00:00
1859dac789 Implemented self-contained (pass 1) chunk relighting
this doesn't handle propagating light across chunk borders yet, since that's much more complex to implement.
2020-10-27 18:29:32 +00:00
014317381f Sugarcane: deduplicate growth code
this also fixes sugarcane attempting to grow past the top of the world (closes #3883).
2020-10-27 18:05:41 +00:00
0ecd68e4a7 LightUpdate: remove premature optimisation which breaks when mass-update lighting is used
when setBlockSkyLightArray/setBlockLightArray was used, currentLightArray would retain a reference to the old light array, which would cause false readings if SubChunkExplorer didn't move away from that subchunk and back.
This causes a small degradation of performance, but I think it can be implemented differently anyway.
This also fixes #3816.
2020-10-27 18:01:31 +00:00
05ab75b5ce PopulationTask: do not calculate lighting for chunks
we do this ondemand now, which means this is just wasting CPU for the vast majority of generated chunks.
2020-10-27 17:03:57 +00:00
31c2c3abb5 SubChunkExplorer::moveTo() now returns a status
this can be used by SubChunkExplorer subclasses to implement specialized logic.
2020-10-26 16:25:21 +00:00
390bc631c8 SubChunk: added moveToChunk() 2020-10-26 16:04:31 +00:00
340881d590 remove superfluous newline 2020-10-26 15:59:57 +00:00
e2e960e43d tests: add missing function imports 2020-10-26 15:59:42 +00:00
500fd2d842 tests: strip useless phpdoc 2020-10-26 15:59:17 +00:00
0b550b346b imports cleanup 2020-10-26 15:43:25 +00:00
8bab9cc108 RegionWorldProvider: use morton2d directly instead of abusing chunkHash()
while these currently do the same thing, it's very confusing and creates an unnecessary dependency on World.
2020-10-26 15:34:32 +00:00
d6ed542fcd Merge remote-tracking branch 'origin/stable' into master
# Conflicts:
#	composer.json
#	composer.lock
#	src/CrashDump.php
#	src/pocketmine/Server.php
#	src/pocketmine/level/format/io/region/McRegion.php
#	tests/phpstan/configs/check-explicit-mixed-baseline.neon
#	tests/phpstan/configs/l7-baseline.neon
#	tests/phpstan/configs/l8-baseline.neon
#	tests/travis/setup-php.yml
2020-10-26 16:18:53 +00:00
4c0c2ebd24 CS cleanup 2020-10-26 15:56:30 +00:00
3f254bd49c Separated effects' MCPE ID registration from VanillaEffects 2020-10-24 18:52:20 +01:00
cf7f50af06 Fixed test failure 2020-10-24 18:25:42 +01:00
c5b925a213 Moved EnchantmentIds to pocketmine/data/bedrock package 2020-10-24 18:24:39 +01:00
f3f7ff9237 Enchantment internal IDs are now dynamic 2020-10-24 18:21:31 +01:00
47976bac34 Moved enchantment ID handling to pocketmine/data/bedrock package
this permits plugins to register their own enchantments mapped to MCPE IDs again.
2020-10-24 17:59:46 +01:00
2e1239f77a EnchantCommand no longer accepts numeric enchantment IDs 2020-10-24 17:33:17 +01:00
1424114cf2 Clean phpstan baselines
some of these are dead, others are FPs fixed by newer PHPStan versions.
2020-10-24 17:22:49 +01:00
a8980a0f67 phpstan 0.12.51 2020-10-24 17:10:31 +01:00
69aa7c5ac1 Support for Composer v2 (#3880) 2020-10-24 16:42:38 +01:00
11b74868ee CraftingTransaction: remove impossible condition
this is never hit thanks to the logic flow above - recipeItems is never empty.
2020-10-24 11:22:02 +01:00
9a53de0903 Utils: explode() never returns an empty array 2020-10-24 11:19:37 +01:00
0f8101d4a6 McRegion: Ignore files which don't have a valid file extension
previously a file with a 4-letter name ending in 'mca' in the region folder of a PMAnvil world would cause the world format to be unrecognized. This happens because strrpos() returns false when the substring isn't found, which gets coerced to 0 when used in addition.
2020-10-24 11:15:07 +01:00
55ecac4c80 Fixed always-true condition in world loading
this has a couple of side effects which need to be explored.
- first of all, this bug prevented generateLevel() from filling in the preset from server.properties. With this fix, worlds which don't have any extra generator settings will start to be generated using server.properties settings, which is almost certainly not expected behaviour.
- preset can now be specified separately from generator in pocketmine.yml, which is nicer for users.
2020-10-24 11:10:35 +01:00
3b632a8deb Handle InvalidArgumentException thrown by VanillaEnchantments::fromString (#3878) 2020-10-24 06:43:14 +01:00
9947e13121 Yank constants out of Enchantment base class 2020-10-23 21:04:27 +01:00
a01c086481 Introduced VanillaEnchantments registry 2020-10-23 20:48:19 +01:00
e9038336e3 EventPriority: hardcode name -> value mapping instead of using constant()
this would have caught fire if additional non-priority constants were added, or if the constants were renamed.
2020-10-23 20:14:37 +01:00
f5e033ad5d AsyncPool: fixed stable merge error 2020-10-23 13:25:52 +01:00
23e5ade77e Merge branch 'stable' into master
# Conflicts:
#	build/make-release.php
#	composer.lock
#	resources/vanilla
#	src/plugin/PluginDescription.php
#	src/pocketmine/entity/Human.php
2020-10-21 16:55:52 +01:00
2a1d1e90a2 php-cs-fixer nits 2020-10-21 16:44:57 +01:00
286ac2a975 Rework World::blockHash() to use morton3d
this uses the unused bits on the Y component to expand the X/Z axes to 2^27 blocks long instead of 2^21 permitted by a regular morton3d code. It does require the sacrifice of an additional bit on the Y axis, but the performance advantages are more than worth it.
I'm exploring how realistic it would be to just eliminate blockHash global usage (currently in lighting updates and explosions). This would allow scaling up to 2^32 without larger hashes (morton2d for chunks).
2020-10-20 20:31:10 +01:00
4444a79468 Bump phpunit/phpunit from 9.4.1 to 9.4.2 (#3875) 2020-10-20 09:06:46 +00:00
4684333dee Updated build/php to pmmp/php-build-scripts@eee477802a 2020-10-18 20:14:08 +01:00
9a282e2646 Noise: Improve fastNoise3D performance by ~25-30% 2020-10-17 20:03:19 +01:00
095449e86a Normal (generator): micro optimisations (and readability improvements) 2020-10-17 19:24:01 +01:00
0f9d5f7011 ext-morton is now required and used for World::chunkHash() and World::chunkBlockHash() 2020-10-17 16:09:30 +01:00
2d839db47e fixed build failure 2020-10-17 16:05:38 +01:00
de6d260b76 Fixed cactus and sugarcane trying to grow past the top of the world 2020-10-17 15:05:55 +01:00
4cbeee3ab8 Bump phpstan/phpstan from 0.12.49 to 0.12.50 (#3874) 2020-10-17 13:44:43 +00:00
a251960c1c AsyncPool: expose workerUsage to the API
this allows plugins (and maybe later on the core) to detect async worker overload and warn the user about potential performance issues.
I planned to implement such detection in the core directly, but it turned out to be a bit more complex than I anticipated. At the least, this API might be useful to someone else.
2020-10-16 21:20:49 +01:00
d38791e27d Listener: Drop support for @softDepend annotation
literally nobody uses this. I don't think anyone even knows it exists.
It's also an obstacle to separating event handler registration from PluginManager.
2020-10-16 21:10:57 +01:00
52f734799e Human: do not modify totalXp unless setting XP succeeds 2020-10-16 20:43:03 +01:00
42171f6e06 Human: beware negative values in addXp() 2020-10-16 20:42:13 +01:00
792f38f474 Carpet and Wool now have dynamic colours 2020-10-15 14:45:28 +01:00
0ef0848c44 Concrete and ConcretePowder colour is now dynamic 2020-10-15 14:30:07 +01:00
1fe4fdc67c PluginDescription: fixed some very old refactoring errors 2020-10-15 13:55:40 +01:00
3aca03d262 Player: clean up refs when forced chunk unload is detected
this might happen because of a plugin, or low memory condition.
2020-10-13 18:17:12 +01:00
cc91cbd8c5 Updated build/php submodule to pmmp/php-build-scripts@bc8e1cf001 2020-10-13 17:53:31 +01:00
e8ec65766c Updated resources/locale to pmmp/Language@884a0496c3 2020-10-13 17:52:47 +01:00
44e446b621 Merge remote-tracking branch 'origin/stable' into master
# Conflicts:
#	build/php
#	composer.lock
#	phpstan.neon.dist
#	resources/vanilla
#	src/pocketmine/Server.php
#	src/pocketmine/VersionInfo.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/lang/locale
#	src/utils/Timezone.php
#	tests/phpstan/bootstrap.php
#	tests/phpstan/configs/custom-leveldb.neon
2020-10-13 17:51:49 +01:00
aa00bd5e31 Updated phpstan to 0.12.49 2020-10-13 17:39:24 +01:00
0186468e47 updated composer dependencies 2020-10-13 17:38:06 +01:00
af4f30d1c8 Bump phpstan/phpstan from 0.12.48 to 0.12.49 (#3873) 2020-10-13 16:31:25 +00:00
03837c1b71 ZlibCompressor: use libdeflate if available
I may make libdeflate mandatory later on, but right now we haven't been able to ship it on all platforms yet.
2020-10-13 17:30:27 +01:00
3e2926441d PluginDescription: make sure that extensions constraints are actually strings 2020-10-13 17:21:10 +01:00
0b33762be0 PluginDescription: fixed type of extensions (reported by phpstan 0.12.49) 2020-10-13 17:21:10 +01:00
e6f89213dc Entity: properly account for upwards motion when calculating fall distance (#3867)
Previously, upwards movement wouldn't be considered, but downwards would, so if an entity bobbed up and down in the air for a while (e.g. while being comboed in PvP), the downwards distance would accumulate and deal a large amount of fall damage on touchdown.
This commit changes fall distance measurement to correctly account for upwards movement.

A better way of measuring fall distance would simply be to record the highest Y coordinate reached while in the air, and then measure the distance between that and the point of contact when landing. This would also remove the need to constantly update the fallDistance field. However, this would involve a BC break and will therefore have to wait until PM4.
2020-10-13 14:16:09 +01:00
f8d249b240 Isolate and always show IP details on install (#3870)
* Isolate and always show IP details on install

* camelCase
2020-10-13 14:11:28 +01:00
b39afa20d1 Bump phpunit/phpunit from 9.4.0 to 9.4.1 (#3872) 2020-10-13 13:09:56 +00:00
7027a9b972 camelCase 2020-10-12 08:25:34 -04:00
b02f3f4090 Isolate and always show IP details on install 2020-10-11 18:57:30 -04:00
8564912149 phpstan: define LEVELDB_ZLIB_RAW_COMPRESSION if it doesn't exist (for phpstan)
this improves the analysis quality by informing phpstan of the type of whatever should be there.
2020-10-11 23:01:21 +01:00
eabfd2a37b World: replace sendBlocks() with createBlockUpdatePackets()
this allows the caller to decide how the packets should be sent.
2020-10-11 16:30:54 +01:00
ca9f3020b4 World: added private broadcastPacketToPlayersUsingChunk()
this is equivalent to the old addChunkPacket, but private and with a less stupid name.
2020-10-11 15:21:15 +01:00
a05b1fec7e World: rename chunkPackets -> packetBuffersByChunk 2020-10-11 15:18:57 +01:00
bd3bf3d0ce Revert "World: do not group broadcasted packets by chunk, broadcast directly instead"
This reverts commit b172c93e45.

I made a significant mistake with this change: the scaling factor of
batch-by-chunk is O(nSendBytes), while the scaling factor of sending
directly to players is O(nSendBytes * nActivePlayers). It seems like the
real problem is that this system isn't getting enough usage.

While it does reduce compression efficiency in some cases, it falls back
to letting the sessions do individual compression when the amount of
data is less than 256 bytes anyway (compression-threshold in
pocketmine.yml).

My motivation for scrapping this system was to reduce the broadcast
system's complexity to make it easier to thread the living shit out of
compression, but it seems like this change was a step in the wrong
direction for performance.

A few steps can be taken to improve the usefulness of this system (and
also improve output bandwidth):
- Make general entity updates use this system. Movement and velocity
  already kinda used this system, but crucially, players did not,
  because we couldn't prevent the player from receiving its own movement
  updates if we did that, which caused all kinds of problems.
  - Therefore, we need to reintroduce static "self" entity IDs, like we
    had in the shoghi days when entity ID 0 referred to the "self"
    player.
  - However, since entity ID 0 has a variety of interesting bugs since
    it usually refers to "no entity" in MCPE, it would be better to use
    1 (or 2, like MiNET does).
  - The fixed ID used should be close to zero to maximize varint
    encoding efficiency.
  - We assumed that changes to player's position and velocity would be
    ignored by the client. This assumption depends on the client and
    could be broken at any time, so it's best not to rely on it.
- Make block updates use this system (when chunk updates are not sent).
  Currently, block updates use a separate mechanism which creates a
  second batch for every active chunk, which wastes CPU, and decreases
  bandwidth efficiency on multiple fronts (reduced compression
  efficiency, more cross-thread interactions, more bytes wasted on
  RakNet packet headers).
2020-10-11 14:55:54 +01:00
2e3940e8f5 NetworkSession: remove circular dependency between queueCompressed() and flushSendBuffer()
this cycle makes the code fragile and prone to infinite looping bugs when modified, as well as making the code harder to follow.
2020-10-11 12:22:59 +01:00
46c57e4e24 TimingsCommand: fixed crash on result handling
since AsyncTask->getResult() returns mixed, phpstan has no idea what is being returned here, so it doesn't report any errors.
2020-10-11 11:35:03 +01:00
e11dbf03e2 Process: apply native typehint to kill() 2020-10-09 18:06:33 +01:00
40fca0936f Internet: make getURL() and postURL() return InternetRequestResult objects
this reduces the amount of reference parameters, and generally reduces the number of parameters, while guaranteeing consistency of the APIs.
2020-10-09 18:03:20 +01:00
873535f719 Timezone: explicitly check result of getURL()
phpstan-strict-rules should report this, but it doesn't ...
2020-10-09 17:23:22 +01:00
78f4fcf6ab StatusCommand: removed "Maximum memory (system)"
it's not clear what this was actually supposed to represent, but it actually reports VmSize, which is already reported by "Total virtual memory". This line confuses users and is misleading.
2020-10-08 22:58:37 +01:00
15cd354b98 fixed phpstan run again 2020-10-08 21:58:22 +01:00
a91710b199 Fixed player knockback not working since 531c6344fe
player knockback silently depended on the chunk packet broadcast system sending the player's motion back to itself, which broadcasting to hasSpawned will not do.
2020-10-08 21:56:08 +01:00
15a2fd6e4f LegacySkinAdapter: check return value of json_encode() for resource patch 2020-10-08 21:42:07 +01:00
b0b08d45d5 Entity: clean up sendData() handling, remove send-to-self hack 2020-10-08 21:35:36 +01:00
01b44ab0bc protocol: moved skin data types to their own namespace 2020-10-08 21:20:57 +01:00
90b749c260 net: reduce default compression level to 6
On larger packets, this worsens compression ratio by 1-2%, but reduces CPU load due to compression by 15-20%. Higher levels than 6 are far more expensive for diminishing returns.
Level 5 produces a further 25-30% CPU reduction, but increases bandwidth usage by 20-25%, so 6 is the sweet spot.
2020-10-08 16:51:10 +01:00
94c58c00b5 NetworkSession: Restore PM3 unexpected XUID handling behaviour (removes XUID instead of kicking the player)
close #3861, close #3089
2020-10-08 14:36:07 +01:00
df7bafe2bc TileFactory: fixed missing Beacon tile registration
I had this locally but forgot to commit it ...
2020-10-07 15:16:27 +01:00
cbc6ebebad Entity: make use of MoveActorAbsolutePacket::create() 2020-10-06 18:35:02 +01:00
d8ee657d20 MoveActorAbsolutePacket: added ::create() method 2020-10-06 18:34:38 +01:00
69cad3e694 InGamePacketHandler: Ignore LevelSoundEventPacket completely 2020-10-06 18:26:57 +01:00
531c6344fe Entity: stop using broadcastPacketToViewers for movement / motion
this is now effectively identical to sending packets to each of hasSpawned, with the exception that it won't send packets to itself if it's a player.
2020-10-06 18:22:46 +01:00
d7f7e1c4ff InventoryManager: remove useless repeated code 2020-10-06 18:14:46 +01:00
cc3947058a updated phpstan baseline 2020-10-06 18:11:13 +01:00
15eac8a65a NetworkSession: renamed some instructions to imperative instead of onWhatever()
these aren't listening to events, they are telling the client that an event has taken place.
2020-10-06 18:06:48 +01:00
945a2598b7 Player: fix documented type of kick $quitMessage 2020-10-06 17:55:32 +01:00
49d611168f Player: fix documented type of disconnect $quitMessage 2020-10-06 17:54:44 +01:00
b172c93e45 World: do not group broadcasted packets by chunk, broadcast directly instead
Grouping packets to batch by chunk instead of by player reduces bandwidth efficiency, because the number of active chunks is almost always larger than the number of active players.
With the old mechanism, a batch of packets for each active chunk (which could be dozens, or hundreds... or thousands) would be created once, and then sent to many players. This makes the compression load factor O(nActiveChunks). Broadcasting directly is simpler and changes the load factor to O(nActivePlayers), which usually means a smaller number of larger batches are created, achieving better compression ratios for approximately the same cost (the same amount of data is being compressed, just in a different way).
2020-10-06 17:27:17 +01:00
78bddac823 Player: remove removeFormat, chat formatting is now unconditionally available
This change was made after exploring turning this into a permission. It occurred to me that this feature is entirely superfluous because it's non-vanilla, can be done by plugins, and is usually considered as a bug. In addition, disabling this behaviour required third party code just for this one thing because it was not able to be managed by a permissions plugin.
Instead, it's better to produce a plugin which implements this behaviour if it's desired, by making use of SignChangeEvent and PlayerChatEvent/PlayerCommandPreprocessEvent.

close #3856, close #2288
2020-10-06 14:00:23 +01:00
e39d2c4621 Beacon: fixed crash in PC worlds 2020-10-06 13:40:49 +01:00
d5398b2781 3.15.3 is next 2020-10-06 13:33:42 +01:00
d7a66ad755 Release 3.15.2 2020-10-06 13:33:42 +01:00
b3f88e7b73 Updated language submodule to pmmp/Language@c85a7b79f3 2020-10-06 13:28:51 +01:00
55adc1ef63 Updated build/php submodule to pmmp/php-build-scripts@e45cfc1ece 2020-10-06 13:09:05 +01:00
868d236ddc Updated composer dependencies 2020-10-06 12:39:19 +01:00
59e9c84806 Merge branch 'stable' of https://github.com/pmmp/pocketmine-mp into stable 2020-10-06 12:35:51 +01:00
a110317d1b Bump phpstan/phpstan from 0.12.47 to 0.12.48 (#3851) 2020-10-05 13:23:19 +00:00
b169d89291 Added some documentation to FurnaceBurnEvent 2020-10-04 21:40:52 +01:00
dfee8b7fa5 Added SignLikeRotationTrait 2020-10-04 21:09:45 +01:00
fc1084d65c Sponge: fixed wet/dry state not persisting in inventory 2020-10-04 19:42:29 +01:00
309d23acfb regenerated blockfactory consistency check 2020-10-04 19:12:36 +01:00
6fb45de405 fixed phpstan baseline 2020-10-04 19:12:04 +01:00
7f9c4355f0 Revert back to floor/wall banner variants
this code largely duplicates the same code in FloorSign/WallSign and needs to be de-duplicated.
2020-10-04 19:05:43 +01:00
505d4e402f ItemFactory: do not reuse the same itemstack instance for air()
this is mutable, so it's possible for plugins to mess with it and break everything that references it.
2020-10-04 18:36:46 +01:00
c42a6d7552 ItemBlock no longer depends on legacy ID/metadata 2020-10-04 18:27:20 +01:00
7ef794d725 imports cleanup 2020-10-04 18:22:07 +01:00
d3a3a41d2b Revert back to separated floor/wall sign
the conditionally useless properties are problematic.
2020-10-04 17:52:23 +01:00
e6bf7278fc Sign: remove obsolete clone hook
this is no longer required because SignText is not mutable anymore.
2020-10-04 17:24:40 +01:00
388a19ef5d Persistent block metadata may now have mutable parts
Not allowing this makes stuff like anvil damage, colour, wood type, live/dead bit, wet/dry etc all too much hassle to deal with.
Naturally I want to get rid of this shit altogether, but first it's necessary to construct a new system that we can shift into before all this bullshit can be addressed fully, so for now we have to work within the bounds of the old system.
This change will permit dynamic colours for concrete/concrete powder etc, dynamic wood types where the wood type isn't embedded in the legacy ID, and so forth. Allowing full flexibility requires either more old system hacks or completing the migration to a new system which doesn't have these limitations. I prefer to do the latter, but this change will make it somewhat easier to do.
2020-10-04 11:40:05 +01:00
9191e75392 LevelDB: quick and dirty hack for air with bad metadata
this needs a proper solution, but this is a pressing issue that can't wait.
2020-10-03 16:41:26 +01:00
d0213f99ac MountainsBiome: fix error from stale PR merge 2020-10-02 12:24:18 +01:00
a77970448e Emerald ore in Mountains biome (#3750) 2020-10-02 12:07:49 +01:00
74bef7f423 Bump phpunit/phpunit from 9.3.11 to 9.4.0 (#3850) 2020-10-02 11:02:17 +00:00
e17629244c Merge branch 'master' of https://github.com/pmmp/pocketmine-mp into master 2020-10-02 01:00:21 +01:00
5807a385cc Added stub classes for Beacon
this doesn't do anything yet, it's intended solely to prevent further loss of data.
2020-10-02 00:59:53 +01:00
6734dcc79f Introduce PlayerDisplayNameChangeEvent (listen only) (#3847) 2020-10-01 22:23:02 +01:00
7a436dc47c updated blockfactory consistency check 2020-10-01 22:10:02 +01:00
4492c80af1 Merge remote-tracking branch 'origin/stable' into master
# Conflicts:
#	composer.lock
#	resources/vanilla
2020-10-01 22:08:27 +01:00
201bdc069c phpstan 0.12.47 2020-10-01 22:07:43 +01:00
8db7867881 travis: notify about build results 2020-10-01 22:05:12 +01:00
84feec954f BlockLegacyMetadata: Added constants for mushroom block variants 2020-10-01 21:41:46 +01:00
14c156b162 Added ChemicalHeat block stub 2020-10-01 14:46:14 +01:00
d8f8afe531 Bump phpstan/phpstan from 0.12.46 to 0.12.47 (#3844) 2020-09-30 10:51:33 +00:00
7dabf305f8 Bump phpstan/phpstan from 0.12.44 to 0.12.46 (#3841) 2020-09-29 07:01:51 +00:00
12087c9850 Wall: use facing as value as well as key in connections 2020-09-26 17:41:00 +01:00
9e3ff21aea Wall: remove unused import 2020-09-26 17:26:54 +01:00
ec7c5fd669 Added a BrewingStandSlot enum 2020-09-26 17:20:02 +01:00
e192c75019 MemoryManager: Analyze contents of function/method static variables
it's possible for stuff to hide inside these things that would cause leaks.
2020-09-26 15:18:34 +01:00
b8e1bdbed4 MemoryManager: Look inside Closure objects to resolve dependencies
the lack of closure analysis allowed several memory leaks to be unable to be debugged using memory dumps.
2020-09-26 15:11:47 +01:00
7b02cc3efd Implemented #3836: Replace setCancelled() in events with cancel() and uncancel()
The motivation for this is to prevent passing a dynamic argument to cancellation, which in almost all cases is a bug in user code. This same mistake also appears in a few places in the PM core (as seen in this commit), but in those cases the mistakes were mostly harmless since they were taking place before the event was actually called.
closes #3836
2020-09-26 14:31:56 +01:00
75e3a0aa0f Merge branch 'stable' into master
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/command/defaults/StatusCommand.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/level/format/SubChunk.php
2020-09-26 13:27:08 +01:00
ed0053d0ee Updated build/php submodule to pmmp/php-build-scripts@732ceba847 2020-09-26 13:20:45 +01:00
28255e35d1 Updated composer dependencies 2020-09-26 13:18:38 +01:00
05a94f35d6 Updated composer dependencies 2020-09-26 13:17:54 +01:00
89cce4c749 performance: only calculate light for chunks inside ticking areas
this produces a major performance improvement for large render distances, and reduces the impact of lighting calculation to zero on servers which have random blockupdates turned off.
2020-09-26 13:13:12 +01:00
b727972c76 World: remove useless isLightPopulated() check
chunks are never light populated when loaded from disk now.
2020-09-26 12:52:28 +01:00
626680c6c1 Use new Location objects instead of mutating Entity->location directly
I'm actually not a big fan of needing to recreate the whole thing just to modify the coordinates. This seems kind of stupid.
2020-09-25 18:43:49 +01:00
db7fb25196 Avoid more Vector3 mutations using withComponents() 2020-09-25 18:40:13 +01:00
1d8e7abdd4 Entity: avoid direct mutation of Vector3 in checkObstruction(), use withComponents() instead
this ugly code can be simplified quite a lot further, but that's a job for later.
2020-09-25 18:38:41 +01:00
25566c2f1a Entity: avoid direct Vector3 mutations in tryChangeMovement() 2020-09-25 18:37:29 +01:00
9dda99f844 Updated composer dependencies 2020-09-25 18:36:45 +01:00
38b97dd0b7 Entity: remove useless function 2020-09-25 18:11:24 +01:00
3b4e9eea96 RuntimeBlockMapping: drop useless doc comment 2020-09-25 17:43:00 +01:00
7c192f85e2 protocol: remove final remaining Vector3 mutations
this really should be replaced with a network layer BlockPos structure in the absence of a general int-vector structure in math.
2020-09-25 17:41:12 +01:00
a5e21bfaa9 Entity: protect getBlocksAroundWithEntityInsideActions() 2020-09-25 16:40:30 +01:00
3556f26e00 Entity: Rename getBlocksAround() -> getBlocksAroundWithEntityInsideActions()
this name is more long-winded, but much less misleading.
2020-09-25 16:39:55 +01:00
8e12693494 Entity: Invalid blocksAround cache when something happens during onEntityInside()
this fixes TNT spawning multiple entities when lit by flaming arrows.
The problem here is a bit more complex (entities aren't immediately notified when local block updates happen, so they cache stuff that becomes unusable). The simplest option would be to just lose the cache, but that would have some impacts on performance.
Barring a rethink of the block updating mechanism, this solution seems usable for now.
2020-09-25 16:35:59 +01:00
0fc9170bbf Bump phpstan/phpstan from 0.12.43 to 0.12.44 (#3838) 2020-09-25 13:20:29 +00:00
7e2efae024 Bump phpstan/phpstan from 0.12.42 to 0.12.43 (#3831) 2020-09-24 11:23:32 +00:00
e9fa07b550 Bump phpunit/phpunit from 9.3.10 to 9.3.11 (#3835) 2020-09-24 09:57:58 +00:00
ae9e931849 LightPopulationTask: Simplify check for chunk loading in onCompletion()
we have no business loading chunks here either, although the isChunkLoaded() check should prevent that from happening.
2020-09-20 13:44:02 +01:00
b252c18d34 World: Loading chunks to sync block updates is a bug
again, this should never happen, because chunk unloading cleans this stuff out. But if it did happen, loading chunks is not the way to take care of it.
2020-09-20 13:42:27 +01:00
b7471fc77b Player: Loading chunks to spawn entities is a bug
again, this would never happen except in bug circumstances, but if there was a bug, it should crash instead of trying to load chunks to paper over it.
2020-09-20 13:40:44 +01:00
7f43164776 Player: Loading chunks during unloading chunks is a BIG nope
this should never happen, but it could have happened if there was a bug in the code for some reason.
Readers note: I know this looks lik I'm undoing the changes I just did, but what really happened is a name change.
2020-09-20 13:39:31 +01:00
716de4d9d6 ChunkCache: we have no business autoloading chunks during sending
if the chunk isn't loaded, this is a bug and it should crash.
2020-09-20 13:32:54 +01:00
5096741b29 World::getChunk() behaviour now matches that of a regular ChunkManager
Various bugs existed for a while with stuff using chunk managers instead of worlds when interacting with terrain due to a behavioural inconsistency between World::getChunk() (return from cache or load from disk), and SimpleChunkManager::getChunk() (return from cache only). This change brings the two in line.
World::getOrLoadChunk() has been added as a replacement, which has the same behaviour as the old getChunk() and also makes it more obvious that there is an issue with code using it during refactoring.
2020-09-20 13:29:09 +01:00
c9d2edcb4d Rename SubChunkIteratorManager -> SubChunkExplorer 2020-09-20 12:47:44 +01:00
4879df626d Reduced LightUpdate dependency on ChunkManager to indirect
this opens the gateway for alternative SubChunkIteratorManager implementations which don't use ChunkManager at all.
2020-09-20 12:41:53 +01:00
5661d0496f RuntimeBlockMapping::toRuntimeId() now accepts a single integer instead of id/meta
the expectation is that eventually this will receive arbitrary internal runtime IDs instead of static id/meta, and RuntimeBlockMapping doesn't really care about this crap anyway.
2020-09-20 12:16:11 +01:00
42b184c113 Merge branch 'master' of https://github.com/pmmp/pocketmine-mp into master 2020-09-20 12:01:40 +01:00
2281df8c97 Updated build/php submodule to pmmp/php-build-scripts@0eb28b8b66 2020-09-20 12:01:24 +01:00
8ac32824a2 Bump phpunit/phpunit from 9.3.9 to 9.3.10 (#3828) 2020-09-15 17:01:03 +00:00
1322defead Bump phpunit/phpunit from 9.3.8 to 9.3.9 (#3825) 2020-09-12 12:32:33 +00:00
d084b7a34b RegionGarbageMap: add an extra overlap check
this shouldn't ever be triggered, but we want to know if it does.
2020-09-12 01:38:13 +01:00
c2d0605b1e Entity: avoid implicit float truncation in getDirection()
this didn't cause any bugs because of the way the function is written, but it might have in other circumstances.
2020-09-11 21:01:22 +01:00
0ff0b33047 StatusCommand: avoid modulo operator on float
this was detected by a custom PHPStan extension.
2020-09-11 20:56:18 +01:00
114df07622 RegionLoader: specify type of unpack() return
PHPStan has no idea what is going on in this code because unpack() returns mixed[].
Possibly it might be a good idea to implement a dynamic return type extension for this.
2020-09-11 20:48:37 +01:00
4a88db7f43 travis: update pthreads to pmmp/pthreads@b81ab29df5 2020-09-11 14:30:22 +01:00
9d0ac297bb Improved documentation for CancellableTrait 2020-09-10 16:49:20 +08:00
d3ea29d527 Release memory to OS on garbage collection
ZMM often holds onto big chunks of memory after they aren't used anymore, which is fine in a webserver, but it's not OK for PM.
2020-09-09 01:40:18 +01:00
c20ac82fe6 LightUpdate: Move propagation-specific state to a separate unit
this solves multiple architectural issues:
- improves reusability by avoiding having old state info stick around to fuck stuff up
- prevents access to propagation state from outside of propagation

this also reduces the latent memory usage of light-updates after they have been used.

TODO: we could probably change LightPropagationContext to LightPropagator and move all the propagation-specific code into it if we can solve the subchunk-iterator and effective light problems.
2020-09-09 01:06:09 +01:00
bde24d9279 LightUpdate: remove unused field 2020-09-08 23:14:10 +01:00
03de2bcc67 Chunk: simplify heightmap calculation 2020-09-08 23:03:52 +01:00
c7070788f9 Rename and repurpose Block->diffusesSkyLight to blocksDirectSkyLight
this new form allows skipping some useless checks during sky light calculation and also allows getting rid of the last hard dependency on core Block classes.
We're getting real close to native light now.
2020-09-08 22:40:05 +01:00
773069d1cc fix travis build 2020-09-08 21:09:39 +01:00
ec6ac59b9c BlockLightUpdate: actually use lightEmitters
I accidentally added this during a separation of my local changes, but it's useful anyway, so we should use it.
This removes BlockLightUpdate's implicit dependency on Block, which is a
step towards native light.
2020-09-08 18:21:03 +01:00
205617f29e Untether LightUpdate and children from BlockFactory 2020-09-08 18:14:35 +01:00
0fd3d91038 LightArray: hide constants ZERO and FIFTEEN from the API
this makes it easier to implement this in C++ with the same API. Since the C++ version doesn't use strings, these constants aren't needed anyway.
2020-09-08 15:13:58 +01:00
01f8116cdd Fix some of the implicit immutability issues of EmptySubChunk
it's useful to have an immutable stub around for the sake of feeding back dummy read values, but for write values it has to barf instead of being quiet.
There's still some issues with LightArray which I don't currently have a solution for, but I'm thinking about separating light storage from chunks anyway.
2020-09-07 14:43:26 +01:00
5fbc842f7a LightArray: do not accept NULL in the constructor
it makes more sense to pass LightArray::ZERO or just use LightArray::fill(0) if a zeroed light array is desired.
2020-09-06 16:18:47 +01:00
be0cec531a ResourcePackInfoEntry: remove useless null coalesce operators
these fields are never null.
these errors aren't reported unless bleeding-edge is enabled.
2020-09-06 16:13:41 +01:00
fb4b92d1f4 HandlerListManager: fixed missing null type flag 2020-09-06 16:12:54 +01:00
f45316d2d6 Leaves: fixed phpstan type doc error
for some reason this isn't reported unless bleeding edge is enabled.
2020-09-06 16:12:24 +01:00
94d8f59484 LightUpdate::execute() now returns the number of visits made to blocks in total
this is useful for performance profiling.
2020-09-05 22:25:42 +01:00
15299735e9 Do not create chunks during light propagation/removal
this used to be necessary to trigger subchunk creation so that light arrays would be available for use. With 02ff8d671b, this is no longer necessary.
2020-09-05 22:22:19 +01:00
6054104ecb drop a few more useless static variables
phpstan is better able to understand constant literals, since it knows their types will never change.
2020-09-05 18:43:22 +01:00
b96565faa4 Drop some obviously useless static function variables
these are better suited as constant literals.
2020-09-05 18:39:47 +01:00
6b6f77f8af Chunk: improved heightmap calculation performance
recalculateHeightMapColumn is stateless, so it can't make any assumptions about which subchunks to check for blocks. However, in most the average case (6 allocated subchunks), this causes 2500+ useless SubChunk->getHighestBlockAt() calls (10 per column). Since we're calculating in bulk, we can figure out which subchunks are empty one time and ignore them for all 256 columns.
In the average case, this produced a 50-60% performance improvement for heightmap calculation (~1.1 ms -> 0.5 ms).
In extreme cases where the height is extremely varied, this produces no observable performance benefit, but for most cases with flattish terrain, it's an improvement.
It can likely be further improved, but further performance improvements are outside the scope of this commit and will likely result in more complexity increases.
2020-09-05 00:16:07 +01:00
e1816bd415 SubChunkInterface: clarify documentation of isEmptyFast() 2020-09-04 22:10:42 +01:00
2e45398072 World: skip random block ticking on chunks that don't have any light
typically this is a state that only lasts for a tick or so, but it's a race condition that is regardless very commonly encountered.
If you were very unlucky, you might have noticed grass randomly dying when you were spawning or flying around, even though it was in full sky light.
2020-09-04 18:08:42 +01:00
d2f1a3cf5b SubChunk: workaround opcache preloading constant issue
non-class constants aren't stored during preloading phase and for some reason they aren't pre-resolved in opcode arrays. However, they are resolved by value when referenced by class constants, and class constants stick, so we can use those instead.
2020-09-04 17:53:22 +01:00
a68b0b1f93 LightArray: make collectGarbage() more preload-friendly
opcache preloading doesn't store non-class constants, but it does store class constants. Class constants that reference non-class constants are pre-resolved into values before storing in opcache SHM, so class constants are OK to use, but non-class constants will come back as undefined.
2020-09-04 17:23:23 +01:00
b81cc671e9 Major performance improvement to basic sky light calculation
this was degraded whenever it was I decided to make chunks always be allocated. This commit uses a fast path for light filling in subchunks which are completely clear of the heightmap, which returns the performance back to its old fast levels.
2020-09-04 15:51:33 +01:00
101dc1e1d7 fixed a couple of new phpstan errors 2020-09-04 01:44:21 +01:00
0aee39027e Merge branch 'stable' into master
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/entity/Living.php
#	src/pocketmine/Player.php
#	src/pocketmine/VersionInfo.php
#	src/pocketmine/block/Potato.php
#	src/pocketmine/block/Sugarcane.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/Chunk.php
#	src/pocketmine/level/format/io/leveldb/LevelDB.php
#	src/world/generator/GeneratorRegisterTask.php
#	tests/phpstan/configs/check-explicit-mixed-baseline.neon
#	tests/phpstan/configs/l7-baseline.neon
#	tests/phpstan/configs/l8-baseline.neon
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMainLoggerTest.php
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMemoryLeakTest.php
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskPublishProgressRaceTest.php
2020-09-04 01:43:52 +01:00
5a80f6e201 Updated build/php submodule to pmmp/php-build-scripts@d88132ee55 2020-09-04 01:07:32 +01:00
e87760c218 composer: do not install packages with min version higher than 7.3.0
running composer update on 7.4 will generate a lock file using the newest dependencies which work for the current PHP version, which usually isn't desirable for a project like this where developers might be using newer PHP versions than users.
2020-09-04 01:05:48 +01:00
f9c2ed6200 composer: do not install packages with min version higher than 7.3.0
running composer update on 7.4 will generate a lock file using the newest dependencies which work for the current PHP version, which usually isn't desirable for a project like this where developers might be using newer PHP versions than users.
2020-09-04 01:00:26 +01:00
e47a711494 Bump phpstan/phpstan from 0.12.40 to 0.12.42 (#3812) 2020-09-03 14:13:14 +00:00
2ea7a9e216 3.15.2 is next 2020-09-03 15:09:52 +01:00
9f60484212 Release 3.15.1 2020-09-03 15:09:52 +01:00
3031d89ec5 Potato: drop 1-5 potatoes per harvest, not 1-4 2020-09-03 14:54:58 +01:00
883e135bc0 Potato: drop poisonous potatoes when harvested, fixes #2830 2020-09-03 14:54:04 +01:00
4448f603a6 Updated build/php submodule to pmmp/php-build-scripts@3a3e3495c3 2020-09-03 14:53:23 +01:00
9365525efa ANTI CHEAT DOESN'T TRIP ON STAIRS ANYMORE 🎉
This commit fixes the 5+ years-old bug with the movement anti-cheat that everyone has complained about: sprinting on stairs causes rubberbanding.
This commit addresses this problem at long last, along with a handful of precursor commits that were necessary to fix this problem:
- dac76f0e0f
- 89fe8f7f10
- 2d77b1e364

Additionally, these changes now allow the anti-cheat to be accurate to at least 0.001 of a block, perhaps even better. I didn't commit a change to the threshold here, but it was instrumental to pinning down the exact nature of these bugs.

This closes #1475, at long last.
2020-09-03 14:27:11 +01:00
17bee5e349 Fixed crash when using strings for flatworld layers
I don't know why this didn't show up sooner.
2020-09-03 14:15:37 +01:00
c6e0753c3e clean up phpstan baselines 2020-09-02 15:04:37 +01:00
2ae7ba275b Updated Composer dependencies 2020-09-02 12:15:29 +01:00
6aa0a82341 Bump phpstan/phpstan-strict-rules from 0.12.4 to 0.12.5 (#3807) 2020-09-01 10:00:39 +00:00
0af08a7375 Call BlockGrowEvent when sugarcane grows (#3780) 2020-08-31 16:03:38 +01:00
81c1613e5d StupidJsonDecodeTest: added a callable prototype
for some reason this causes a new error to be reported which previously didn't show. I have no idea why.
2020-08-31 13:45:46 +01:00
9cf8f608d8 Provide a default for health (#3806) 2020-08-30 21:50:11 +01:00
dd4f26a9cf Switch "Auto: Spam" trap to direct links (#3550) 2020-08-30 18:03:38 +01:00
f976545f56 Delete security-dos-vulnerability.md 2020-08-29 23:41:37 +01:00
9929fb0abd Create SECURITY.md 2020-08-29 23:40:47 +01:00
37e453b875 Updated composer dependencies 2020-08-28 23:34:32 +01:00
b7578fef9c Fixup TesterPlugin to PHPStan standards 2020-08-28 21:17:21 +01:00
09eb904f6b fixed explicit-mixed errors exposed by upgrading pocketmine/nbt 2020-08-28 15:47:41 +01:00
b47d6bbc22 Bump phpstan/phpstan from 0.12.39 to 0.12.40 (#3800) 2020-08-27 11:45:20 +00:00
aa26ddf8b1 Bump phpunit/phpunit from 9.3.7 to 9.3.8 (#3799) 2020-08-27 11:44:54 +00:00
119c72980f Bump phpstan/phpstan from 0.12.37 to 0.12.39 (#3794) 2020-08-25 20:38:22 +00:00
eba888449d ExperienceUtils: handle an unhandled error condition explicitly
this would previously throw a TypeError on some negative numbers and crash. This should still crash, but this makes it explicit.
2020-08-25 21:28:29 +01:00
dac76f0e0f Player: reset ySize when syncing movement 2020-08-23 18:31:25 +01:00
89fe8f7f10 Entity: shift BB back down after trying to auto-step
this fixes bugs where the entity would jump in the air when walking on blocks like carpet. It also fixes a lot of the issues with stepping in the anti-cheat, allowing to reduce the error tolerance on movement processing.
2020-08-23 17:54:48 +01:00
2d77b1e364 Entity: fixed recalculateCollisionBox not taking ySize into account
this was causing the movement anti-cheat to shit itself after the first movement because it used setPosition() on the player if the position wasn't exactly perfect (which obviously it never is perfect, because of fp rounding errors).
2020-08-23 17:51:36 +01:00
e59a4296f8 LevelDB: fixed crash on corrupted level.dat 2020-08-22 19:36:22 +01:00
a9871a6c1a Merge branch 'stable' into master
# Conflicts:
#	composer.json
#	composer.lock
#	resources/vanilla
2020-08-21 22:14:49 +01:00
220c6dd41b Updated composer dependencies 2020-08-21 22:13:46 +01:00
6856761946 Updated composer dependencies to fix some 7.4 issues 2020-08-21 22:09:26 +01:00
4ed59ea43f updated DevTools submodule to pmmp/DevTools@75c2774cc7 2020-08-21 21:46:28 +01:00
3042c74aa5 Merge branch 'stable' into master 2020-08-21 21:41:29 +01:00
ebd20f997d Merge commit 'e80ad22702f87f4a006ab16af3b46baae0490856' into master
# Conflicts:
#	build/php
#	resources/vanilla
#	src/pocketmine/Player.php
#	tests/plugins/DevTools
2020-08-21 21:39:17 +01:00
1ed36573a1 BlockLegacyMetadata: added some coral constants 2020-08-21 17:46:44 +01:00
4fe3401182 travis: moved PHP-specific configuration to its own YAML file
this allows it to be imported by other repos using the same config (for example plugins needing PHPStan analysis) without them needing to copy paste big blocks of shit every time something little changes.
2020-08-21 17:42:47 +01:00
e80ad22702 Updated build/php submodule 2020-08-21 00:34:10 +01:00
c22ab37372 Player: pre-cancel PlayerInteractEvent when left-clicking a block in spectator mode
fixes #3778
2020-08-20 23:43:52 +01:00
1f9d672cfc Updated DevTools submodule to release 1.14.1 2020-08-20 16:49:49 +01:00
974cbae725 travis: added PHP 7.4 2020-08-20 16:21:58 +01:00
ddc5694b70 remove file accidentally committed in 0b05fd1987 2020-08-17 20:25:30 +01:00
40d49b88dd EntityFactory: remove requirement for $className as return type on creation funcs
since the removal of EntityFactory::create() this isn't needed anymore, since these creation functions are only used for creating entities loaded from disk.
2020-08-17 13:20:34 +01:00
bf401421fa Implemented bamboo (#3762) 2020-08-16 20:39:51 +01:00
62394811e3 Merge branch 'stable' into master
# Conflicts:
#	resources/vanilla
#	src/world/Explosion.php
2020-08-16 01:00:04 +01:00
0506905875 clean up unused imports 2020-08-16 00:58:55 +01:00
b53f88027e Explosion: fixed blocks getting updated too early
this bug became painfully obvious when testing bamboo. Detonating TNT near tall bamboo canes would result in bamboo canes not deleting themselves in some circumstances, because the non-destroyed parts of the cane would be updated before their supporting block was deleted, and subsequently would not be re-updated afterwards.
I think this bug should also reproduce with cacti, but I have not tested.
2020-08-16 00:09:17 +01:00
a35ca1fa71 Merge branch 'stable' into master 2020-08-15 20:32:14 +01:00
ec1adb5886 Updated build/php submodule to pmmp/php-build-scripts@7a0fbfa9bb 2020-08-15 20:24:12 +01:00
93fdc1cb96 Updated composer dependencies 2020-08-15 20:23:42 +01:00
9a0f723dff Updated composer dependencies 2020-08-15 20:19:37 +01:00
ab2003a85d Merge branch 'stable' of https://github.com/pmmp/pocketmine-mp into stable 2020-08-15 20:17:04 +01:00
4befd9095a Updated build/php submodule to pmmp/php-build-scripts@f93a6f0e31 2020-08-15 20:16:29 +01:00
6920deac2c BlockFactory: regenerated TODO lists 2020-08-15 19:47:38 +01:00
06623d788a Bump phpunit/phpunit from 9.3.5 to 9.3.7 (#3771) 2020-08-15 17:46:26 +00:00
730ee74a65 Use objects for internal structures created in TextFormat::toJSON() (#3747) 2020-08-15 18:30:26 +01:00
700e0afee0 Updated build/php submodule to pmmp/php-build-scripts@cfc425ad63 2020-08-11 21:39:15 +01:00
4b9712fdee fixed changelog typo 2020-08-11 21:37:15 +01:00
dbd015b866 3.15.1 is next 2020-08-11 21:26:12 +01:00
a498b0415a Release 3.15.0 2020-08-11 21:26:12 +01:00
5b01cf72dd Data sync and version bump for 1.16.20
this version doesn't change any packets as far as I know, but it does change some packet content (most notably, some blockstates changed, which are troublesome when not in sync).
2020-08-11 21:17:11 +01:00
ec21c2baa0 Merge branch 'stable' of https://github.com/pmmp/pocketmine-mp into stable 2020-08-11 21:07:06 +01:00
11a0d9b502 3.14.4 is next 2020-08-11 21:06:38 +01:00
a7fc245291 Release 3.14.3 2020-08-11 21:06:38 +01:00
6db51e2380 Updated CONTRIBUTING.md RFC label name 2020-08-11 12:35:12 +08:00
d6f35f2342 Bump phpunit/phpunit from 9.3.2 to 9.3.5 (#3764) 2020-08-10 19:15:28 +00:00
d1df72ec78 Bump phpstan/phpstan from 0.12.36 to 0.12.37 (#3765) 2020-08-10 19:10:19 +00:00
98db4c5200 Merge branch 'stable' into master
# Conflicts:
#	.gitmodules
#	composer.lock
#	resources/vanilla
#	src/network/mcpe/protocol/PlayerAuthInputPacket.php
#	src/pocketmine/Player.php
#	src/pocketmine/network/mcpe/protocol/LoginPacket.php
2020-08-10 17:55:49 +01:00
9bd6d5c67e Updated travis pthreads to pmmp/pthreads@45579e1e62 2020-08-10 17:45:06 +01:00
aaa23361d1 updated devtools links 2020-08-10 17:32:09 +01:00
691d92a959 moved tests/plugins/PocketMine-DevTools -> tests/plugins/DevTools 2020-08-10 17:29:44 +01:00
50101663f2 Use the up-to-date git submodule urls 2020-08-10 17:25:48 +01:00
192e31a397 Move code & docblock generation methods out of RegistryTrait
this allows generating a docblock / code for a registry without the class needing to exist or be populated yet, which makes code generation significantly less cumbersome.
2020-08-07 21:43:19 +01:00
ff2a3baa8e Implemented Jukebox & Records (#3742)
Co-authored-by: Dylan K. Taylor <odigiman@gmail.com>
2020-08-07 21:07:58 +01:00
e369966890 updated composer.lock 2020-08-07 20:00:12 +01:00
63f57841de PlayerAuthInputPacket: fixed yaw/pitch being the wrong way round, closes #3757 2020-08-07 19:50:49 +01:00
ac3bba0a11 Bump phpunit/phpunit from 9.2.6 to 9.3.2 (#3758) 2020-08-07 15:38:57 +00:00
2545897fc2 HorizontalFacingTrait: use a cheaper check for horizontal facing 2020-08-06 14:53:51 +01:00
2b044195a5 Update for pocketmine/math Axis refactor 2020-08-06 14:38:54 +01:00
7399e6944e Consistent fluency for block property setters 2020-08-06 13:46:08 +01:00
3d4470ed8d added nether quartz ore to nether generation 2020-08-06 13:23:03 +01:00
7bcfece11e Flat: use block names instead of legacy block IDs for hardcoded preset 2020-08-06 12:58:49 +01:00
de9856151a Flat: remove useless field 2020-08-06 12:58:08 +01:00
aa682a865e Allow injecting arbitrary preimage block for ore generation
this will be useful for nether ore generation.
2020-08-06 12:46:07 +01:00
b725fcbdf2 IPlayer: remove circular dependency on Player
and remove useless Player->getPlayer()
2020-08-05 22:01:41 +01:00
56ae3d01da block: added HorizontalFacingTrait and AnyFacingTrait
these are primarily intended for deduplication of code and ability to cross-reference. Don't expect this API to remain the same.
2020-08-05 21:17:37 +01:00
060c300d50 Bed::setOccupied() no longer sets itself into the world
setting itself into the world is very annoying when trying to simply set up a blockstate.
2020-08-05 20:59:59 +01:00
1ff3df6ff0 Bump phpstan/phpstan-phpunit from 0.12.15 to 0.12.16 (#3753) 2020-08-05 19:49:04 +00:00
4e29b216bf Bump phpstan/phpstan from 0.12.35 to 0.12.36 (#3752) 2020-08-05 18:12:12 +00:00
809dad2ac8 Bump phpstan/phpstan-phpunit from 0.12.11 to 0.12.15
Bumps [phpstan/phpstan-phpunit](https://github.com/phpstan/phpstan-phpunit) from 0.12.11 to 0.12.15.
- [Release notes](https://github.com/phpstan/phpstan-phpunit/releases)
- [Commits](https://github.com/phpstan/phpstan-phpunit/compare/0.12.11...0.12.15)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-05 10:46:27 +00:00
e238d583b8 Bump phpstan/phpstan-strict-rules from 0.12.3 to 0.12.4 (#3748) 2020-08-05 10:38:00 +00:00
3f89bd7bff TaskHandler->getOwnerName() never returns NULL 2020-08-04 16:58:27 +01:00
8da7e789fd LoginPacket: protocol cannot be NULL 2020-08-04 16:55:47 +01:00
0766952f39 FINALLY, a usable new build of phpstan 2020-08-04 11:38:00 +01:00
eeee1fbe73 Updated composer dependencies 2020-08-04 11:32:25 +01:00
764f92c456 BlockLegacyIdHelper: fixed a mistake in exception message 2020-08-03 23:59:06 +01:00
35e8fd01ff phpstan: drop some obsolete level 8 baseline errors 2020-08-03 20:22:09 +01:00
abbc2b9494 phpstan: drop obsolete explict mixed ignoreError pattern
this got lost in merge resolution
2020-08-03 20:19:27 +01:00
e1d80f05b1 Merge branch 'stable' into master 2020-08-03 20:14:46 +01:00
46c224da86 phpstan: remove an obsolete ignored error pattern from explicit-mixed baseline 2020-08-03 19:54:53 +01:00
3c001b310f fix phpstan analyze failure 2020-08-03 19:54:14 +01:00
198a106b9f Merge branch 'stable' of https://github.com/pmmp/pocketmine-mp into stable 2020-08-03 19:37:30 +01:00
1f5e0bc96d Updated BedrockData submodule, new recipes.json format 2020-08-03 19:36:32 +01:00
164c1552d1 Add test to make sure DyeColorIdMap recognizes all colours
this will be useful for integrity testing if more colours get added.
2020-08-03 16:48:34 +01:00
41f7c07703 Entity: report the class in getSaveId() unregistered entity exception (#3744) 2020-08-03 00:20:28 +01:00
f0a0c9a85f Player: remove useless var 2020-08-02 23:49:07 +01:00
5b620d964e Do not assume the presence of a crafting transaction closing marker
fixes #3655, fixes #3241
instead of guessing where the end of the transaction is, we attempt validation after every piece of the transaction, with the assumption being that a crafting transaction will not validate until it's complete.
2020-08-02 23:37:33 +01:00
1525001565 protocol ItemStack: added equals() method to compare net itemstacks directly
this will be needed for more than just this little check once item NBT gets cleaned out properly, since we'll need to compare object equality by network layer stuff instead of internals (where different network objects might deserialize to the same internal items).
2020-08-02 23:22:39 +01:00
756840f11d Fixed matchItems corrupting CraftingTransaction internal state on repeated validation
This bug became apparent while developing a more robust fix for 1.16 crafting.
2020-08-02 23:07:47 +01:00
df2c3136c9 VersionString: added missing start anchor to regex 2020-08-02 21:10:47 +01:00
2e0f7102e8 ItemBlock: remove superfluous doc comments generated by PhpStorm 2020-08-01 16:06:38 +01:00
32134ef1ac make-release: remove extra newline 2020-08-01 16:06:05 +01:00
9873f53e0c make-release: added missing import 2020-08-01 16:02:42 +01:00
f4efaff73e phpstan: drop some obsolete baselined error patterns 2020-07-25 19:21:45 +01:00
1500668d4e imports cleanup 2020-07-25 19:21:22 +01:00
2c29634d03 Remove VERSION and GIT_COMMIT constants
these are now lazily computed in VersionInfo as needed.
2020-07-25 19:17:33 +01:00
2645b19617 Convert VersionInfo into a final class
this allows it to be loaded by the autoloader without additional changes.
2020-07-25 19:00:48 +01:00
5910905e95 PacketBatch::getPackets() may throw PacketDecodeException 2020-07-22 15:38:24 +01:00
8402465fd2 PacketBatch is now immutable 2020-07-22 15:37:06 +01:00
798efc370c PacketBatch: get rid of putPacket() 2020-07-22 15:24:08 +01:00
2fcee432c1 NetworkSession: store Packet[] for buffering instead of PacketBatch
this reduces memory allocations for buffering (in theory).
2020-07-22 15:18:01 +01:00
ed144a1709 remove unused imports 2020-07-21 19:29:12 +01:00
e3dce1f8bd Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/event/player/PlayerChatEvent.php
2020-07-21 19:28:00 +01:00
a6b5cddd5a remove unused import 2020-07-21 19:26:24 +01:00
93e6d7e1a2 thanks for nothing phpstorm 2020-07-21 19:23:30 +01:00
bc52a38922 Improved network bandwidth data collection 2020-07-21 19:21:27 +01:00
92afad5e6f Updated RakLib to pmmp/RakLib@6fbccdb6a7 2020-07-21 16:18:14 +01:00
ff54eae4b2 updated composer dependencies 2020-07-21 11:59:47 +01:00
977f9ec497 Merge branch 'stable'
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/VersionInfo.php
#	src/pocketmine/block/Podzol.php
2020-07-21 11:57:24 +01:00
5b9453af43 WhitelistCommand: fixed incorrect implode() parameter order
PHP allows this to work either way for legacy reasons, but glue-first is the canonical way for a long time.
2020-07-21 11:46:11 +01:00
213afa42dd BlockFactory: make registerElements() a bit less wide 2020-07-19 13:09:48 +01:00
1ba32c98c7 protocol: avoid potential constructor refactoring packet decode bug
if the order of the constructor parameters were changed, it would cause these statements to be reordered, causing packet fields to be decoded in the wrong order.
2020-07-17 23:19:33 +01:00
3e2cfd28cc ResourcePackManager: change validity check to is_string() 2020-07-17 23:07:37 +01:00
5f70b96081 ResourcePack: do not export getPath()
a resource pack is not required to come from a location on disk (although it's currently the only practical option).
2020-07-17 23:03:10 +01:00
915d63a2e8 Button: rename powered property to pressed 2020-07-17 14:54:51 +01:00
9872bb4cb8 Enchantment: remove dead classes 2020-07-17 14:41:04 +01:00
b09b619a30 updated VanillaBlocks 2020-07-17 14:23:32 +01:00
8bba25f4f5 Fix wrong hardness value for Podzol (#3709) 2020-07-16 22:07:41 +01:00
f9bd7016aa Bump phpstan/phpstan-strict-rules from 0.12.2 to 0.12.3 (#3705) 2020-07-16 15:24:42 +00:00
213406fc60 Bump phpunit/phpunit from 9.2.5 to 9.2.6 (#3701) 2020-07-14 16:44:35 +00:00
7ff6e5895e added missing 3.14.2 changelog 2020-07-13 11:55:08 +01:00
1050485164 MemoryManager: remove class name from object references
it's possible to see this information by looking up the hash, which it's necessary to do in order to see any interesting information anyway.
2020-07-13 11:51:25 +01:00
efd67a132e MemoryDump: fixed duplicated properties, reduce useless noise 2020-07-13 11:44:21 +01:00
46c4c65022 MemoryManager: remove duplicated information from memory dump 2020-07-13 11:10:22 +01:00
e199f403dc MemoryManager: remove useless information from object dumps 2020-07-13 11:08:03 +01:00
2e6b62fdec 3.14.3 is next 2020-07-13 10:46:58 +01:00
4fc5b9772a Release 3.14.2 2020-07-13 10:46:57 +01:00
d9c3ec5f91 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
2020-07-11 20:14:42 +01:00
5d4880b0a7 SendUsageTask: fixed json_encode() choking on player list keys 2020-07-11 20:14:04 +01:00
d3c90c4dce update block factory consistency check 2020-07-11 18:54:35 +01:00
217f9c574a Player no longer implements ChunkLoader
this stops plugins from misusing Player as a ChunkLoader in ways it doesn't know about, causing leaks and god knows what else.
2020-07-11 18:48:10 +01:00
180c0e4999 World: rely on Player being a ChunkListener instead of ChunkLoader
ChunkListeners are less dangerous, and also make more sense considering the usages.
Ideally we want to not have to care if a listener is a Player at all, but that's still some work away yet.
2020-07-11 18:20:32 +01:00
923ea46476 PlayerPreLoginEvent: implement Cancellable again 2020-07-11 17:47:53 +01:00
2226efd7a0 added base data handling for Lab Table, Compound Creator, Element Constructor and Material Reducer
these also have a blockentity which needs to be implemented as well.
2020-07-11 17:44:50 +01:00
81b38cda5d Removed setCancelled from Cancellable (#3685)
* Removed `setCancelled` from `Cancellable`

Before anyone screams, THIS CHANGE WILL NOT AFFECT MOST PLUGINS
(although it allows future changes to break some).

This commit rewrites the documentation of `Cancellable`,
clarifying the concept of "cancelled" from the perspective of the event
framework.

This commit also removes the `setCancelled` method from `Cancellable`.
This does not affect plugins using the (originally standard)
`setCancelled` method on events directly, since the implementation on
classes was not removed. On the other hand, it no longer requires
`Cancellable` events to implement this method, allowing flexibility on
cancelation conditions, e.g. subclasses may require additional
parameters for cancellation without needing to use hacks to check that
the user cancelled the event in the correct way.
2020-07-11 17:42:15 +01:00
d4f6dc8179 BlockFactory: make color block registration slightly less painful to look at 2020-07-11 10:50:02 +01:00
62815f6c9b Furnace: get rid of entirely unnecessary ItemFactory usage 2020-07-10 21:38:29 +01:00
9b52af62b6 Item: skip a step when decoding PC itemstacks 2020-07-10 21:32:39 +01:00
279abb871d Remove all usages of CompoundTag->hasTag()
in pretty much every case, these usages really wanted to read the tag's contents anyway, which can be combined with a getTag() and instanceof call for more concise and static analysis friendly code.
In the few cases where the tag contents wasn't needed, it still wanted to check the type, which, again, can be done in a more static analysis friendly way by just using getTag() and instanceof.
2020-07-10 21:01:43 +01:00
2b1a0e1e72 PlayerRespawnEvent: harden setRespawnPosition()
apparently plugins like to pass around positions which have null worlds, which aside from being quite stupid, also breaks a lot of stuff and makes it look like PM is to blame when it's just trying to make everything work the way it's supposed to ...
2020-07-10 20:37:45 +01:00
91b028c208 WorldManager: use ChunkSelector to find stuff to pre-generate 2020-07-10 20:06:26 +01:00
cd022f1592 EmotePacket: make FLAG_SERVER constant public 2020-07-10 20:02:32 +01:00
c762ec1319 Entity: removed unused field 2020-07-09 14:10:56 +01:00
c1a815a458 Sign (block): added setText() (#3100) 2020-07-09 13:43:42 +01:00
600ef033ab PlayerSkinPacket: added ::create() 2020-07-09 13:24:31 +01:00
b22cc4875e Player: Accept NBT data in constructor, instead of asking for it from the server directly
this allows custom implementations to provide custom data to the constructor (or none at all).
2020-07-09 13:09:46 +01:00
f2cf453cd0 World: remove one more unnecessary vector3 field mutation 2020-07-09 12:53:16 +01:00
9e1d9768f0 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
2020-07-09 12:37:50 +01:00
874fec0a35 Switch back to PM3 spawn-chunk handling, fix pre-spawn death bug caused by 939dfd9269, close #3513 (properly this time) 2020-07-09 12:35:45 +01:00
4ae3fd7734 Player: Reset spawn chunk send count if teleporting pre-spawn 2020-07-09 12:17:19 +01:00
36727aabf7 Extracted a ChunkSelector unit from Player
if anyone asks me why not use a static method, it's because I want to make this more dynamic going forward, and statics are anything but.
2020-07-09 11:42:12 +01:00
a5d77d5106 LevelDB: remove unused function 2020-07-08 23:24:54 +01:00
31fd427710 Entity: remove usages of Chunk->getX()/getZ() 2020-07-08 20:29:30 +01:00
92f6967665 Command: validate permissions, require permission registration in advance of commands using them
this fixes #3200.
This causes permissions to be registered before plugin load, which changes some behaviour, but after discussions on #internals-dev we couldn't see any reason to keep the behaviour the way it was, and several reasons to change it to be something like this.
2020-07-08 13:50:38 +01:00
6bca38999d scheduler: removing task IDs
These no longer serve any purpose that can't be replaced with a structure like Ds\Set, SplObjectStorage, or just using spl_object_id().
2020-07-08 12:01:48 +01:00
d738504e24 TaskScheduler: use a Ds\Set to index tasks internally
this removes all remaining use-cases for taskID.
2020-07-08 11:57:48 +01:00
dca4bf424e TaskHandler: change isQueued() to accept TaskHandler instead of int 2020-07-08 11:53:47 +01:00
a71b111b50 TaskScheduler: get rid of cancelTask()
developers should be using TaskHandler->cancel() instead.
2020-07-08 11:49:43 +01:00
da798817b5 Merge branch 'stable'
# Conflicts:
#	changelogs/3.14.md
#	resources/vanilla
#	src/VersionInfo.php
#	src/entity/Attribute.php
2020-07-08 11:46:02 +01:00
b2249f93c0 TaskHandler: bail if given a task that already has a handler
This fixes undefined behaviour when scheduling the same task twice. This is usually accidental and almost never desirable.
Note that this still allows a task to be scheduled again after it has
been cancelled; it only disallows scheduling a task multiple times
concurrently.

This commit will probably break MyPlot and other plugins that have
self-scheduling tasks, but as far as I can tell those use-cases should
be replaced with self-cancelling repeating tasks anyway.
2020-07-08 11:02:33 +01:00
303344783a CheckTestCompletionTask: use TaskHandler->cancel() 2020-07-08 10:57:20 +01:00
75e0844ff5 MainLogger: log stack traces with CRITICAL level
maybe this will get people to send the whole thing instead of just the error message? ...
2020-07-08 10:45:15 +01:00
18fabf5466 3.14.2 is next 2020-07-08 10:32:07 +01:00
2751c59979 Release 3.14.1 2020-07-08 10:32:07 +01:00
d99ffbd66c Attribute: register lava_movement attribute
this is purely to fix crashes when decoding net packets
2020-07-08 10:21:20 +01:00
b79aa04530 remove unused FileWriteTask 2020-07-07 21:21:13 +01:00
7106ff575c End abuse of PluginCommand by making it final
PluginCommand should be better-named CommandExecutorCommand or perhaps CallbackCommand. It's not supposed to be extended by plugins.
2020-07-07 19:42:47 +01:00
909f3f39de Block: get rid of getRuntimeId()
the runtime ID mapping should be non-global in case of multiple protocols.
2020-07-06 11:18:29 +01:00
ad99dc5884 ChunkSerializer micro optimisation: reduce indirections when writing runtime IDs 2020-07-05 22:00:42 +01:00
0188323d74 fixed a bunch of NBT-related phpstan level 8 errors 2020-07-05 21:01:13 +01:00
68c408268c Separate dye colour ID management from DyeColor enum 2020-07-05 19:04:22 +01:00
bf5da596f7 Get rid of WALL metadata mapping 2020-07-05 18:27:10 +01:00
79d8bf898a Moved glazed-terracotta ID-mapping table to BlockLegacyIdHelper 2020-07-05 18:20:41 +01:00
eddb2b7fdd Moved some legacyID mapping code to a separate BlockLegacyIdHelper
this makes the code more reusable and will facilitate getting rid of legacy IDs from within the core code.
2020-07-05 16:52:42 +01:00
2219f61ea0 BlockLegacyMetadata: added constants for chemistry table variants 2020-07-05 11:13:29 +01:00
ae179e5039 fix interacting with anvil & enchanting table inventories 2020-07-04 23:46:26 +01:00
d840e8c4d4 Merge commit 'a34f3261c'
# Conflicts:
#	resources/vanilla
#	src/event/entity/EntityExplodeEvent.php
#	src/pocketmine/event/block/SignChangeEvent.php
#	src/utils/Utils.php
2020-07-04 22:39:40 +01:00
c35a596079 Merge commit '8ce0022de'
# Conflicts:
#	resources/vanilla
#	src/network/mcpe/protocol/types/inventory/NetworkInventoryAction.php
2020-07-04 22:34:01 +01:00
991abe8864 Merge commit 'fb6491dde'
# Conflicts:
#	resources/vanilla
2020-07-04 22:25:56 +01:00
5cf74fc16b Merge commit '3b961d0e5'
# Conflicts:
#	resources/vanilla
2020-07-04 22:25:23 +01:00
76cf3b7aa5 Merge commit 'a60fc4cc2'
# Conflicts:
#	resources/vanilla
2020-07-04 22:24:33 +01:00
373783d99b Merge commit 'b747899fd'
# Conflicts:
#	resources/vanilla
2020-07-04 22:23:26 +01:00
740ed2013f Merge commit '57b6451e1'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/block/Ladder.php
2020-07-04 22:22:22 +01:00
172830fc44 Merge commit '8cf025a2d'
# Conflicts:
#	resources/vanilla
2020-07-04 22:20:42 +01:00
e9eadd3a26 Merge commit '8480ee82e'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
#	src/pocketmine/block/CraftingTable.php
2020-07-04 22:19:43 +01:00
a34f3261cb event: harden APIs that accept arrays
plugin devs can't be relied on to pass the proper types to these APIs, and when the wrong types get passed it makes type errors appear from inside the internals.
2020-07-04 21:55:23 +01:00
8ce0022de6 protocol: added UUInventorySlotOffset constants 2020-07-04 21:37:37 +01:00
1d18662d9b InventoryAction: replace isValid() with validate() which throws TransactionValidationException 2020-07-04 19:38:34 +01:00
fb6491ddeb BanListCommand: sort output into lexical order 2020-07-03 11:23:00 +01:00
3b961d0e5f WhitelistCommand: sort output of /whitelist list into lexical order 2020-07-03 11:19:23 +01:00
a60fc4cc28 ListCommand: sort output into lexical order 2020-07-03 11:15:31 +01:00
b747899fdd PluginsCommand: sort plugins list into lexical order 2020-07-03 11:13:32 +01:00
cf5e31c619 InventoryTransaction::execute() now throws exceptions instead of returning true/false 2020-07-01 14:08:28 +01:00
30591d047c PacketBatch: added a getPackets() method which encapsulates some logic 2020-07-01 13:38:06 +01:00
29612cded3 CraftingTransaction: make CraftingManager injectable
this becomes a bit easier to unit-test.
2020-07-01 13:38:06 +01:00
96541763f1 ConsoleCommandSender: inject Language via constructor 2020-07-01 13:38:05 +01:00
7f81507ea1 Add Releasable interface (#3664)
closes #3301
2020-06-30 21:09:10 +01:00
74a919353f Food: remove unused import 2020-06-29 22:52:04 +01:00
8b87cf73b9 Player->setSpawn() now accepts NULL (fallback to world spawn) 2020-06-29 22:51:02 +01:00
c0af05fcad phpstan: clean some errors from level 8 baseline 2020-06-29 22:42:46 +01:00
fc60abe5e5 Player: fixed a few phpstan level 8 warnings 2020-06-29 22:41:17 +01:00
2cd67aed72 Block: fixed crash on block factory clone 2020-06-29 22:40:35 +01:00
69fb2786c6 Player: fixed spawn position sticking to old world spawn when new world spawn is set
this will still take effect for preexisting data because the server will still see previously set spawns as custom, but for new players, their spawns will follow the world spawn unless they sleep in a bed.
2020-06-29 22:32:00 +01:00
da3f0752a6 Block: make getAllSides() and getHorizontalSides() use underlying Vector3 generators 2020-06-29 22:13:07 +01:00
8673a4872e InventoryEvent: fix wrong return type on getViewers() 2020-06-29 21:55:21 +01:00
670ad9eb9d Position: rename getWorldNonNull() to getWorld(), remove original getWorld() 2020-06-29 21:19:46 +01:00
fc22fd80d8 Eradicate remaining usages of Position->getWorld() 2020-06-29 21:03:55 +01:00
43ae1a5cb4 Block: make getAllSides() and getHorizontalSides() return generators 2020-06-29 20:54:51 +01:00
e61a08a56b Make SignText immutable 2020-06-29 20:18:10 +01:00
42f543b405 SignText: fixed crash when fetching lines of text if not all lines were provided to the constructor 2020-06-29 19:35:38 +01:00
dae2a4ffce SignText: added failing test case for index omission in constructor 2020-06-29 19:35:09 +01:00
0b05fd1987 added missing file 2020-06-29 18:54:47 +01:00
4fc134bd04 Separate item ID/meta to ItemIdentifier structure 2020-06-29 12:16:34 +01:00
cbfdfe87cf phpstan: drop some obsolete bootstrap constants 2020-06-28 19:40:10 +01:00
5a56f68991 Normal: make gaussian non-static
this allows each generator to (potentially) have a different gaussian curve for biome blending, as well as fixing a few phpstan level 7 errors.
2020-06-28 19:08:18 +01:00
db8e094d11 Extract a Gaussian unit from Normal generator 2020-06-28 18:45:52 +01:00
78c270a96e PopulationTask: check the correct instance 2020-06-28 18:45:51 +01:00
d585081c22 Separate consumable item interfaces from general consumable interfaces (#3595)
I wonder if there's a way to generalise item consuming beyond just eating/drinking. Stuff like lava bucket in a furnace needs the same kind of "leftover" logic.
2020-06-28 17:53:03 +01:00
01d221b794 imports cleanup 2020-06-28 17:50:49 +01:00
27511ac3ec updated network item ID constants 2020-06-28 17:37:51 +01:00
74b0c411c4 regenerated network entity ID constants 2020-06-28 17:37:25 +01:00
0d13a3fbdb NetworkSession: do not respond to death before player spawn, fixes #3513
there's a few changes that can be made to avoid this problem, the
primary one being to separate this API from NetworkSession and abstract
it away... but this is a reasonable, although not great, solution.
2020-06-28 17:35:12 +01:00
2104b2d32b Entity: defer kill() until post-construct
this fixes crashes and various bugs with death logic executing during the creation of entities, as well as an age-old Player crash after quitting the server when dying.
2020-06-27 23:28:03 +01:00
2a9586f6fd Explosion: fixed assert failure on explodeB() 2020-06-27 23:17:27 +01:00
87ce92d87e Entity: some cleanup of network position hacks 2020-06-27 23:16:04 +01:00
1f0ea0c2c7 Living: stop mutating Vector3 2020-06-27 21:51:42 +01:00
f1048aeaa3 Block: rework addVelocityToEntity() to avoid vector3 mutation 2020-06-27 21:38:24 +01:00
57b6451e16 Fix projectile motion being changed by the ladder, close #3602 (#3631) 2020-06-27 21:18:39 +01:00
8cf025a2df Default isVerified to true (#3644) 2020-06-27 21:17:34 +01:00
ff00595a48 Remove some more Vector3 mutations 2020-06-27 20:58:02 +01:00
8480ee82ea Player: track hardcoded window state, fixes crashes opening inventory on high-latency connections 2020-06-27 18:34:39 +01:00
c040248dbd Item: use static-analysis-friendly method for retrieving custom block data
fixes 2 phpstan level 8 errors
2020-06-27 13:46:04 +01:00
0000783926 Item: make nbt field non-nullable 2020-06-27 13:34:08 +01:00
7e331c590d Use static-analysis-friendly method for getting effects from EffectManager
fixes 5 phpstan level 8 errors
2020-06-27 13:09:05 +01:00
9e6f1c9a5a Living: check if damager is null before trying to use it 2020-06-27 13:09:05 +01:00
b7b5ea6fc9 Painting: use motive directly internally
this is cleaner and also fixes a phpstan level 8 error
2020-06-27 13:09:05 +01:00
3c1b8b83f5 HungerManager: use AttributeMap->mustGet()
fixes 2 errors on phpstan level 8
2020-06-27 13:09:05 +01:00
7e391a8123 Tile: use phpstan-friendly way to pass block NBT
fixes 1 level 8 error
2020-06-27 13:09:05 +01:00
9484220bd5 ContainerTrait: use a static-analysis-friendly way to read NBT, fixes 4 phpstan level 8 errors 2020-06-27 13:09:05 +01:00
f039a077cd ItemFrame: fixed a phpstan level 8 error 2020-06-27 13:09:05 +01:00
45b4e3cd7a EmoteListPacket can be ServerboundPacket (#3635) 2020-06-27 10:04:23 +01:00
9f323bc480 phpstorm, stop messing with my code pls 2020-06-26 22:25:09 +01:00
f23c3be7af Merge branch 'stable' 2020-06-26 22:21:56 +01:00
0caf99445b Merge commit '4fed08bcd4655d7eec8d2cdf88950789f99ed2ee'
# Conflicts:
#	resources/vanilla
2020-06-26 22:21:49 +01:00
7e6adc41f0 Merge 1.16 support into PM4 (with changes) 2020-06-26 22:21:09 +01:00
a6c1b7bf9c InventoryTransactionPacket: added missing field for encode 2020-06-26 20:57:48 +01:00
5aefdda942 Merge commit 'c616d9bb7c1335f84808bed9c8eef183ad163679'
# Conflicts:
#	resources/vanilla
#	src/VersionInfo.php
2020-06-26 19:19:54 +01:00
18f04d6d96 Merge commit '3ecae0db1964562a8a13346df3593744d2288b81'
# Conflicts:
#	resources/vanilla
2020-06-26 19:19:20 +01:00
9887a8b778 Merge commit 'c5bbb2bcbc4ecc8bcfd9bfaefd27c1b51e482d77'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
#	src/pocketmine/network/mcpe/protocol/InventoryTransactionPacket.php
2020-06-26 19:18:58 +01:00
fa0d6f4bd0 Merge commit '24a28897583ca54730c689bec3ca14fc270e8ea4' 2020-06-26 19:17:13 +01:00
05bd92a94b Merge commit '60b26a7ea8939a85db9af0a99dd5a4b13e1a562d'
# Conflicts:
#	resources/vanilla
#	src/network/mcpe/protocol/serializer/PacketSerializer.php
2020-06-26 19:16:53 +01:00
94ad0cd3f3 Merge commit '22b52f03d12fb82b4c8cd16ef6b0d2c8cb44f9f5'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
2020-06-26 19:15:18 +01:00
a8180cdf0b Merge commit 'df76c02e7ac3bfbde8ecb597653779e8e1516f58'
# Conflicts:
#	resources/vanilla
#	tests/phpstan/configs/l7-baseline.neon
2020-06-26 19:14:25 +01:00
d52ae120d4 Merge commit 'd343187e58e02c37903a0a93fb22ad9e9cbcdea6'
# Conflicts:
#	resources/vanilla
#	tests/phpstan/configs/l8-baseline.neon
2020-06-26 19:06:46 +01:00
ac20e0b005 Merge commit 'c5ad127854eb2618a2cc417c301a15963314be12' 2020-06-26 19:01:08 +01:00
9fd9428377 Merge commit '0f6dc9082a781fcc6f70f3d3e05bd261c6f6c203'
# Conflicts:
#	composer.lock
#	resources/vanilla
2020-06-26 18:49:11 +01:00
111f4b3778 Merge commit '2b6dcbc2e2f1dc8d629225c19cbcedfb9ae969c4'
# Conflicts:
#	resources/vanilla
2020-06-26 18:46:29 +01:00
abe4f1bf25 Merge commit '763c8ebfe3bb8a597768d86040fee130c8fc7ab8'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Worker.php
#	src/thread/CommonThreadPartsTrait.php
2020-06-26 18:46:01 +01:00
b8bbfdb181 Merge commit 'c572e9bb6a787d0573e7999b38f4651fc48cec58'
# Conflicts:
#	resources/vanilla
#	tests/phpstan/configs/l7-baseline.neon
2020-06-26 18:43:43 +01:00
17054e1001 Merge commit '89521f166d8b43f2fd2af99f367888a34b44c492'
# Conflicts:
#	resources/vanilla
#	src/world/Explosion.php
2020-06-26 18:42:30 +01:00
c267137fde 3.14.1 is next 2020-06-26 14:19:02 +01:00
461bc94236 Release 3.14.0 2020-06-26 14:19:02 +01:00
4fed08bcd4 ProtocolInfo: fixed version number 2020-06-26 14:15:58 +01:00
e990c5a0a5 Protocol changes for 1.16.0 2020-06-26 14:06:41 +01:00
d8a8f5b77a phpstan: ignore a new error caused by 52fd1a8c1d 2020-06-26 13:54:30 +01:00
c616d9bb7c 3.13.2 is next 2020-06-26 12:31:56 +01:00
81051441ba Release 3.13.1 2020-06-26 12:31:56 +01:00
3ecae0db19 WindowTypes: fill in a couple of blanks 2020-06-26 12:04:11 +01:00
c5bbb2bcbc Move crafting action detection from InventoryTransactionPacket to Player 2020-06-26 11:59:30 +01:00
24a2889758 NetworkInventoryAction does not require an InventoryTransactionPacket 2020-06-26 11:51:06 +01:00
60b26a7ea8 NetworkBinaryStream: unknown byte preceding NBT is a version, not a count 2020-06-26 11:47:08 +01:00
22b52f03d1 Player: fixed formatting error in InteractPacket debug message 2020-06-26 11:44:41 +01:00
df76c02e7a Explicitly release server.lock file when shutdown the server. (#3619)
Previously, this relied on PHP itself to release locks during the resource destructor phase during process exit, but sometimes it doesn't for god knows what reason. This change makes the lock file get explicitly released before the process dies.
2020-06-26 11:41:39 +01:00
d343187e58 phpstan: drop 2 obsolete level 8 error patterns fixed by 763c8ebfe3 2020-06-23 12:57:25 +01:00
c5ad127854 BaseInventory: mark eventProcessor as nullable, fixes a phpstan level 8 error 2020-06-23 12:55:06 +01:00
0f6dc9082a lock phpstan at 0.12.29
0.12.30 starts reporting non-ignorable errors for overriding Thread::start() due to outdated stubs for pthreads that I can't replace
2020-06-22 20:57:12 +01:00
2b6dcbc2e2 BaseLang: fixed passing onlyPrefix to str_replace()'s count reference parameter 2020-06-22 20:34:23 +01:00
52fd1a8c1d CommandSender: export getLanguage()
this currently serves as a proxy to the server main language, but it can be used by third party implementations to choose a non-Server language.
2020-06-22 20:05:23 +01:00
097fc7e6cb phpstan: clean out some more dead error patterns 2020-06-22 19:59:57 +01:00
5c3d39f4e2 phpstan: clean out some level 8 error patterns that no longer apply 2020-06-22 19:56:00 +01:00
137605ab8c Position: make World constructor parameter required 2020-06-22 14:15:27 +01:00
5e0d635562 Resource packs: modules field is required in manifest.json 2020-06-21 23:19:15 +01:00
763c8ebfe3 Thread/Worker: drop nullability flag from start() (fixed in pthreads 3.2.0, which we require as a minimum) 2020-06-21 19:07:01 +01:00
c572e9bb6a phpstan: regenerate l7 baseline 2020-06-21 18:58:41 +01:00
a920baa295 resource packs: use JsonMapper for manifest parsing 2020-06-21 18:47:27 +01:00
89521f166d Explosion: account for multi-block structures, fixes #2767 2020-06-21 17:28:38 +01:00
1ef6e5e17b TileFactory now only manages loading tiles from NBT, not direct creation
my objective is to make this use proper constructors like entities, but there's a couple of obstacles to get around first.
2020-06-21 00:47:02 +01:00
1f90aa07aa Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/command/defaults/TeleportCommand.php
#	src/pocketmine/event/entity/EntityDespawnEvent.php
#	src/pocketmine/event/entity/EntityInventoryChangeEvent.php
#	src/pocketmine/event/entity/EntityLevelChangeEvent.php
#	src/pocketmine/event/entity/EntitySpawnEvent.php
#	tests/phpstan/configs/actual-problems.neon
2020-06-21 00:30:45 +01:00
49d3a42120 phpstan: make EntityEvent generic, fix a bunch of 'actual-problems' ignored errors 2020-06-21 00:27:32 +01:00
c523595e85 Rewrite TeleportCommand (sadly I can't make this commit any smaller)
this pile of shit was overdue a rewrite. The new version is much easier to understand.
2020-06-21 00:04:18 +01:00
7c7e4f2093 WhitelistCommand: fixed silence on unknown subcommand 2020-06-20 23:05:39 +01:00
88c1014f03 TimingsCommand: fixed silence when using a nonexisting subcommand 2020-06-20 23:04:08 +01:00
a16de8747e Explosion: stop using Vector3->setComponents()
this kills two birds with one stone: this inlined version of the logic should be faster than the vector-abusing version.
2020-06-20 22:19:37 +01:00
bf5c06f285 World: get rid of temporalPosition too (entirely unused) 2020-06-20 21:45:35 +01:00
fc7672c6ba World: remove temporalVector (premature cold path optimisation again) 2020-06-20 21:44:05 +01:00
80e150c803 Entity: get rid of temporalVector mutation
except for checkBlockCollision, these are all cold paths ... this gets us one step closer to immutable Vector3
2020-06-20 21:41:19 +01:00
42637f97c6 Liquid: eliminate some unnecessary Vector3 field mutations 2020-06-20 21:32:24 +01:00
d38c17835d Properly switch to string entity IDs 2020-06-20 13:43:31 +01:00
a988578ee0 protocol: move PotionType and PotionContainerChange recipes to types/recipe namespace 2020-06-20 11:43:47 +01:00
0784bfa2fb phpstan: drop another pattern that was fixed by recent changes 2020-06-20 11:30:14 +01:00
032dc57090 phpstan recognizes the existence of parallel\bootstrap now 2020-06-20 11:29:45 +01:00
6be56de3ed clean some newly fixed errors from phpstan baselines 2020-06-20 11:24:39 +01:00
d5db163208 protocol: added proper object wrappers for gamerules 2020-06-20 11:24:39 +01:00
d2089afbc3 ItemBlock: get rid of -1 meta check (meta is never -1 in this code path now) 2020-06-20 09:52:02 +01:00
62e7b0e2b1 (Splash)Potion: do not assume that META == potion ID
it probably will be, but meta might not be accessible anymore soon.
2020-06-20 09:31:06 +01:00
d62d0762ff item: remove some unnecessary CompoundTag usages 2020-06-19 22:59:19 +01:00
4e8e10ca45 EntityFactory: remove obsolete indirection (class mappings are redundant here now) 2020-06-19 22:18:42 +01:00
0a43fd816c EntityFactory: drop unnecessary @param 2020-06-19 22:10:35 +01:00
47baaf4c72 move NBT helper functions from EntityFactory to EntityDataHelper 2020-06-19 22:04:36 +01:00
1a3445f4b5 EntityFactory: drop automatic provisioning of short class name as save ID 2020-06-19 22:03:22 +01:00
012acdd4cb move runtime entity ID counter from EntityFactory back to Entity
EntityFactory is specialized for the purpose of deserializing data from worlds, and runtime ID assignment isn't related.
2020-06-19 21:55:49 +01:00
6d3750994b EntityFactory: remove dead function 2020-06-19 21:54:23 +01:00
954e8e6e6f update pocketmine/math dependency 2020-06-19 11:33:10 +01:00
fb4a99a0ef Position: x,y,z parameters are now mandatory 2020-06-19 11:21:47 +01:00
9f89f2887a Location: x,y,z parameters are now mandatory 2020-06-19 11:19:05 +01:00
4b0bf34adb Location: add native typehints 2020-06-19 11:17:20 +01:00
60a6b4b10d Entity: use EntityFactory helper function to deserialize Motion 2020-06-19 10:51:27 +01:00
4b528aa637 NBT is no longer needed to create an entity
it's still able to be provided, but shouldn't be needed in the majority of cases (constructor args and/or API methods should be sufficient).
2020-06-19 10:51:27 +01:00
0a1bb0041b Player: avoid using NBT for onGround hack 2020-06-19 10:51:27 +01:00
1205432c34 Extract mandatory parameters into constructor parameters
the goal is obviously to ditch NBT entirely here, but there's more work to be done before that becomes possible.
2020-06-19 10:51:27 +01:00
3f135da704 Simplify motion handling in ProjectileItem 2020-06-19 10:51:27 +01:00
6a26c0bebf EntityFactory now exclusively handles loading data from disk
this commit removes the ability to replace centrally registered entity classes in favour of using constructors directly.
In future commits I may introduce a dedicated factory interface which allows an _actual_ factory pattern (e.g. factory->createArrow(world, pos, shooter, isCritical) with proper static analysability) but for now it's peripheral to my intended objective.
The purpose of this change is to facilitate untangling of NBT from entity constructors so that they can be properly created without using NBT at all, and instead use nice APIs.

Spawn eggs now support arbitrary entity creation functions like EntityFactory does, allowing much more flexibility in what can be passed to an entity's constructor (e.g. a Plugin reference can be injected by use()ing it in a closure or via traditional DI.
2020-06-19 10:51:27 +01:00
72a7fc68c1 First look at making entity creation closure-driven
this allows doing stuff like injecting plugin references to entity constructors for now. I want to make this more flexible still, but I've done about as much as I feel like doing today and don't want this disappearing into a stash to never be seen again.
2020-06-19 10:51:27 +01:00
3bdd9ee860 phpstan: drop a bunch of error patterns that don't appear on 0.12.29+ 2020-06-19 10:49:21 +01:00
64e9647334 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/network/mcpe/convert/LegacySkinAdapter.php
#	tests/phpstan/configs/check-explicit-mixed-baseline.neon
#	tests/phpstan/configs/phpstan-bugs.neon
2020-06-19 10:48:27 +01:00
e32180ce93 phpstan: drop an obsolete phpstan-bugs ignoreError 2020-06-19 10:41:41 +01:00
ced89add3c Human: remove dead function 2020-06-19 01:13:00 +01:00
cf85857660 Entity: remove duplicated code from saveNBT() 2020-06-19 01:07:18 +01:00
0ae357cf8f ProjectileItem: get NBT as far away as possible 2020-06-18 20:25:19 +01:00
e105578be0 LegacySkinAdapter: an extra check for resourcePatch (fixes 3 phpstan explicitMixed errors) 2020-06-18 20:08:38 +01:00
b3df5f4e95 CS: strip unneeded phpdoc 2020-06-18 20:01:49 +01:00
11eb1f1c5e imports cleanup 2020-06-18 20:01:19 +01:00
44814a8421 AutoUpdater: remove useless check (details_url is mandatory) 2020-06-18 19:06:42 +01:00
98f0447912 AutoUpdater: use JsonMapper to handle API response information 2020-06-18 19:03:11 +01:00
2687e63645 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/block/Cake.php
2020-06-18 18:10:27 +01:00
a9d98bdf73 phpstan: baseline our way into checkExplicitMixed territory 2020-06-18 18:07:21 +01:00
755e53cd71 JwtUtils: added a split() function to reduce code duplication 2020-06-18 12:05:54 +01:00
222399d178 EncryptionContext: fix exception message 2020-06-18 11:52:05 +01:00
d931a5bcc0 phpstan: drop an obsolete level 7 ignoreErrors pattern 2020-06-18 11:51:07 +01:00
95114dcc1e EncryptionContext: fixed a phpstan level 7 error (openssl_digest() might return false for god knows what reason) 2020-06-18 11:50:43 +01:00
edc3156bea Rename NetworkCipher -> EncryptionContext 2020-06-18 11:37:53 +01:00
c601352777 Fixed wrong meta value when pick cake block. (#3593) 2020-06-18 11:14:57 +01:00
82b3e3398b make more use of igbinary_serialize() and igbinary_unserialize() 2020-06-17 23:03:03 +01:00
6f4d4be3da InGamePacketHandler: handle InvalidSkinException thrown by SkinAdapter::fromSkinData() 2020-06-17 22:31:44 +01:00
05615b3eb7 ClientDataToSkinDataHelper: move safeB64Decode to its own function 2020-06-17 22:27:13 +01:00
e6a3f7baa2 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
2020-06-17 22:23:17 +01:00
77c71e22b2 SkinAdapter::fromSkinData() may now throw InvalidSkinException
fixes a rogue TODO in LegacySkinAdapter and invalid skins maybe showing up as Steve instead of getting kicked off the server
2020-06-17 21:44:22 +01:00
a686840e5e RuntimeBlockMapping: fixed palette cache never being initialized
I must have been very tired when I wrote this code
2020-06-17 21:33:56 +01:00
333ed8ed2f RuntimeBlockMapping: remove unnecessary nullable flag 2020-06-17 21:32:51 +01:00
715fca8986 LoginPacketHandler: use playerInfo directly again, fix another 2 PHPStan level 8 errors 2020-06-17 21:30:34 +01:00
eefb6ae8e7 LoginPacketHandler: use reference to new PlayerInfo directly, fixes a PHPStan level 8 error 2020-06-17 21:29:16 +01:00
7558f2cb12 regenerated phpstan level 8 baseline 2020-06-17 21:27:51 +01:00
503782d67c moved skin-parsing code from LoginPacketHandler to its own dedicated helper class 2020-06-17 21:24:12 +01:00
55e6b2dfbc Merge commit '1c13ba565660e0985c08f2c6b59e26f8216f87e4'
# Conflicts:
#	resources/vanilla
#	src/network/mcpe/protocol/serializer/PacketSerializer.php
2020-06-17 21:14:04 +01:00
5c94c6992d Merge commit 'f970be0e4ddf90e64c2e87cc6b2123aa933b3ab1'
# Conflicts:
#	resources/vanilla
2020-06-17 21:12:46 +01:00
6a8bb89734 Merge commit '11a3f9f1b906d0a73adb5a81a6eff120b56cf6fa'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/network/mcpe/VerifyLoginTask.php
2020-06-17 21:12:27 +01:00
8cabab20e3 Merge commit '09771849aefb70bc29202b160f65723cf926c974'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/network/mcpe/VerifyLoginTask.php
2020-06-17 21:10:59 +01:00
543023793c Merge commit '57a310230acd8b13e96fa4f24dbdabb19927b483'
# Conflicts:
#	resources/vanilla
2020-06-17 21:04:23 +01:00
d58ea80dca Merge commit '130c55d9f1c3b350c2767f7656366e08a63cf1ad'
# Conflicts:
#	resources/vanilla
#	src/network/mcpe/protocol/serializer/PacketSerializer.php
#	src/network/mcpe/protocol/types/entity/EntityLink.php
#	tests/phpstan/configs/l8-baseline.neon
2020-06-17 21:03:45 +01:00
1c13ba5656 Avoid parameter ordering bugs during packet decoding
A PhpStorm refactor could have side effects on code that directly reads stuff from the packet input stream in the arguments block, because those calls will get moved into a different order if the constructor gets refactored. This would, obviously, break packet decoding, so that's something we should avoid and really should not encourage.
2020-06-17 21:01:01 +01:00
7c79a28fdb Merge commit '2712befa82dc92fe26d2b913a47200ad84927799'
# Conflicts:
#	resources/vanilla
#	tests/phpstan/configs/l8-baseline.neon
2020-06-17 20:49:46 +01:00
fb059cda69 Merge commit 'a4e250a3e61cbf1e75fe2785e71158f16a4a9039'
# Conflicts:
#	resources/vanilla
2020-06-17 20:48:19 +01:00
8d537eaae8 Merge commit '23b97d8e2dca50cca77061c1080911ab610fa708'
# Conflicts:
#	resources/vanilla
#	tests/phpstan/configs/l8-baseline.neon
2020-06-17 20:47:51 +01:00
f1fd8a13e9 Merge commit '1fb5043eb1b495e6926caecf3fb493837724c770'
# Conflicts:
#	resources/vanilla
#	tests/phpstan/configs/l8-baseline.neon
2020-06-17 20:46:18 +01:00
d310c8b782 Merge commit 'b0b1b29de4d4cbf60ca54d9043f01c9b2b21f136' 2020-06-17 20:44:32 +01:00
7e6a7d4611 Merge commit '1c3b641e37471833523f50f818571f25f85a52f9' 2020-06-17 20:43:57 +01:00
a2677eba02 Merge commit 'f3063e797fab56ff8d0213c8e5a3904085a6eb79'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/level/format/io/ChunkUtils.php
2020-06-17 20:43:30 +01:00
d2130265f8 Merge commit '8dcc88712c6b8a4d4a0c6be2f6b908ae85378209'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/level/format/io/ChunkUtils.php
#	tests/phpstan/configs/l7-baseline.neon
2020-06-17 20:42:28 +01:00
921aa091e0 Merge commit '04191ec44a00dd058f5d7e9e315d451e44285494'
# Conflicts:
#	resources/vanilla
#	tests/phpstan/configs/l7-baseline.neon
2020-06-17 20:40:12 +01:00
14d3e5ce27 Merge commit '62ea7c93a9ba1e71bef868efefdd9cc6dcc84a08'
# Conflicts:
#	resources/vanilla
#	src/entity/Skin.php
#	src/item/InvalidSkinException.php
2020-06-17 20:34:19 +01:00
f970be0e4d SkinImage: 128x64 is not a valid classic skin size
MC itself doesn't accept classic skins of this size.
2020-06-17 20:31:28 +01:00
09909f7af8 Merge commit 'cf06b5b8cffb4ee3a4c1e88b7be9e35fca74a89e' 2020-06-17 19:20:53 +01:00
6d63c9bf43 Merge commit 'a8ec51daacaef9113b17e3fc79c0bdcaf1c99df9' 2020-06-17 19:20:30 +01:00
57908586bd more jsonmapper models for login 2020-06-17 19:10:27 +01:00
11a3f9f1b9 VerifyLoginTask: fast-fail by checking header x5u before verifying signature
this is less costly, although it doesn't make any difference except in invalid cases.
2020-06-17 17:52:19 +01:00
09771849ae VerifyLoginTask optimisation: do not copy the entire LoginPacket into the worker thread
this is especially bad considering the fact that the cached buffer is copied. That said, it's only a few kilobytes so it's not a huge problem, but nonetheless...
2020-06-17 17:46:22 +01:00
4bb93eeca7 updated composer dependencies 2020-06-17 14:32:57 +01:00
506f98efc4 Eliminate usages of BaseNbtSerializer->readCompressed() and BaseNbtSerializer->writeCompressed() 2020-06-17 14:31:56 +01:00
3cdf808da1 NetworkNbtSerializer: do not assume that this format is related to the disk little-endian format 2020-06-17 13:55:29 +01:00
76e15016a2 updated composer dependencies 2020-06-17 13:51:14 +01:00
c618932d25 Eliminate usages of BinaryStream->setBuffer() and BinaryStream->reset() 2020-06-17 13:49:43 +01:00
893f7cb6ef fix crash whn player joins in spectator mode 2020-06-17 12:39:54 +01:00
9c46a1f141 Rename Packet->getBinaryStream() -> Packet->getSerializer() 2020-06-17 11:33:59 +01:00
6c096c44aa Rename NetworkBinaryStream -> PacketSerializer 2020-06-17 11:31:13 +01:00
c6557f0222 protocol: added a FixedItemIds class (this is fully auto-generated, unlike the one provided by the API)
this may be different from the IDs exposed on the API and shouldn't be used for anything outside the protocol.

TODO: we need to review the dynamicness of item numeric IDs and find out if it's possible for them to change based on StartGamePacket content. If they can, we might need to change this.
2020-06-17 11:06:26 +01:00
57a310230a ScoreboardIdentityPacketEntry: added missing field default 2020-06-15 23:59:53 +01:00
130c55d9f1 EntityLink: remove rogue default ctor parameters 2020-06-15 23:58:11 +01:00
2712befa82 SkinData: fixed capeImage type violation (doesn't accept null) 2020-06-15 23:51:48 +01:00
a4e250a3e6 TextFormat: improved exception messages for PCRE failures 2020-06-15 23:43:01 +01:00
23b97d8e2d TextFormat: wrap all preg_replace() usages in a type-safe exception-throwing version
fixes 3 phpstan level 8 errors
2020-06-15 23:31:46 +01:00
1fb5043eb1 build/server-phar: fixed a phpstan level 8 error 2020-06-15 23:16:40 +01:00
b0b1b29de4 Chunk: specify list<int> for heightMap 2020-06-15 23:07:35 +01:00
1c3b641e37 ChunkUtils: be more specific in extension stub too 2020-06-15 23:07:05 +01:00
f3063e797f ChunkUtils: provide a more explicit parameter type 2020-06-15 23:05:52 +01:00
8dcc88712c ChunkUtils: fixed phpstan level 7 type inference error 2020-06-15 23:04:12 +01:00
04191ec44a Rail: specify type for local static variable
fixes a phpstan level 7 error
phpstan doesn't make any assumptions about local static variable types because analysing them would require too much work, apparently.
2020-06-15 22:47:20 +01:00
a381fc8848 sync composer dependencies 2020-06-15 22:24:44 +01:00
62ea7c93a9 added a dedicated InvalidSkinException 2020-06-15 21:48:24 +01:00
cf06b5b8cf Player: explicitly check for false return of dataPacket()
fixes a phpstan error on l7
this won't ever actually be a problem, but this isn't obvious from the type system.
2020-06-15 21:24:19 +01:00
a8ec51daac Player: do not assign maybe-false result of json_encode() to ModalFormRequestPacket
fixes a phpstan error on l7
2020-06-15 21:22:33 +01:00
3294075aad LoginPacketHandler: use double quotes consistently
the mixture of single quotes and double quotes makes PHPStan type inference quietly not work, and reports an error here in checkExplicitMixed mode.
2020-06-15 20:31:09 +01:00
7d73630fb7 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/world/format/io/region/RegionGarbageMap.php
#	src/world/format/io/region/RegionLoader.php
#	tests/phpstan/configs/l7-baseline.neon
#	tests/phpunit/world/format/io/region/RegionLocationTableEntryTest.php
2020-06-15 20:10:15 +01:00
6a7b77fee2 first look at making region writes reuse old space 2020-06-15 18:36:54 +01:00
da42c8d020 Bump phpunit/phpunit from 9.2.2 to 9.2.3 (#3588) 2020-06-15 16:30:50 +00:00
b902f9ded0 RegionLoader: fixed 2 phpstan level 7 errors (eof reading region header) 2020-06-15 15:09:37 +01:00
9bb8a8f761 RegionLoader: added utility function getProportionUnusedSpace() 2020-06-15 13:49:03 +01:00
63b14a083c RegionLoader: added utility function generateSectorMap()
this proved very useful while debugging some internal issues.
2020-06-15 13:48:17 +01:00
627a7c951a RegionLoader: added missing const import 2020-06-15 13:46:03 +01:00
bb2685ca65 RegionLocationTableEntry: cap firstSector at 16777216
this is the biggest sector start that the location table can represent, due to the binary format. Larger values than this will overflow and cause corruption.
This provides an effective limit of 64 GB on region files.
2020-06-15 13:23:08 +01:00
d38709a7ae RegionLoader: remove unused variable 2020-06-15 12:26:20 +01:00
b559a65346 RegionLoader: account for possible corrupted header pointing to itself 2020-06-15 12:13:42 +01:00
b92a2ded8a RegionLoader: check for zero sector count when loading location table
implementations shouldn't be writing location entries that have an offset but zero sectors, but just in case they do, we need to be aware of it.
2020-06-15 12:08:55 +01:00
22f25dfbdb RegionLocationTableEntry: require sector count to be at least 1 2020-06-15 12:05:48 +01:00
6bf840c72e RegionLoader: use actual null instead of zeroed entry for non-allocated chunks
this forces the code to be properly aware of non-allocated chunks, because it'll crash with NPE if it isn't.
2020-06-15 12:02:03 +01:00
745be19a56 RegionLoader: fixed regions ballooning when writing chunks to the end of file
we already have a region growth problem due to the lack of garbage collection, but this bug was making it worse. If the region already contained 1024 allocated chunks, 4MB of file space would get wasted before the next chunk would be appended to the file.
2020-06-14 23:40:33 +01:00
e05bee5ffb RegionLoader: do a full check for chunk overlaps during initial load 2020-06-14 22:39:01 +01:00
a39fbe600d Merge branch 'stable'
# Conflicts:
#	phpstan.neon.dist
#	resources/vanilla
2020-06-14 20:03:02 +01:00
087ba0cc1d phpstan: update config to use new 0.12.26+ options 2020-06-14 19:57:36 +01:00
f55a7f8b53 Merge commit 'd8d994351'
# Conflicts:
#	composer.lock
#	resources/vanilla
#	tests/phpstan/configs/l7-baseline.neon
2020-06-14 19:47:21 +01:00
13031967f4 Merge commit '0029efa37'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Server.php
2020-06-14 19:36:50 +01:00
9ce531fef4 (master) imports cleanup 2020-06-14 19:29:33 +01:00
7d5607e72c Merge commit 'df13e967f' 2020-06-14 19:28:20 +01:00
d0c8d64b40 Merge commit '097c260db'
# Conflicts:
#	resources/vanilla
#	src/item/enchantment/Enchantment.php
#	src/plugin/PluginDescription.php
#	src/pocketmine/entity/Effect.php
#	src/pocketmine/item/ItemFactory.php
#	src/pocketmine/plugin/PluginManager.php
2020-06-14 19:28:05 +01:00
d8d994351b phpstan 0.12.29 2020-06-14 16:25:55 +01:00
0029efa370 Server: add getPlayerDataPath(), reduce logic duplication 2020-06-14 12:40:24 +01:00
5f79071e4c Registry Trait: fixed magic methods not working properly when system locale is tr_TR (#3580)
Fixed incorrect case of incorrect letters on operating systems using languages other than English. Like (Stair => STAİR)
2020-06-14 11:48:15 +01:00
df13e967fd imports cleanup 2020-06-14 10:27:15 +01:00
097c260dbb Eradicate all usages of strtoupper()
strtoupper() is an evil function whose behaviour depends on the system locale. mb_strtoupper() has more consistent behaviour.
2020-06-13 19:47:00 +01:00
5f0f5236f8 RegistryTrait: fix crash when child classes don't define getAll() 2020-06-13 18:34:23 +01:00
465285b3c2 do not rely on GameMode::getMagicNumber() to match protocol IDs 2020-06-13 12:26:17 +01:00
5c16261374 Merge branch 'stable' 2020-06-13 11:59:05 +01:00
f0669b7770 Merge commit '710c16260'
# Conflicts:
#	resources/vanilla
#	src/network/query/QueryInfo.php
2020-06-13 11:59:00 +01:00
5a8633f6c0 Merge commit '409c8c170'
# Conflicts:
#	resources/vanilla
2020-06-13 11:57:58 +01:00
3bf47e33f0 Merge commit '376926c70'
# Conflicts:
#	resources/vanilla
#	src/command/defaults/TimingsCommand.php
2020-06-13 11:57:31 +01:00
fab46f159b Merge commit 'c3fabe833' 2020-06-13 11:56:26 +01:00
430806cab3 Merge commit '3e09ff535'
# Conflicts:
#	resources/vanilla
#	src/block/tile/EnchantTable.php
2020-06-13 11:56:11 +01:00
0d186fe42c Merge commit '725506510'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/level/format/io/leveldb/LevelDB.php
2020-06-13 11:55:10 +01:00
dba059d8da Merge commit 'a7f10d8cc'
# Conflicts:
#	resources/vanilla
2020-06-13 11:52:17 +01:00
70ca12bb90 Merge commit 'fcc9e62c6'
# Conflicts:
#	resources/vanilla
#	src/network/mcpe/protocol/types/command/CommandEnum.php
#	src/pocketmine/Player.php
2020-06-13 11:49:52 +01:00
ee6b980b98 Merge commit '42613618a'
# Conflicts:
#	phpstan.neon.dist
#	resources/vanilla
2020-06-13 11:46:39 +01:00
f3271a0d19 Merge commit '1bbeb6245'
# Conflicts:
#	composer.lock
#	resources/vanilla
2020-06-13 11:44:44 +01:00
fe1b5d2d01 Merge commit '3d50aafcc'
# Conflicts:
#	resources/vanilla
#	src/crafting/ShapedRecipe.php
2020-06-13 11:30:44 +01:00
4208192aa2 Merge commit '50fed4164'
# Conflicts:
#	resources/vanilla
2020-06-13 11:29:39 +01:00
69aa6a51b4 Merge commit '3f971a0c6'
# Conflicts:
#	resources/vanilla
#	tests/phpstan/configs/l7-baseline.neon
2020-06-13 11:29:12 +01:00
da3ba1e2b2 Merge commit 'a27b29897'
# Conflicts:
#	resources/vanilla
2020-06-13 11:28:03 +01:00
2a9498a4f9 Merge commit 'a90132a30'
# Conflicts:
#	resources/vanilla
2020-06-13 11:22:18 +01:00
d82264fe60 Merge commit 'dfbd85777'
# Conflicts:
#	resources/vanilla
#	src/VersionInfo.php
2020-06-13 11:21:43 +01:00
586f265033 update build/php submodule to pmmp/php-build-scripts@2f422db397 2020-06-13 11:17:58 +01:00
a219b727f2 updated build/php submodule to pmmp/php-build-scripts@cec63c3093 2020-06-13 11:14:21 +01:00
710c162604 QueryRegenerateEvent: fixed possible type violation on listPlugins 2020-06-10 12:11:39 +01:00
409c8c1703 TimingsCommand: workaround a PHPStan type specifying bug 2020-06-10 12:11:10 +01:00
376926c700 TimingsCommand: fix missing type information for async task local storage 2020-06-10 12:10:33 +01:00
c3fabe833e FileWriteTask: mark as deprecated 2020-06-10 11:22:18 +01:00
3e09ff5350 EnchantTable: fix formatting issue [ci skip] 2020-06-10 10:54:22 +01:00
7255065106 LevelDB: stop passing false to places where it's not expected 2020-06-10 10:45:54 +01:00
a7f10d8ccf phpstan: ignore a FP (fixed in 0.12.26, but we can't upgrade yet) 2020-06-10 10:45:28 +01:00
76f1add3b3 Timezone: return false if date_parse() fails
I hate this, but I don't want to change it to throw right now because it'll create a bunch of extra work.
2020-06-10 10:34:34 +01:00
fcc9e62c65 CommandEnum: specify enumValues type
phpstan 0.12.26 starts reporting errors about the result of array_search() being given to some constructor or another because of the lack of key type specification.
2020-06-10 10:33:35 +01:00
42613618a5 phpstan: add LevelDB::get() stub to fix return type 2020-06-10 10:31:54 +01:00
1bbeb62457 Bump phpunit/phpunit from 9.2.1 to 9.2.2 (#3566) 2020-06-08 17:32:39 +00:00
64893426fa Bump phpunit/phpunit from 8.5.5 to 9.2.1 (#3557) 2020-06-06 10:13:46 +00:00
3d50aafcc4 ShapedRecipe: remove a curly-brace array-access that nothing noticed 2020-06-06 11:12:45 +01:00
50fed41642 README: we're now on travis-ci.com 2020-06-05 13:02:31 +01:00
3f971a0c65 phpstan: fixed analyze failure caused by a27b29897c 2020-06-05 12:58:18 +01:00
a27b29897c TimingsCommand: tell operators what's going on for audit purposes
previously nobody except the person who was managing timings would know that timings was running, being pasted or whatever else. Since timings can impact performance (and, for example, block the main thread when writing timings to a file), access to it should be logged so that server owners know what's going on.
2020-06-05 11:12:36 +01:00
a90132a30e added missing 3.12.6 changelog 2020-06-04 20:38:06 +01:00
dfbd857771 3.13.1 is next 2020-06-04 20:01:28 +01:00
323d96d5c1 Release 3.13.0 2020-06-04 20:01:27 +01:00
f495ba1d0b Merge branch 'next-minor' into stable 2020-06-04 19:59:46 +01:00
643cf0ebf8 3.12.7 is next 2020-06-04 19:55:09 +01:00
1614206a6d Release 3.12.6 2020-06-04 19:55:09 +01:00
f3bcd04e87 update build/php submodule to pmmp/php-build-scripts@fd749b299a 2020-06-04 14:16:45 +01:00
b8e57282e3 Merge branch 'next-minor'
# Conflicts:
#	resources/vanilla
2020-06-04 14:14:09 +01:00
2affdc1af2 Merge commit '00916ade0' 2020-06-04 14:13:52 +01:00
c29ed34b54 Merge commit 'f4ee2912db89c6629d4fa191e993f0798035ef20'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Server.php
2020-06-04 14:13:23 +01:00
0a3bd6fe78 Merge commit 'a0de9b0d4'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
2020-06-04 14:11:00 +01:00
fcc2352203 Merge commit '03e8cd3ed'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
2020-06-04 14:07:55 +01:00
3e9018a838 Merge commit '7af4e70f6'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/entity/Entity.php
2020-06-04 14:02:00 +01:00
0ae2c6302a Merge branch 'stable' into next-minor 2020-06-04 13:59:30 +01:00
4f59c1b26c .gitignore: ignore some extra crap 2020-06-04 13:58:46 +01:00
00916ade0c update build/php submodule to pmmp/php-build-scripts@0aa88d2765 2020-06-04 13:55:03 +01:00
f4ee2912db Server: tell me what is wrong when crash archive submission fails 2020-06-04 13:48:40 +01:00
a0de9b0d46 Player: use real time to update rate limit, fixes #3554 (except in very extreme cases) 2020-06-04 13:39:26 +01:00
03e8cd3ed4 Player: fixing ground state handling in spectator mode, closes #3552, closes #3553 2020-06-04 11:10:21 +01:00
7af4e70f64 Entity: fixed movement updates not firing after teleport
this became obvious by teleporting non-moving entities into the air and observing that they didn't fall.
2020-06-04 10:52:04 +01:00
017afead3b extract FurnaceRecipeManager unit from CraftingManager
I'd like to have this directly provided to Furnace, but I don't know how to short of making into a singleton. Since I want to have per-furnace recipe managers (e.g. for stuff like blast furnace vs regular furnace etc), a singleton isn't really an option.
2020-06-03 18:59:59 +01:00
b58c425189 Merge branch 'next-minor'
# Conflicts:
#	changelogs/3.12.md
#	resources/vanilla
#	src/VersionInfo.php
2020-06-03 13:11:30 +01:00
0af5dbc89b Merge commit '3be83e09f' 2020-06-03 13:09:04 +01:00
bce7cdd461 Merge commit 'f24be2b05'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
#	src/pocketmine/block/SnowLayer.php
2020-06-03 13:08:48 +01:00
a5e08e9a71 Merge commit '92cffc00d' 2020-06-03 13:06:02 +01:00
c864647cd1 Merge branch 'stable' into next-minor 2020-06-03 13:04:08 +01:00
d2d4780653 Merge commit 'a3f633862'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
2020-06-03 13:03:23 +01:00
7d7c16b764 Merge commit '21aef97ba'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
2020-06-03 13:00:31 +01:00
892fa1598d Merge commit 'ed0d1978a'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/item/WritableBook.php
2020-06-03 12:58:57 +01:00
01cbd27485 Merge commit 'd64561b0b'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
2020-06-03 12:57:20 +01:00
b2f182b196 Merge commit 'd234d3e45'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/command/defaults/ParticleCommand.php
2020-06-03 12:55:46 +01:00
90b53149d7 Merge commit '5056754ce'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
2020-06-03 12:54:00 +01:00
5b0964cec8 Merge commit '2dc3cf816'
# Conflicts:
#	resources/vanilla
2020-06-03 12:52:42 +01:00
2bf73c7a4a Merge commit '8c5a81cf5'
# Conflicts:
#	resources/vanilla
2020-06-03 12:50:09 +01:00
e7d712aeb6 Merge commit '2b58f2baf'
# Conflicts:
#	resources/vanilla
#	src/entity/object/FallingBlock.php
2020-06-03 12:47:44 +01:00
c72937a4af Merge commit '5dadf1237'
# Conflicts:
#	resources/vanilla
2020-06-03 12:46:06 +01:00
544bcb8f12 Merge commit '0d4e473bd'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
2020-06-03 12:45:28 +01:00
087b31e7f0 Merge commit '11cedc401' 2020-06-03 12:44:05 +01:00
e250553670 Merge commit '3f2455f09'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/block/SnowLayer.php
2020-06-03 12:43:36 +01:00
d7ae86b30c Merge commit '9d26a224a'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/block/DoublePlant.php
2020-06-03 12:35:59 +01:00
9e98666f57 Merge commit 'c4ad39046'
# Conflicts:
#	resources/vanilla
2020-06-03 12:31:42 +01:00
899da1b7f7 Merge commit '42e14f749'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
#	src/pocketmine/item/Bow.php
#	src/world/World.php
2020-06-03 12:31:17 +01:00
92ed9e6125 3.12.6 is next 2020-06-03 10:59:33 +01:00
c32026333f Release 3.12.5 2020-06-03 10:59:33 +01:00
915224c8e5 Living: fix being unable to die in the void 2020-06-02 23:18:40 +01:00
734bc6c4a7 3.12.5 is next 2020-06-02 18:40:33 +01:00
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
5c63e06b0f piece together a changelog for release 2020-06-01 14:57:27 +01:00
3be83e09f2 Revert BC-breaking backport from b38c81c96
this can't be applied to a minor version because it places additional requirements on the Inventory contract.
2020-06-01 13:51:36 +01:00
f24be2b055 Merge branch 'stable' into next-minor
# Conflicts:
#	src/pocketmine/Player.php
#	src/pocketmine/block/SnowLayer.php
2020-06-01 13:42:59 +01: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
bbf3f4c476 Merge branch 'next-minor' 2020-05-31 18:40:19 +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
484557935e Level: remove dead block placement code (player movements are now always processed immediately, just not immediately broadcasted) 2020-05-31 16:06:48 +01:00
485f573955 Player: remove move buffering, implement simple rate limited movement… (#3167)
Introduction
This PR is a second attempt at improving movement processing to fix #1215 , #2730 and more.

This is significantly less complex than the previous attempt #2646 -- it gets rid of the movement buffering system entirely and instead relies on a simple rate limit counter to restrict on-the-fly movement processing.

Movement is rate limited to a max average of 2 per tick. It allows up to 5 seconds' backlog to accommodate network lag. The rate limit counter is increased by 2 per tick and decreased once for every movement processed. This prevents movement processing being abused for denial of service attacks.

Changes
API changes
This PR, while obviously highly beneficial for most current users, poses some BC-breaking issues because of changes to the internal Player API.

Player->processMovement() (protected) has been removed. This is a BC concern for custom player classes which overrode it and called it as a parent. In addition, child implementations won't be called every tick any more, which could break some custom movement processing systems.
Player->newPosition (protected) has been removed. This internal field may have been accessed by custom movement implementations.
Player->isTeleporting (protected) has been removed. BC concern is same as previous point.
Player->getNextPosition() (public) has been @deprecated.
Added the following protected Player class members:
int $moveRateLimit
?Vector3 $forceMoveSync
handleMovement()
processMostRecentMovements()
revertMovement()
Behavioural changes
Player movement is now subject to less rubberbanding and has more reliable behaviour.
2020-05-31 15:51:30 +01:00
4bf40df770 tools: added a script to remove garbage from region files 2020-05-31 15:10:28 +01:00
31f4735ce5 Merge branch 'next-minor'
# Conflicts:
#	composer.lock
#	resources/vanilla
2020-05-31 15:05:44 +01:00
e9e8055238 Merge commit '3f07f0687' 2020-05-31 15:05:11 +01:00
9c50ad4c83 Merge commit '10279e11e' 2020-05-31 15:04:58 +01:00
1974afec78 updated build/php submodule to pmmp/pthreads@653d685628 2020-05-31 15:04:37 +01:00
8dc5b9e712 Merge commit '673e44445'
# Conflicts:
#	composer.lock
#	resources/vanilla
2020-05-31 15:03:48 +01:00
7e86354519 updated composer lockfile 2020-05-31 14:59:00 +01:00
6df43338df Merge commit 'c3a795e87'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
#	src/pocketmine/entity/Entity.php
2020-05-31 14:56:37 +01:00
0a730db030 Merge commit '4199c3796f4c6d8da0eccba64fe4cd9812acadeb'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/block/Water.php
2020-05-31 14:46:51 +01:00
71e0521286 Merge branch 'stable' into next-minor
# Conflicts:
#	composer.lock
2020-05-31 14:43:53 +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
cc549630e5 HandlerListManager: fixed @param doc comment not referring to correct ReflectionClass
phpstan doesn't notice this because of the phpstan-param doc directly underneath.
2020-05-30 22:29:30 +01:00
4ce5f2a6c6 WorldManager: Add access to WorldProviderManager (#3527)
* WorldProvider: Add access to WorldProviderManager

* WorldManager: Updated getProvider method

Co-authored-by: Govdim <govdim.govorek@gmail.com>
2020-05-26 06:59:19 +01:00
c93038f574 Inject WorldProviderManager to WorldManager's constructor, no longer singleton 2020-05-24 19:22:04 +01:00
437e4d75ab WorldProviderManager: use $this-> instead of self:: 2020-05-24 19:16:57 +01:00
81d11ea4e3 Player: make selectChunks() non-dependent on the player's current view distance & location 2020-05-24 18:59:43 +01:00
63d622a3cc Remove GlobalConstants
the constants described in this file are now provided by pocketmine\utils\Limits in the BinaryUtils dependency.
2020-05-24 18:37:09 +01:00
41566e8077 Server: remove unused BOOTUP_RANDOM constant
this used to be used for /dumpmemory filenames, but those were confusing and stupid, and it's not used anymore since March 2018.
2020-05-24 18:33:04 +01:00
3473254d01 added Timings::INCLUDED_BY_OTHER_TIMINGS constant 2020-05-24 16:09:45 +01:00
fe649d8d70 Extract ServerConfigGroup from Server
this API isn't very nice, but it's pretty much the same as the original, and at least this can be _kinda_ unit-tested...
2020-05-24 15:48:03 +01:00
b05fab3e3c FormatConverter: do not hardcode progress update interval 2020-05-24 14:30:59 +01:00
c95951479c FormatConverter: beware paths with \ on linux 2020-05-24 14:28:07 +01:00
49bd58a86a DiskResourceProvider: do not trim backslashes from path when we're not on Windows 2020-05-24 14:26:12 +01:00
2170f81cdd PluginManager: remove dead function isCompatibleApi()
moved to ApiVersion static class
2020-05-24 14:14:47 +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
5eadb0ac44 ConsoleCommandSender: be honest about Server dependency 2020-05-23 12:31:22 +01:00
5f2e65d608 QueryHandler: be honest about dependency on Server 2020-05-23 12:28:12 +01:00
23ab6a283b Separate QueryInfo from QueryRegenerateEvent
this removes some useless and confusing APIs from query info.
2020-05-23 11:55:29 +01:00
0025196a81 Merge branch 'next-minor'
# Conflicts:
#	resources/vanilla
#	src/network/upnp/UPnP.php
2020-05-23 11:16:19 +01:00
14dd7f306b Merge commit '45c89d084'
# Conflicts:
#	resources/vanilla
#	src/command/defaults/TimeCommand.php
2020-05-23 11:14:12 +01:00
ecbf21acea Utils: added OS constants, remove hardcoded OS strings everywhere 2020-05-23 11:05:58 +01:00
c9af5ce7a9 Convert GeneratorManager to singleton 2020-05-23 10:13:03 +01:00
640428c415 Convert WorldProviderManager to singleton 2020-05-23 10:02:09 +01:00
e2232dd8d4 WorldManager: reduce code duplication for world path discovery 2020-05-23 09:50:25 +01:00
8d9759288c WorldManager: don't hard-depend on server configuration for autosave settings 2020-05-23 09:43:59 +01:00
fcea7da183 WorldManager: allow dataPath to be injected via constructor 2020-05-23 09:37:37 +01:00
6257f717b1 Entity: make networkProperties private
this reduces the temptation to use it in high-level code, as well as making syncNetworkData() more useful (now it can export to many data collections, which means we can start to think about having a property cache per network session, which is more flexible)
2020-05-21 20:29:06 +01:00
1aa92bd6a8 Living: Do not rely on attribute map for moveSpeed attribute access 2020-05-21 20:13:24 +01:00
f77eea8c44 Living: set SPRINTING flag when it's needed, close #3521 2020-05-21 20:01:37 +01:00
ec8ee29291 moving sneak & sprint properties to Living 2020-05-21 19:55:58 +01:00
74e1f6320a Store attributes as local vars, reduce usage of AttributeMap
ideally we want attribute map to only be used for properties that need synchronization.
2020-05-21 19:18:00 +01:00
f93bc0739c Force types of RegistryTrait usages to shut PHPStan up
we need generic traits to solve this problem properly.
2020-05-21 19:12:48 +01:00
8e2b9b686b Block: Invert default behaviour of silk touch (more logical)
Now, blocks do not respond to silk touch unless specifically opted into. Since this always involves custom drops in one way or another, it's easy enough to figure out which blocks need to be marked for silk touch - anything that overrides getDrops, getDropsForCompatibleTool or getSilkTouchDrops is a block which _might_ need to be flagged. Using these criteria to reduce the number of blocks needing to be checked, I was able to manually invert the behaviour as needed.

This fixes reoccurring bugs with blocks erroneously dropping themselves whenever new blocks are added and someone forgot to set that flag, granting players access to internal blocks with strange behaviour.
2020-05-21 13:02:36 +01:00
72f59eca3c Slab: ignore silk touch on breaking tools, closes #2794 2020-05-21 11:46:43 +01:00
8ec2ba79de Unhackify Registry member cloning, fixes #3519 2020-05-21 11:38:02 +01:00
45c89d084c TimeCommand: add time aliases "noon", "sunset", "midnight", "sunrise"
closes #3508
2020-05-20 20:42:21 +01:00
7aca41a530 Living: do not loop downwards searching for collision block, closes #3517 2020-05-20 20:33:25 +01:00
64bb126bf5 ignore some more l8 errors (architectural issue in NetworkSession) 2020-05-20 20:25:32 +01:00
3d0e47a86f Merge branch 'next-minor'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/network/mcpe/protocol/StartGamePacket.php
2020-05-20 20:22:18 +01:00
12f53f0ae0 Merge commit 'a29424f5b'
# Conflicts:
#	resources/vanilla
2020-05-20 20:21:29 +01:00
f992c35b68 Merge commit 'ff3af492f'
# Conflicts:
#	resources/vanilla
2020-05-20 20:20:47 +01:00
0d9703c774 Merge commit '80b804f7a' 2020-05-20 20:20:08 +01:00
9421308f73 Merge commit '3a7873598'
# Conflicts:
#	resources/vanilla
2020-05-20 20:19:42 +01:00
1318cfbe29 Merge commit 'ab32784c7'
# Conflicts:
#	resources/vanilla
2020-05-20 20:18:57 +01:00
c14069c42b Merge commit '816234a37'
# Conflicts:
#	resources/vanilla
#	src/network/mcpe/protocol/UpdateBlockSyncedPacket.php
2020-05-20 20:16:45 +01:00
14c7ab50d8 Merge commit 'b7bf92a5e'
# Conflicts:
#	resources/vanilla
2020-05-20 20:15:15 +01:00
b6209ffe71 Merge commit 'dcca000ea'
# Conflicts:
#	resources/vanilla
2020-05-20 20:14:58 +01:00
ca4f8501f6 Merge commit 'c4ea51f98'
# Conflicts:
#	resources/vanilla
2020-05-20 20:14:33 +01:00
d2ee2d42f9 Merge commit '8202bb1cd'
# Conflicts:
#	resources/vanilla
2020-05-20 20:14:01 +01:00
a34fbba4c8 Merge commit 'b75758e35'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/network/mcpe/protocol/MoveActorDeltaPacket.php
2020-05-20 20:13:28 +01:00
82bc59f480 Merge commit '38a06f76f'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/network/mcpe/protocol/LoginPacket.php
2020-05-20 20:11:43 +01:00
73495f303e Merge commit '84f99ed41'
# Conflicts:
#	resources/vanilla
2020-05-20 20:10:30 +01:00
8f6ccb17fd Merge commit 'fd63f1919'
# Conflicts:
#	resources/vanilla
#	src/network/mcpe/protocol/serializer/NetworkBinaryStream.php
#	src/pocketmine/network/mcpe/protocol/StartGamePacket.php
2020-05-20 20:09:54 +01:00
3bf52b3977 Merge commit '66d44aa81'
# Conflicts:
#	resources/vanilla
2020-05-20 20:06:58 +01:00
5caae278cf Merge commit 'f3089f577'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/network/mcpe/protocol/StartGamePacket.php
2020-05-20 20:05:48 +01:00
56f90a2901 Merge branch 'stable' into next-minor 2020-05-20 20:05:00 +01:00
bf6af269c8 StartGamePacket: use PUBLIC visibility by default 2020-05-20 20:04:39 +01:00
c5c1db1bc9 Merge commit '9516ef163'
# Conflicts:
#	resources/vanilla
2020-05-20 20:00:56 +01:00
64f0b2deb6 Merge commit 'e982a57cb'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/network/mcpe/protocol/StartGamePacket.php
2020-05-20 19:59:46 +01:00
d33ccf4edc Merge commit 'f57fa2252b6b7aa3667da5bb1e09fb716b951402'
# Conflicts:
#	resources/vanilla
2020-05-20 19:57:50 +01:00
b5a74fe3c7 Merge commit '02cc370855e543e64e34388c99fb439d206323ae'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/network/mcpe/protocol/StartGamePacket.php
2020-05-20 19:56:38 +01:00
72761503cd Merge commit '0a5d14a840a03564dcbc1d97deb91a92a00477b0'
# Conflicts:
#	resources/vanilla
2020-05-20 19:53:23 +01:00
570a709059 Merge commit '3ec2994d7f05f30e2519430379ae0f3106be5074'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
2020-05-20 19:52:03 +01:00
73d1f84072 Merge branch 'stable' into next-minor 2020-05-20 19:36:20 +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
3bb53658da Do not allow remote clients to spawn themselves before we're ready
this would have allowed clients to send SetLocalPlayerAsInitializedPacket at any time during the spawn sequence, which would have caused undefined behaviour around spawning logic.
2020-05-20 11:09:27 +01:00
82e257cf13 BUILDING.md: Fixed wrong instruction of running from source (#3512) 2020-05-19 22:44:57 +01:00
b09379151a MainLogger: fix exception messages always reporting ErrorTypeToStringMap source if they have non-zero code 2020-05-19 22:43:44 +01:00
3f1f135a59 remove a couple more Position->getWorld() usages 2020-05-19 21:38:51 +01:00
81dff6d4c5 Merge branch 'next-minor' 2020-05-19 21:32:44 +01:00
5b7a55660f Merge commit '786f416f2ef31726b9e6fa0a5edde36aecddf085'
# Conflicts:
#	resources/vanilla
#	src/plugin/PluginBase.php
#	src/utils/Utils.php
2020-05-19 21:19:44 +01:00
5b82bd4fad Merge commit 'a67d2ae978ecae234c3e46b5ac0f8f0dc99e85a7'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/item/Bow.php
2020-05-19 21:15:56 +01:00
45ec4645d2 Merge commit '089180fef4534b383a31a9d560a76bfaf0d16c6b'
# Conflicts:
#	resources/vanilla
#	src/entity/Living.php
2020-05-19 21:14:54 +01:00
da4a2d8552 Fixed a bunch of missed Position->getLevel() usages
these were not in the usage search because PhpStorm decided to refer to ChunkLoader->getLevel() for any Player references, which caused them to only show when that was searched.

There's also an undetected LSP violation with ChunkLoader because it requires returning Level and Position->getLevel() returns Level|null. I don't know why PHPStan doesn't complain about that.
2020-05-19 21:01:18 +01:00
337addf1de Eradicate remaining usages of public Position->world field
and as an added bonus, ditch a bunch of extra phpstan errors
2020-05-19 19:14:56 +01:00
8a8b1b0b97 Remove Position->setWorld() 2020-05-19 18:33:16 +01:00
148228e360 update pocketmine/math, adapt to add() changes 2020-05-19 12:26:18 +01:00
dc9351b024 Merge remote-tracking branch 'origin/stable' into next-minor 2020-05-19 11:26:25 +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
f0fefecf40 updated l7 and l8 baselines for master 2020-05-18 20:36:50 +01:00
55f8314fa7 Merge branch 'next-minor'
# Conflicts:
#	resources/vanilla
2020-05-18 20:33:22 +01:00
232ff838db Merge commit '22b5de09b476a8c1638adfaba56b210c1eb1faf0'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/level/particle/InstantEnchantParticle.php
#	src/world/sound/ExplodeSound.php
2020-05-18 20:30:00 +01:00
ba0dcdb722 Merge commit '71a8b0340c303a4d2c024ad5a0a558c5e52694e7'
# Conflicts:
#	resources/vanilla
2020-05-18 20:18:47 +01:00
15baf09339 update l7 and l8 baselines for next-minor branch 2020-05-18 20:16:03 +01:00
083dde8395 Merge branch 'stable' into next-minor 2020-05-18 20:10:47 +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
22b5de09b4 added colours to EnchantParticle and InstantEnchantParticle, closes #3368 2020-05-18 20:00:51 +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
22425551ed separate default attribute creation from Attribute into AttributeMap 2020-05-18 18:12:04 +01:00
07f979fbde RuntimeBlockMapping: bedrockKnownStates is never null 2020-05-18 17:54:27 +01:00
486ce140d8 PacketBatch no longer extends NetworkBinaryStream
this removes a whole bunch of crap from its API that shouldn't have been exposed. In the future we should look at splitting this into reader/writer halves, but for now this is a step in the right direction.
2020-05-18 17:35:30 +01:00
8f5db7c297 3.12.2 changelog typo (#3505) 2020-05-18 12:26:07 +01:00
e96b082a54 RegistryTrait: fixing use of method that doesn't belong to the trait 2020-05-18 11:40:02 +01:00
a91e895781 Merge branch 'next-minor'
# Conflicts:
#	resources/vanilla
#	src/VersionInfo.php
2020-05-18 10:54:39 +01:00
ca0d92ac59 Merge commit '1fb0ba6fc051a3052bf6ef8a84db31f85cfd4313' 2020-05-18 10:52:44 +01:00
dec500bbdd Merge commit '9ebd6d6b0fee486e1cb935cc7b5376d27ca99fd4'
# Conflicts:
#	resources/vanilla
2020-05-18 10:48:58 +01:00
58fb185e05 Merge commit '58e32086c04d6622c01f59d0cd7216bd8a50eddb'
# Conflicts:
#	resources/vanilla
#	src/world/World.php
2020-05-18 10:47:37 +01:00
3c367c70cd update build/php submodule to pmmp/php-build-scripts@8084604600 2020-05-18 10:44:29 +01:00
af253d196d Merge commit 'f1d378468ecccb7bb03ed5d4e5729558c2beda3c' 2020-05-18 10:42:16 +01:00
0e7a822553 Merge commit '25fb5140a2dba99c5e076849ac11e051a2970807' 2020-05-18 10:40:07 +01:00
8d49bc93e0 Merge commit 'f5a49b6d55940584a6a4e9cdbc456c581182b5fd'
# Conflicts:
#	resources/vanilla
2020-05-18 10:35:23 +01:00
fb58959d5f Merge commit '189f12a644aa6474bc91650cce0eb0ae9735db91'
# Conflicts:
#	resources/vanilla
2020-05-18 10:34:00 +01:00
eeec775ff6 Merge commit '5a8917f6f21205d074ce3e9d2f9325e427f9d254'
# Conflicts:
#	resources/vanilla
2020-05-18 10:32:20 +01:00
4520660025 Merge commit 'f3e436592a180c8d4fbcd346a97abdd746056c38'
# Conflicts:
#	resources/vanilla
2020-05-18 10:30:55 +01:00
38d67620f6 Merge commit '35747874f6b9b0a35ad06ec4919df5956e6b8e91' 2020-05-18 10:29:45 +01:00
76d41e7695 Merge commit '59445902b8c1fbd2bd738c69132d8a4dac3d6c5f' 2020-05-18 10:29:31 +01:00
3795a13683 Merge commit '2eb62c85f69ebd22b36f29cfb513a579ea570b0c'
# Conflicts:
#	resources/vanilla
#	src/Server.php
2020-05-18 10:29:06 +01:00
d6b03e03bf Merge commit 'ad2a39bf13e7ed6a84a7973aed686eba2d70e417' 2020-05-18 10:27:14 +01:00
a5edfa368e Merge branch 'stable' into next-minor 2020-05-18 10:25:25 +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
9ebd6d6b0f Timezone: remove rogue newline 2020-05-17 14:03:22 +01:00
65f82f5cdf Task::onRun() and Task::onCancel() now require :void return typehints 2020-05-17 13:58:01 +01:00
58e32086c0 Level: Updated TIME_* constants (#3385)
- Added Level::TIME_NOON
- Added Level::TIME_MIDNIGHT
- Changed values of Level::TIME_DAY and Level::TIME_NIGHT
2020-05-17 10:10:35 +01:00
8c0d441a13 Merge branch 'stable' into next-minor 2020-05-17 10:03:17 +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
b3454b3488 BiomeArray: check lower bounds in ::idx() as well as upper bounds 2020-05-16 18:42:47 +01:00
ae6a7b7cc9 imports cleanup 2020-05-16 18:42:08 +01:00
88715c7055 extracted a HeightArray type from Chunk 2020-05-16 18:41:27 +01:00
a31240f60b FastChunkSerializer: added constants for internal flags 2020-05-16 18:06:00 +01:00
82d361d75f extract a BiomeArray unit from Chunk
this now also properly validates data read from disk.
2020-05-16 17:36:22 +01:00
c30dd9f1b6 Entity: add abstract getNetworkTypeId(), remove NETWORK_ID constant
this now requires that subclasses supply a proper NETWORK_ID.
2020-05-16 16:08:12 +01:00
67666db827 Task: Remove currentTick parameter (#3498)
This parameter is not used for the vast majority of task use cases and just serves as extra useless boilerplate code, especially for closure-based tasks.
This use case can be replaced using Server->getTick() in the cases where it matters.
2020-05-16 15:28:45 +01:00
5a8917f6f2 TaskScheduler: queue contains TaskHandler, not Task 2020-05-16 15:27:20 +01:00
38e28f91e8 PermissionParser: move default string mappings to const array instead of switch
this allows them to be used for validation in stuff like Respect In() rule.
2020-05-16 11:26:00 +01:00
3fb34ad18e remove particle/validator dependency, require respect/validation, close #3228
this fixes a few crashes that could appear from invalid plugin_list.yml setups, which was the reason #3228 was opened to begin with. Respect also has nicer error messages, as long as you don't use the static API :)
2020-05-15 22:57:38 +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
129a7c1b3e LoginPacketHandler: avoid trashing variables in foreach 2020-05-15 11:19:14 +01:00
31e4fc6fcb fixing incompatible protocol handling, do not explode immediately on bad clientdata, login encode/decode is now symmetrical 2020-05-15 10:55:29 +01:00
86db3af896 remove utils\Color, use new pocketmine/color class
we're so close to separating protocol from core !!!
2020-05-14 20:38:08 +01:00
4437756987 Inventory: reduce API duplication by using a Set for viewers 2020-05-14 14:13:28 +01:00
3dafee6aa6 NetworkSession: explicitly unregister effect manager hooks on dispose,
close #3455
2020-05-14 10:59:10 +01:00
36c5d9117d LoginPacketHandler: properly handle failure to base64_decode stuff from JWT
previously this might just return false and blow up in your face.
I considered fixing this on stable too, but it's less useful there because so much stuff on stable just explodes at the first wrong thing anyway.
2020-05-14 09:46:44 +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
955b23cc8e Merge branch 'stable'
# Conflicts:
#	resources/vanilla
2020-05-14 00:23:36 +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
e9ecb9a9fd fixed build failure 2020-05-13 22:54:24 +01:00
97a4a53e59 added legacy string item mappings that were unknowingly removed
these are returned for the sake of backwards compatibility for plugins.
2020-05-13 22:48:08 +01:00
84291e7980 Throw a more specific exception for JWT handling errors 2020-05-13 21:23:04 +01:00
486e0e710b JwtUtils: fix minor formatting issue 2020-05-13 20:51:24 +01:00
44a7829536 VerifyLoginException: fixed rogue usage in JwtUtils 2020-05-13 20:50:41 +01:00
d7eb4f9651 Extract more general-purpose logic to JwtUtils
this code could now be reused for creating custom login packets.
2020-05-13 20:46:01 +01:00
161ac468f3 ProcessLoginTask: properly cater for key parsing errors 2020-05-13 19:23:12 +01:00
bbc249ff0d Merge branch 'next-minor'
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/VersionInfo.php
2020-05-13 13:54:29 +01:00
1b47970e71 Merge commit 'b0445504754a2f4cd0414e25851718235aeac089' 2020-05-13 13:52:34 +01:00
cc8aed5979 Merge commit '56883f9ff9d2a0934dd3585e565d109ea322f583'
# Conflicts:
#	resources/vanilla
2020-05-13 13:51:55 +01:00
a37cf6f5b2 Merge commit '7cdd26add5a13b2bb0afcf69b4bd3b8fd87c264c' 2020-05-13 13:49:32 +01:00
4c5fb1371d Merge commit 'a70fa1569027b5a77979ae513f753e71b4454b05' 2020-05-13 13:48:51 +01:00
fada0d57ce Merge commit 'bd1d7b8d75976966c5480b18b91e9d8ff176612e' 2020-05-13 13:38:13 +01:00
934f85841c asserts 👏 are 👏 not 👏 error 👏 checking 2020-05-13 13:37:49 +01:00
8c2878fe5b Added JwtUtils::parse(), make ProcessLoginTask more robust 2020-05-13 13:36:42 +01:00
c69411c984 Merge commit 'c4150d45207a8681ea1f181c7ee4ca75109a21de'
# Conflicts:
#	composer.lock
#	resources/vanilla
2020-05-13 13:30:31 +01:00
934a18df3c Merge commit '2f47597d75b514944a2f3f5d293f2fb72dd7fb56' 2020-05-13 13:28:47 +01:00
45f9c61d0f forward-port of 2f47597d75 as best it fits 2020-05-13 13:28:35 +01:00
8766d4050c Merge branch 'stable' into next-minor 2020-05-13 13:18:55 +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
84f41153e9 silence another phpstan bug 2020-05-13 00:25:16 +01:00
11ef9fb0c0 Item-from-string parsing no longer depends on ItemIds
after this is done I'm banning the constant() function.
2020-05-13 00:18:49 +01:00
ec13aa659a ItemFactory: do not explode on invalid damage values for durables
just treat them as unknown items instead
this might break some use cases, but at least this way they won't crash the server when read from disk and they won't get lost either.
2020-05-12 23:28:17 +01:00
ac4c1c9086 Clean up to SurvivalBlockBreakHandler internals - don't create a handler if it won't be used anyway 2020-05-12 22:45:42 +01:00
144a66c110 cumulative imports cleanup (again) 2020-05-12 22:38:59 +01:00
152da604be MemoryManager::dumpMemory() should never throw an exception that matters to calling code 2020-05-12 22:37:23 +01:00
c4150d4520 Bump phpstan/phpstan from 0.12.23 to 0.12.25 (#3486) 2020-05-11 20:19:30 +00:00
3a6cdba281 Implemented server-side block-break FX handling, closes #3485
this had been planned for a long time already, just never finished.
It's not fully done, because there needs to be synchronization of block-break handlers between different players attempting to break the same block, but this should resolve a lot of the bugs that previously existed, while also opening the doors to making the logic more flexible.
2020-05-11 21:16:30 +01:00
24b63d71ab updated DevTools submodule 2020-05-11 19:30:52 +01:00
3238b4ff33 Remove PluginIdentifiableCommand in favour of a more generic PluginOwned interface 2020-05-11 19:25:52 +01: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
6b037d6a4c RuntimeBlockMapping: these IDs are not static any more 2020-05-11 12:40:55 +01:00
e3dec95b75 Convert AsyncPool tests into PHPUnit tests 2020-05-11 11:34:50 +01:00
b7cf4f01f9 remove utils\UUID, switch to pocketmine/uuid package 2020-05-11 10:46:48 +01:00
cb33f408a1 updated pocketmine/spl to get rid of ErrorUtils 2020-05-10 13:08:48 +01:00
3299bc4023 start using pocketmine/errorhandler 2020-05-10 13:04:40 +01:00
65e359584e Updated RakLib to pmmp/RakLib@12153dc 2020-05-10 11:59:03 +01:00
8efe7fcfb0 World: allow configuring blocks-per-tick for random updating
this makes it much easier to observe and debug stuff that depends on it, such as grass, crop and tree growth, since they'll happen much faster.
A future improvement would be to have the update function use a non-global random so that the output can be reproduced using a given seed.
2020-05-10 11:50:31 +01:00
56883f9ff9 MemoryManager: explicitly assume return type of ini_get() 2020-05-10 11:35:53 +01:00
7cdd26add5 Player: make handleLogin() less unreadable 2020-05-10 11:23:11 +01:00
a6c35cab9a JwtUtils: fix phpstan failure 2020-05-06 22:00:11 +01:00
0b6d6306cf LoginPacket: fixed error handling edge case with malformed chain data JSON 2020-05-06 21:46:35 +01:00
ed757c7207 consolidate some JWT handling into one class 2020-05-06 21:32:22 +01:00
5d154e43a9 LoginPacket: removed an old hack that's no longer used 2020-05-06 21:18:05 +01:00
a92580b993 StartGamePacket: remove unused imports 2020-05-06 21:14:57 +01:00
acd37b95b8 Merge branch 'next-minor' 2020-05-06 20:41:48 +01:00
717b866605 Merge branch 'stable' into next-minor 2020-05-06 20:25:11 +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
88c6dcf46d ChunkCache: clean up handling of cache cleanup on world unload 2020-05-06 13:41:36 +01:00
e392a6a807 PrepareEncryptionTask: do not store onCompletion as a field
pthreads will screw around with it and make it do things it's not supposed to, which is the exact reason why we have thread-local storage to begin with.
2020-05-06 13:32:18 +01:00
ff53ddd3ad PrepareEncryptionTask: fix wrongly-specified nullability of serverPrivateKey 2020-05-06 13:29:58 +01:00
b4606a4cd0 remove PM resource interaction from StartGamePacket
also lose the cache, because it's not very useful ...
2020-05-06 13:17:16 +01:00
218f32f5b8 De-duplicate code used by legacy <-> string ID mapping classes 2020-05-06 13:15:54 +01:00
dbd51610c3 TypeConverter: use SingletonTrait 2020-05-05 19:22:20 +01:00
9cf410d484 Player: fixed broken behaviour of entity spawning on chunk send, closes #3355 2020-05-05 18:55:13 +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
c2b438ccb6 git you need to stop doing this to me REEEEEEEEEEEEEEEEEEEEEEE 2020-05-04 14:30:01 +01:00
81f982a8d9 remove hardcoded legacy entity type ID mapping, load from resources instead 2020-05-04 13:47:39 +01:00
f0dfa45172 phpstorm fixing EOF newlines that phpstorm screwed up 2020-05-04 13:46:20 +01:00
ba6fb87280 remove unused imports 2020-05-04 13:27:31 +01:00
fcd6a69000 cleaning up NBT handling on packet decode/encode
now we always decode, because it's not safe to assume that we can just grab the rest of the bytes in the packet.
2020-05-04 13:23:29 +01:00
0eec536f97 Spawnable: remove unused field 2020-05-04 13:10:23 +01:00
a73c54bdd0 making tile spawn compound cache use CacheableNbt instead of strings 2020-05-04 12:35:13 +01:00
c2857a91bd [Network]ChunkSerializer: allow injecting RuntimeBlockMapping
this will allow the same serializer to be reused with different mapping tables (will be needed for multi version).
2020-05-04 12:14:27 +01:00
53a33e8c20 World: remove unused import
we're getting so close !!!
2020-05-04 11:58:57 +01:00
d3dcb8a4e3 moving entity attack sounds to server-side 2020-05-04 11:50:42 +01:00
d40152e3bb World: fix time sync 2020-05-04 11:23:44 +01:00
aac017eae4 World: drop unused and very misleadingly named addChunkPacket() 2020-05-04 10:22:39 +01:00
c490bc5a8c World: drop global packet broadcast 2020-05-04 02:31:19 +01:00
b1021315b0 World: remove protocol-specialized broadcastLevelEvent() 2020-05-04 02:28:34 +01:00
f34753c496 CallbackInventoryListener: fix crash when any of the callbacks isn't provided 2020-05-03 21:48:32 +01:00
6e6fffa461 Inventory: added removeAllListeners()
this isn't strictly necessary because it could be done by removeListeners(...getListeners()), but I think developers will appreciate not needing so much boilerplate code.
2020-05-03 21:44:45 +01:00
8682ea35f7 Introduce some (not great) API for entity animations
while this API is a bit yucky, it's a step forward for protocol isolation and offers the possibility of controlling animations by adding events.
2020-05-01 13:57:26 +01:00
9615186afd rename PunchBlockParticle -> BlockPunchParticle 2020-05-01 12:36:31 +01:00
2964a4be35 making BlockPunchSound server-controlled 2020-05-01 12:23:00 +01:00
1969766b70 Nix some client-sided sounds, control them from the server
this is a necessary step to knock out the implicit assumption that every player is using the same protocol.
2020-05-01 11:52:32 +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
6f38031121 Liquid: do not schedule delayed blockupdate when hardening occurs on nearby blockupdate
fix #3390
fix #3392
2020-04-30 09:35:55 +01:00
b74f177958 ChunkCache: destroy cache when world is unloaded 2020-04-29 18:50:33 +01:00
3ce9a4801f World: allow registering unload hooks
this will be used for cache management when worlds get unloaded.
2020-04-29 18:48:16 +01:00
bb11cbd89c World: relocate packet stuff for time and difficulty behind NetworkSession API 2020-04-29 18:31:54 +01:00
c8c0a1533c NetworkSession: seal up actor removal behind API 2020-04-29 17:00:47 +01:00
adadd5423d move force-close crafting grid hack to InGamePacketHandler
the crafting transaction implementation has no business caring about this
2020-04-29 16:54:23 +01:00
4ce6525065 NetworkSession: incomplete abstraction of SetActorDataPacket handling
this needs to have the metadata properties separated too, but that's a job that's going to get VERY messy.
2020-04-29 16:50:52 +01:00
d1b28ce17a NetworkSession: allow sending an arbitrary set of attributes for an entity 2020-04-29 16:45:09 +01:00
f6f714c158 NetworkSession: do not mark shared attributes as synchronized, they don't necessarily belong to us
if we decided to start sending entity attribute changes to viewers too, this would have caused some unexpected behaviour.
2020-04-29 16:38:10 +01:00
f35b7bf80b NetworkBinaryStream: remove stale @throws from getAttributeList() 2020-04-29 16:32:56 +01:00
ad70a9e3dc NetworkSession: allow provision of a custom list of players to syncPlayerList() 2020-04-29 16:27:34 +01:00
d8968e9e40 box up TakeItemActorPacket sending behind NetworkSession API
we need to start thinking about moving this into interfaces.
2020-04-29 16:24:04 +01:00
1122f2a29f phpstorm can't infer these types :( 2020-04-29 13:26:49 +01:00
549940d8a7 remove NullPacketHandler
this is a waste of LOC
2020-04-29 13:14:23 +01:00
b6214744d5 NetworkSession: inject PacketPool instead of hardcoding it
this will make it slightly easier for multi version implementations, but handlers are still quite a big problem.
2020-04-29 12:48:28 +01:00
09e994a026 NetworkBinaryStream: swap BadPacketException for PacketDecodeException 2020-04-29 11:39:44 +01:00
098a5518a6 phpstan: ignore another trait override bug 2020-04-29 11:35:12 +01:00
f6f1d31112 do not mess with cached data directly in packets 2020-04-29 11:34:25 +01:00
aa57d05e12 update to a non-broken build of RakLib 2020-04-29 10:36:28 +01:00
8093a94e5d do not hardcode data deserialization into CraftingManager 2020-04-28 18:56:27 +01:00
f9a587d40e imports cleanup 2020-04-28 17:27:38 +01:00
81044d6aea updated to latest RakLib 2020-04-28 16:30:29 +01:00
3be9548b1e net: compressors are now fully dynamic (or at least the potential to be)
the compressor used by RakLibInterface when opening a session is still
hardcoded, but that's because we have no way to select the correct
compressor at that point in the login sequence, since we aren't
propagating the protocol information up from RakLib right now.
2020-04-28 16:21:18 +01:00
d9e4783b24 start making network compressors dynamic
this will facilitate future multi version support where compression types are different between versions
2020-04-28 14:47:01 +01:00
fe258740e3 SingletonTrait: added setInstance() 2020-04-28 14:31:56 +01:00
a97cafd4f6 moving serializers into protocol namespace 2020-04-27 13:54:39 +01:00
0397204c68 network/mcpe: imports cleanup 2020-04-27 12:56:28 +01:00
15c744b0d7 protocol: specialize exception used for bad packets 2020-04-27 12:55:00 +01:00
f91e2f41e0 move SendUsageTask to stats namespace
maybe separate this out into a library?
2020-04-26 11:42:48 +01:00
ac5cf2443e convert TileFactory to singleton 2020-04-26 01:11:30 +01:00
2d55b2db1b Merge branch 'next-minor' 2020-04-26 00:38:20 +01:00
f87e96026c Merge branch 'stable' into next-minor 2020-04-26 00:28:09 +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
2a4d936fd4 Merge branch 'master' of https://github.com/pmmp/pocketmine-mp 2020-04-25 12:36:24 +01:00
040fdc2875 Merge commit '8e1b3ed'
# Conflicts:
#	phpstan.neon.dist
#	resources/vanilla
#	tests/phpstan/configs/phpstan-bugs.neon
#	tests/phpstan/configs/phpunit-wiring-tests.neon
#	tests/phpstan/configs/pthreads-bugs.neon
#	tests/phpstan/configs/runtime-type-checks.neon
2020-04-25 12:35:30 +01:00
bb8ef3ff6d Merge commit 'da9731e'
# Conflicts:
#	phpstan.neon.dist
#	resources/vanilla
#	src/PocketMine.php
2020-04-25 12:20:23 +01:00
45bed454f2 Merge commit '3d2ca45' 2020-04-25 12:14:45 +01:00
a178a14732 Merge commit '34a3e0d' 2020-04-25 12:13:03 +01:00
8e1b3edd2c Merge branch 'stable' into next-minor 2020-04-25 12:06:52 +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
d3da485278 fix phpstan analyze failure 2020-04-25 10:43:06 +01:00
b1eff87ad1 fix incorrect conversion of CreateItemAction, close #3436 (#3437) 2020-04-25 10:21:40 +01:00
1f7f33d35d NetworkSession: privatise setAuthenticationStatus()
this is accessed via a closure proxy, so it doesn't need to be exported anymore.
2020-04-25 03:33:44 +01:00
80680f15f4 seal up resource pack completion callback visibility 2020-04-25 03:31:13 +01:00
6dd31cc3f5 break cycle between block and inventory packages 2020-04-24 23:53:49 +01:00
4fbf4dcdc6 Rename InventoryChangeListener -> InventoryListener 2020-04-24 23:44:38 +01:00
c869a7f099 HandshakePacketHandler no longer depends on NetworkSession 2020-04-24 23:18:29 +01:00
7d9df6af6f Convert EntityFactory to singleton 2020-04-24 22:43:02 +01:00
8c7fbf379b Bump irstea/phpunit-shim from 8.5.3 to 8.5.4 (#3435) 2020-04-24 20:45:43 +00:00
a75241ef03 RuntimeBlockMapping: use SingletonTrait 2020-04-24 21:32:47 +01:00
3a42c21cc1 wrap up block_id_map in a class 2020-04-24 21:28:27 +01:00
1df345ba6f tools/convert-world: do not redefine RESOURCE_PATH
this is now defined automatically when including the autoloader.
2020-04-24 20:55:57 +01:00
ff915b829c StartGamePacket: remove hardcoded cache, move to RuntimeBlockMapping 2020-04-24 20:50:56 +01:00
287bf4274f move RuntimeBlockMapping to convert package 2020-04-24 12:42:43 +01:00
08ac6a3c43 Convert CreativeInventory to singleton 2020-04-24 00:38:18 +01:00
5cc03775d3 added a SingletonTrait to reduce code duplication 2020-04-24 00:31:55 +01:00
a5441e009d remove "resource/" suffixed to DiskResourceProvider::$file (#3433) 2020-04-24 00:21:00 +01:00
5a94af40e2 Convert ItemFactory to singleton 2020-04-24 00:18:31 +01:00
13d784cd0c Convert BlockFactory to singleton 2020-04-23 23:45:13 +01:00
accc0da0cb Chunk no longer depends on BlockFactory
really this light population crap shouldn't be in the chunk to begin with, but that's a bit more complicated.
2020-04-23 21:31:28 +01:00
aa1828aa98 RuntimeBlockMapping is now a singleton instead of static class
this prepares for a fully dynamic block mapper, as well as allowing a small performance improvement to chunk encoding by eliding the constant lazy-init checks.
2020-04-23 21:09:58 +01:00
f3fed60d57 crafting: ditch MultiRecipe, it's a network-only thing
MultiRecipes are really nothing more than feature toggles at the network layer, and they don't belong in the main core code.
2020-04-23 19:45:59 +01:00
b2636161f7 PrepareEncryptionTask: move a bunch of stuff out of the AsyncTask class 2020-04-23 16:27:49 +01:00
095a21ea5a PacketPool is now non-static
this allows greater flexibility for customisation, and will facilitate future multi version support.
2020-04-23 16:11:47 +01:00
f3d7c320a1 move SkinAdapter stuff to convert package 2020-04-23 15:46:37 +01:00
ebcfab4b61 NetworkInventoryAction: move type translation to TypeConverter 2020-04-23 15:40:23 +01:00
33f899f2fc protocol: imports cleanup 2020-04-23 15:38:17 +01:00
1b26cf1df9 break the hard cycle between mcpe\handler and mcpe\protocol
preparing to move mcpe\protocol to a separate library
2020-04-23 15:38:11 +01:00
18d48869a0 the great airgapping of recipes and itemstacks 2020-04-23 14:11:48 +01:00
843993f02b Throw a specific exception for zlib decompression failure 2020-04-22 13:45:29 +01:00
35d656c6e5 ProcessLoginTask no longer depends on NetworkSession 2020-04-22 13:30:37 +01:00
dd37d286f0 use a dedicated exception class for throwing exceptions on decrypt failure 2020-04-22 09:40:26 +01:00
5a33dbd4c6 Player: drop isAdmin from kick(), closes #3275 2020-04-19 18:27:37 +01:00
3d2ca457f8 protocol: Added missing Window Types (#3420) 2020-04-19 15:43:11 +01:00
1579f41056 Added missing Enchantment IDs (#3419) 2020-04-19 15:42:27 +01: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
67247b2e81 fix make-release 2020-04-19 13:53:06 +01:00
766a2178a0 Merge branch 'next-minor'
# Conflicts:
#	composer.lock
#	resources/vanilla
2020-04-19 12:56:44 +01:00
70a4f73d73 Drop PHP 7.2 support 2020-04-19 12:49:25 +01:00
7d43dffac4 updated phpstan/phpstan-phpunit 2020-04-19 12:44:26 +01:00
c6d6afe65e bring RakLibInterface up to speed with latest RakLib 2020-04-19 12:27:44 +01:00
c097188a97 Merge branch 'next-minor'
# Conflicts:
#	composer.json
#	composer.lock
#	resources/vanilla
2020-04-19 12:22:39 +01:00
804a062c3a CrashDump: report the versions of all Composer libraries installed 2020-04-19 12:11:34 +01:00
86f67445c6 fix merge error 2020-04-19 11:19:06 +01:00
163c3855eb Merge branch 'next-minor'
# Conflicts:
#	resources/vanilla
#	src/plugin/PluginBase.php
#	src/plugin/PluginDescription.php
#	src/pocketmine/Player.php
#	src/pocketmine/network/rcon/RCON.php
#	src/pocketmine/network/rcon/RCONInstance.php
#	src/pocketmine/scheduler/AsyncTask.php
#	src/pocketmine/tile/Spawnable.php
#	src/scheduler/AsyncPool.php
#	src/utils/Config.php
#	src/utils/Timezone.php
#	src/utils/UUID.php
#	src/utils/Utils.php
#	src/world/format/io/region/RegionLoader.php
2020-04-19 11:13:41 +01:00
86e051b7bf Merge commit 'a2543ff80d2906bccda1a4e2fdbd9d8e7d147fb3' 2020-04-18 17:33:05 +01:00
49a71ff4f8 Merge commit '6422ed7'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/network/mcpe/RakLibInterface.php
2020-04-18 13:55:35 +01:00
d4594d6114 Merge commit '06a9c98'
# Conflicts:
#	resources/vanilla
2020-04-18 13:48:26 +01:00
22a4639162 Merge branch 'stable' into next-minor 2020-04-18 13:32:52 +01:00
9bfc1df486 Merge branch 'stable' 2020-04-18 13:19:31 +01:00
ab62a792e1 Merge commit '7a072931d' 2020-04-18 12:10:02 +01:00
35be36961d Merge tag '3.11.7' 2020-04-18 11:29:47 +01:00
3d3a487422 PrepareEncryptionTask: remove cyclic dependency on NetworkSession 2020-04-18 11:25:29 +01:00
39d02a67d2 3.12.1 is next 2020-04-17 18:39:20 +01:00
77d45bf116 Release 3.12.0 2020-04-17 18:39:15 +01:00
f79182852b Fixed typo in login handler (wrong variable to store persona pieces) (#3422) 2020-04-17 14:36:51 +01:00
a107ad7404 1.14.60 support (#3407) 2020-04-17 09:18:00 +01:00
7a072931df Merge branch 'stable' of https://github.com/pmmp/pocketmine-mp into stable 2020-04-17 01:58:26 +01:00
f428a9bf52 protocol: rename some useless fields 2020-04-17 01:58:06 +01:00
2e720b48d9 AnimatePacket: added a new constant 2020-04-17 01:57:20 +01:00
a6e79bedf5 ActorEventPacket: plug some gaps 2020-04-17 01:56:56 +01:00
a5ba570fdf StructureBlockUpdatePacket: Added encode/decode (#3148) 2020-04-17 01:11:16 +01:00
0d5164af02 LabTablePacket: updated type field and added constants 2020-04-16 22:03:36 +01:00
534af770f8 InteractPacket: new constant 2020-04-16 22:03:34 +01:00
e86c243db5 NetworkSession: do not expose setPlayerInfo() 2020-04-16 01:55:52 +01:00
9ba47f90d1 LoginPacketHandler: account for failure to correctly parse UUID
this will still crash in some circumstances, pending merging bug fixes from stable.
2020-04-16 01:45:00 +01:00
619a9892e5 RCON: properly handle potential errors during socket setup 2020-04-16 01:29:28 +01:00
63b109f23e RCONInstance: fixed incorrect doc comment for field 2020-04-15 21:16:47 +01:00
79ed377c7a Bump pocketmine/nbt from 0.2.13 to 0.2.14 (#3406)
Bumps [pocketmine/nbt](https://github.com/pmmp/NBT) from 0.2.13 to 0.2.14.
- [Release notes](https://github.com/pmmp/NBT/releases)
- [Commits](https://github.com/pmmp/NBT/compare/0.2.13...0.2.14)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-15 13:45:52 +01:00
2da8ce7a20 PluginBase: account for fopen() maybe returning false
again, the error handler will normally take care of this, but we can't assume that the error handler is always set.
2020-04-15 13:05:41 +01:00
959dd4cbf1 PluginManager: explicitly assume the result of FilesystemIterator arrayification 2020-04-15 12:59:15 +01:00
0a3788f9ac ScriptPluginLoader: properly handle the case where the script itself is somehow missing
this won't ever happen during PocketMine runtime, but it might happen if something else tries to use it.
2020-04-15 12:54:45 +01:00
cdda74ef93 PluginDescription: use result of phpversion() to check if extension is loaded
technically phpstan should account for this with the extension_loaded() check, but it currently doesn't and it's not worth fighting with it when the fix is so simple anyway.
2020-04-15 12:50:53 +01:00
bbe428a874 Spawnable: explicitly assume that NBTStream->write() will not return false
it will never return false under these circumstances
2020-04-15 12:43:44 +01:00
755919c496 SendUsageTask: explicitly assume that json_encode() will not return false 2020-04-15 12:43:05 +01:00
88b216a17b AsyncTask: fix another phpstan level 7 error about wrong types
this should really be a dedicated type, but everything done with pthreads sucks.
2020-04-15 12:42:18 +01:00
8020912448 AsyncPool: add phpstan array type information to all fields 2020-04-15 12:40:54 +01:00
5571ae05b5 AsyncPool: silence a warning about wrong key type
getTaskId() returns int|null, although it won't happen after the ID has been set.
2020-04-15 12:40:23 +01:00
bc985198a0 Config: do not expect string keys on parseProperties(), because of key casting (PHP sucks) 2020-04-15 12:20:23 +01:00
27b2710c56 Config: make phpstan happy for load()
currently this will never be reached if the regular exception handler has been set, but it might not be set if the class is used on its own.
2020-04-15 12:18:22 +01:00
1755b25808 Utils: make explicit assumption about result of scandir() in recursiveUnlink()
TODO: this assumption might be flawed in the case of threading...
2020-04-15 12:13:26 +01:00
a78133d0e3 Utils: provide phpstan type information for testValidInstance() 2020-04-15 12:12:18 +01:00
a51a16a55c Utils: silence PHPStan warning about array_combine() result
phpstan doesn't account for having 2 arrays of the same size, and even if it did, the size cannot be inferred easily here.
2020-04-15 12:11:13 +01:00
099562d582 Utils: assume explicitly that ob_get_contents() will not return false in getReferenceCount() based on context 2020-04-15 12:10:21 +01:00
ae76e8f08f Utils: fix some implicit casts to boolean on result of preg_match_all() 2020-04-15 12:09:10 +01:00
42a08e7e4a Utils: don't assume that callable is only array|string implicitly
this should really support closures too, but since it's not used anywhere, I feel OK with this change.
2020-04-15 12:08:33 +01:00
b193d9f919 Process: shut up PHPStan about possible float returns on getMemoryUsage and friends
this can never actually happen because the given data sources will never have such large numbers, but PHPStan doesn't know this.
2020-04-15 12:07:24 +01:00
24d64eedab Process: make some assumptions about I/O explicit for type safety 2020-04-15 12:05:13 +01:00
0c9d16f1ef Internet: explicitly assume return of curl_exec() is string after error checking
this is documented as string|bool, but it's actually string|false if CURLOPT_RETURNTRANSFER is set, and bool if not.
2020-04-15 12:02:38 +01:00
d246933e3e TextFormat: account for failure to encode JSON in toJSON() 2020-04-15 11:29:50 +01:00
41d7b8c0e4 TextFormat: properly handle pcre errors in some cases
these would previously just hit type errors.
2020-04-15 11:29:04 +01:00
2622c34542 Terminal: explicitly assume that fopen(stdin) will not fail 2020-04-15 11:12:03 +01:00
5c9419b55c Timezone: use false checks instead of file existing for static analysis 2020-04-15 10:59:36 +01:00
83c40f4502 Timezone: properly account for failure to read timezone file 2020-04-15 10:23:07 +01:00
372202b3dc Utils: use type-safe checks to ensure file validity
this gives the same results while keeping phpstan happy.
2020-04-15 10:19:51 +01:00
917c744266 Properly handle error conditions in Utils::decodeJWT() 2020-04-15 10:18:02 +01:00
2281fe4e67 Account for reflection filename being false (in the case of classes/functions defined by builtins) 2020-04-15 10:15:38 +01:00
cf538d83bf Timezone: shut phpstan up about impossible ini_get() errors 2020-04-15 09:48:20 +01:00
7e9c38a9d9 Timezone::parseOffset() returns string|false, not string|bool 2020-04-15 09:47:52 +01:00
ccad97727f UUID: properly account for garbage inputs which aren't valid hexadecimal
this would previously throw a TypeError and crash.
2020-04-15 09:44:14 +01:00
e3ebf8bb61 Internet::getIP() returns string|false, not string|bool 2020-04-15 09:39:38 +01:00
cb6b59a52a Internet: curl_init() may return false on error (unclear on reasons) 2020-04-15 09:38:39 +01:00
53dbbd5f97 Internet: account for socket_create() maybe failing in getInternalIP() 2020-04-15 09:37:17 +01:00
51908ec45a Player: allow provision of a custom cooldown duration for items
this would be more useful to plugins, so that it's not necessary to extend any item classes for this trivial purpose.
2020-04-15 09:32:48 +01:00
a2543ff80d Position: add getLevelNonNull()
this allows assuming that a position has a valid world in places where it's never expected to not be valid. Since this is the vast majority of usages, it eliminates a lot of possible null-pointer warnings given by static analysers.
TODO: Consider whether we can make Position->getLevel/World use this behaviour out of the box in the next major version.
2020-04-14 11:08:37 +01:00
20f3030709 3.11.8 is next 2020-04-14 02:54:41 +01:00
3aa58f54dc Release 3.11.7 2020-04-14 02:54:40 +01:00
6e08b622b3 Merge branch 'stable' into next-minor 2020-04-14 01:43:23 +01:00
5c12a95151 phpstan: force static reflection for COM class
com_dotnet has crap reflection exports and the class name case doesn't match.
2020-04-14 01:43:02 +01:00
604900d4c5 Merge branch 'stable' into next-minor 2020-04-14 01:38:01 +01:00
5f07c5df1c Bump irstea/phpunit-shim from 8.5.2 to 8.5.3 (#3384) 2020-04-12 03:40:14 +00:00
6422ed7722 Added RakLibInterface::setPacketLimit() (#3398) 2020-04-11 23:27:17 +01:00
5f33ef35e3 build: allow providing a git hash 2020-04-09 21:13:54 +01:00
d3a6da1b3a NetworkSession->getPing() now returns null when no measurement of ping has yet been completed 2020-04-04 23:33:30 +01:00
1d9cb174b6 updated RakLib dependency 2020-04-04 23:30:55 +01:00
ec949840b2 Do not crash on failure to decompress region chunks
this could happen when a chunk was partially overwritten with one of the same sector size.
2020-04-01 21:30:25 +01:00
f5bf93455a update to latest RakLib 2020-04-01 20:16:21 +01:00
f5cd87ac95 MainLogger: implement BufferedLogger 2020-04-01 20:09:42 +01:00
64d5320ac9 update for pthreads-free raklib 2020-03-31 19:41:37 +01:00
37701267f0 Merge branch 'stable' 2020-03-31 19:40:54 +01:00
e45e84b236 Updated composer dependencies 2020-03-31 18:43:30 +01:00
00cc2ee092 one more RakLib update for the day ... 2020-03-30 00:22:45 +01:00
927872ce08 Updated to latest bleeding-edge RakLib 2020-03-29 23:53:00 +01:00
abd1ed7352 RakLibServer: make onRun() protected 2020-03-29 18:45:48 +01:00
d89cdfc18e Relieve RakLibServer of more responsibilities
at this point it's really not much more than just a thread-safe way to transmit parameters from main to thread. Maybe we can ditch it in favour of a generic closure-based thread implementation.
2020-03-29 18:42:15 +01:00
4e54e54421 Updated RakLib dependency 2020-03-29 18:18:39 +01:00
f779881b6a Updated to latest RakLib bleeding edge
this version brings quite a few inter-thread communication improvements.
2020-03-29 16:52:36 +01:00
eb7c31d3ff RakLibInterface: remove useless shutdown check from tick()
the thread should never be shutdown during an update cycle, because we stop the interface from being ticked when it gets shutdown.
2020-03-29 16:26:22 +01:00
2e75594c34 updated RakLib dependency 2020-03-28 13:28:12 +00:00
641dfe6892 Merge remote-tracking branch 'origin/stable' 2020-03-28 13:27:48 +00:00
0691a40204 UpdateBlockPropertiesPacket: expose nbt field 2020-03-24 11:06:58 +00:00
da7ff9b1fe Airgap Attribute, fix decoding of non-registered attributes for protocol debugging 2020-03-24 00:43:44 +00:00
83a3adecff LoginPacket: use netresearch/jsonmapper for login data decoding
this makes retrieval static analysis friendly without extra steps.
2020-03-23 22:00:13 +00:00
3e5d3a646b Make use of BadPacketException::wrap() 2020-03-23 21:28:38 +00:00
2d46ae4476 Added BadPacketException::wrap() 2020-03-23 21:27:08 +00:00
dfe68c9788 Bump phpstan/phpstan from 0.12.17 to 0.12.18 (#3372)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.17 to 0.12.18.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.17...0.12.18)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-23 15:21:00 +00:00
a95426c373 Merge branch 'stable' 2020-03-18 13:17:38 +00:00
af3f22efd6 Merge commit '310de5a2b211d31cf775d42c38a3e70cf251554c' 2020-03-18 13:09:55 +00:00
35b8f0bf25 Bump phpstan/phpstan from 0.12.15 to 0.12.17 (#3363) 2020-03-18 13:06:14 +00:00
d4dc1c8a0c AttributeMap: be aware of possible NULL offset in ArrayAccess
reported by phpstan 0.12.17
2020-03-18 12:59:01 +00:00
517f9a3c3a Player: fix weapons not taking damage from attacks (bug introduced by #3348) 2020-03-18 12:51:05 +00:00
d930abce2d ChunkSerializer: improve palette writing performance with one weird trick
this optimization relies on the fact that palette entries are always unsigned, and positive zigzag varints are just the same as their non-zigzag counterparts, except shifted left by 1 bit. This eliminates some function call overhead, making the encoding slightly less agonizingly slow.
2020-03-17 21:16:43 +00:00
636c35dcf1 replace daverandom/callback-validator with pocketmine/callback-validator, closes #3359 2020-03-17 12:24:50 +00:00
d22f0da1de Bump phpstan/phpstan from 0.12.14 to 0.12.15 (#3362) 2020-03-17 12:20:55 +00:00
310de5a2b2 RCON: set SO_REUSEADDR to fix RCON start failure after restart (#3357) 2020-03-16 12:00:45 +00:00
06a9c98ded MemoryManager: fix strict-rules error on phpstan level 7 2020-03-15 15:49:04 +00:00
5c7b05c2ba CrashDump: do not assign possibly-false return value of fopen() directly to non-union field
this would become a problem with typed properties, and also phpstan level 7 doesn't like it.
2020-03-15 15:48:09 +00:00
9c86763322 CrashDump: do not assume that error_get_last() always returns array
this returns NULL if there was no error before the shutdown handler was triggered (usually caused by a plugin calling exit() prematurely).
2020-03-15 15:47:07 +00:00
35490ca41c CrashDump: do not assume that file() always returns array
phpstan level 7 prep
2020-03-15 15:46:03 +00:00
093a7c239e CraftingDataPacket: fix variable name collision 2020-03-14 14:24:50 +00:00
a3edbc31ae Merge branch 'next-minor' 2020-03-14 14:13:50 +00:00
47c7872c88 Merge branch 'stable' into next-minor 2020-03-14 13:42:39 +00:00
f84abcd1fe sync composer.lock with 0dd68e587f 2020-03-14 13:36:35 +00:00
522ec3f4cd Merge branch 'next-minor' 2020-03-14 13:33:19 +00:00
7b3c2a3703 Merge commit '3907a2b6ba58fa49022e3e7c8256731dfa2e0d00' 2020-03-14 13:32:35 +00:00
b5dd147ec7 PlayerQuitEvent: fix types of quitMessage 2020-03-14 13:24:40 +00:00
f8ce01e2fd ItemFactory: extract fromStringSingle() from fromString()
on PM4, the multiple functionality is removed, but on PM3 this is a problem for phpstan.
2020-03-13 17:54:25 +00:00
3907a2b6ba Process: split getMemoryUsage() into 2 functions
this isn't released yet so it's OK to change.
phpstan level 7 doesn't like these kinds of ambiguous return types because there's no way for it to tell which type is returned without a return type specifying extension, and it's easier to just change the API than to make PHPStan understand it.
2020-03-13 17:32:17 +00:00
0dd68e587f require phpstan ^0.12.14 (for incremental analysis) 2020-03-13 16:30:35 +00:00
c9e8598510 InGamePacketHandler: do not handle inbound ActorEvents that are not for self 2020-03-13 15:19:32 +00:00
ea9bff6a65 Merge branch 'next-minor' 2020-03-13 15:17:21 +00:00
1171cd2493 Merge branch 'stable' into next-minor 2020-03-13 15:16:42 +00:00
330e93e5e3 Player: do not handle inbound ActorEvents that are not for self 2020-03-13 15:15:20 +00:00
af53c85e6a Merge branch 'next-minor' 2020-03-12 11:48:26 +00:00
e2579e0a2a Merge branch 'stable' into next-minor 2020-03-12 11:47:33 +00:00
2020fcd18e updated build/php submodule 2020-03-12 11:47:15 +00:00
899d05c6ec DataPacket: strip some whitespace 2020-03-10 13:06:16 +00:00
ca909ebc1d Merge branch 'next-minor' 2020-03-10 13:05:37 +00:00
5a9a576bfa AddActorPacket: remove unused import 2020-03-10 12:45:52 +00:00
b8caf34e62 Merge branch 'stable' into next-minor 2020-03-10 12:45:00 +00:00
456d9a722a reduce some doc comments to single line 2020-03-10 12:36:19 +00:00
344c980cff GlobalConstants: add strict_types 2020-03-10 12:35:13 +00:00
167492087f Chunk: specify expected bounds for Y coordinates 2020-03-10 12:33:53 +00:00
db215283a2 Effect: add desc for color parameter 2020-03-10 12:28:44 +00:00
6a507bb149 further CS fixes 2020-03-10 12:18:16 +00:00
dc757c25c8 cleanup CS from 8ec0a4d0d6 2020-03-10 12:14:38 +00:00
73267ae077 Merge branch 'stable' into next-minor 2020-03-10 12:11:36 +00:00
a72e6ee706 Player: be aware of held item changing during click-block
this caused bugs if the inventory was cleared while using a hoe.
2020-03-10 12:10:01 +00:00
8ec0a4d0d6 Allow specifying compatible OS in plugin manifest (#3192) 2020-03-10 10:12:56 +00:00
89ea7f0a76 Player: Stop setting held item post entity attack if changed (#3348)
closes #3340
2020-03-10 10:09:31 +00:00
2a97c7032e Merge branch 'master' of https://github.com/pmmp/pocketmine-mp 2020-03-09 14:39:02 +00:00
b4b1877ce5 Merge branch 'next-minor' 2020-03-09 14:38:15 +00:00
df65f1009c Merge branch 'stable' into next-minor 2020-03-09 14:33:37 +00:00
12e4e92894 Inventory: Pass old item(s) to inventory change listeners, closes #3323 (#3337) 2020-03-09 13:52:15 +00:00
a6ca37429c Player: do not set held item post block-break if changed (#3345)
this usually happens when a plugin replaces the held item during BlockBreakEvent.
closes #2010
2020-03-09 13:45:58 +00:00
4bf9fb278b Bump phpstan/phpstan from 0.12.11 to 0.12.14 (#3338) 2020-03-09 13:31:23 +00:00
15d81154e6 PluginDescription: drop unenforceable type constraint on array keys
the data that comes through here isn't validated, and there's also no guarantee that all the keys will be strings in spite of our best efforts even if it was validated, because PHP is fucking stupid and casts int-like string keys to int keys.
2020-03-05 19:53:01 +00:00
995309424e updated pocketmine/nbt dependency
this is going to need work on exception handling, but right now it's so inconsistent that it doesn't matter anyway.
2020-03-04 17:53:37 +00:00
6e39e34c1e Merge branch 'stable' 2020-03-03 12:35:11 +00:00
93e5c80962 MultiplayerSettingsPacket is bothways, close #3331 2020-03-03 12:32:57 +00:00
c19ab97610 AddActorPacket: move BC hack to higher level
we shouldn't hack the protocol impl for BC.
2020-02-27 17:37:45 +00:00
2ca10bf84b Merge branch 'next-minor' 2020-02-27 17:08:59 +00:00
dbaf851be7 Merge branch 'stable' into next-minor 2020-02-27 16:51:06 +00:00
78394a336c Merge branch 'stable' 2020-02-25 20:45:39 +00:00
7aa8bd18d3 Revert "Item: restrict bounds of count to 0-255"
This reverts commit 10317527e4.

this breaks user code which exceeds stack limits in legitimate
circumstances. For example, it should be OK to add 6000x diamond to a
player's inventory without being forced to manually split the count up
for addItem().
2020-02-25 20:42:03 +00:00
53067c26d7 BaseInventory: stop mutating item for no reason in canAddItem() 2020-02-25 20:30:37 +00:00
5c2ae0257c DataPacket: inject buffer via parameter instead of class field (packet & stream separation, step 2)
this is not complete yet, but the final change (having the binarystream actually come from outside) is a little more disruptive, and some extra changes need to be made. This will grant some sanity in the meantime without breaking too much stuff.
2020-02-25 16:19:11 +00:00
a633e415ef FastChunkSerializer: use machine endianness for pack() (thanks @Frago9876543210)
this is faster due to not having to reverse bytes. Since we don't use this format for persistence, it's OK to use machine byte order for this.
2020-02-25 15:08:53 +00:00
bd00ee5038 Merge branch 'stable' 2020-02-24 22:11:13 +00:00
e279672d45 updated pocketmine/nbt dependency 2020-02-24 22:00:03 +00:00
04581e2700 DataPacket: account for splitscreen header when decoding 2020-02-24 21:20:25 +00:00
93597dcd50 SkinData: fixed loss of data from packet decode 2020-02-24 20:48:03 +00:00
8a770d837e Merge branch 'stable' 2020-02-24 20:32:43 +00:00
778814a35e changelog: fix typo 2020-02-24 20:18:47 +00:00
3cd1da196a UpdateTradePacket: fix order of fields, closes #3327 2020-02-24 20:16:07 +00:00
ce0af8b040 DataPacket now encapsulates NetworkBinaryStream instead of extending it
ultimately the goal is to remove the NetworkBinaryStream crap entirely, but this change has most of the same benefits and is less disruptive.
2020-02-24 18:59:54 +00:00
7c2741e4f5 Inventory: eliminate remaining $send parameters 2020-02-23 21:59:51 +00:00
36685001bd ContainerOpenPacket: fixed entityInv() not initializing x/y/z fields
these are written even when not used, so they have to be initialized.
2020-02-23 20:59:53 +00:00
365d4a1592 better fix for 1.14.30 movement bug 2020-02-23 19:31:32 +00:00
2d7f37ac47 avoid direct mutation of Item->count field, use Item->pop() instead
I think this change was already applied on the master branch, but I don't remember for sure.
2020-02-23 17:37:25 +00:00
50fcdd6e7e Item: fixed documentation of pop() return type (it's not fluent) 2020-02-23 17:32:50 +00:00
10317527e4 Item: restrict bounds of count to 0-255 2020-02-23 17:23:53 +00:00
46ac4cbca1 3.11.7 is next 2020-02-21 19:18:48 +00:00
cb9e79b398 Release 3.11.6 2020-02-21 19:18:48 +00:00
2f1fad2745 Bucket: implement MaybeConsumable, fixes #3306
this is a nauseating fix, but it's only needed for stable.
2020-02-21 17:49:55 +00:00
44182dccbd Human: an additional hack for MoveActor(Absolute|Delta)Packet on 1.14.30+
before anyone asks, we still can't use this for regular player movement, because it would cause the player to receive their own movement. This was OK with MoveActor, but isn't OK with MovePlayer.
2020-02-21 12:35:17 +00:00
2f3d2d4a0b Bump phpstan/phpstan from 0.12.10 to 0.12.11 (#3311) 2020-02-19 18:57:53 +00:00
8ac7f7f11f Level: fix type of randomTickBlocks and friends 2020-02-17 15:13:40 +00:00
dbe7caab7b updated build/preprocessor submodule 2020-02-14 08:21:46 +00:00
b581fab31a updated build/php submodule 2020-02-14 08:19:23 +00:00
7b7dfc36d1 Living: fixed broken @var tag 2020-02-14 08:17:51 +00:00
d63d6b73f6 Player: workaround 1.14.30 movement bug
I can understand why this bug happened, but it doesn't mean I like it.
Fix it pls mojang, this sucks.
2020-02-13 19:40:31 +00:00
a860ccd259 Bump phpstan/phpstan from 0.12.9 to 0.12.10
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.9 to 0.12.10.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.9...0.12.10)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-13 11:24:13 +00:00
95eddbdd74 InventoryManager: move add/remove logic to separate functions 2020-02-12 17:36:29 +00:00
55e3b9ed91 InventoryManager: avoid feedback loop when closing inventory 2020-02-12 16:35:57 +00:00
b108fb61bf Inventory: drop $send params from setItem() and clear() 2020-02-12 13:34:35 +00:00
1c06438cbb Inventory: remove final usage of $send parameter of setItem() and clear() 2020-02-12 13:33:23 +00:00
4014f9a4f2 InventoryManager: be aware of client-side state when syncing slots
this eliminates feedback loops during client-initiated slot changes, and also makes it possible to have a SlotChangeAction anonymous from its initiator.
2020-02-11 21:12:18 +00:00
cd71a6204f Revert "PopulationTask: do not populate light in chunks out of the gate"
This reverts commit 42148f0d15.
2020-02-11 19:43:25 +00:00
42148f0d15 PopulationTask: do not populate light in chunks out of the gate
this is a relic from when we needed to store light on disk. Now we can just calculate lighting as-needed instead.
2020-02-11 19:14:01 +00:00
9b6fa8c25b Merge branch 'stable' 2020-02-11 19:12:39 +00:00
2bb497b716 Chunk: flag hasChanged when changing generated/populated/light-populated flags 2020-02-11 08:26:12 +00:00
613bd40601 PopulationTask: move setPopulated() call to make it more obvious what is going on 2020-02-10 18:22:19 +00:00
398b636759 PopulationTask: fixed chunks being generated empty in flat worlds
the flat generator just clones a pregenerated chunk instead of modifying the provided chunks, which means that the references that population task has would be the outdated ones.
2020-02-10 18:21:08 +00:00
19bd283807 Process: drop a blank line 2020-02-10 12:23:11 +00:00
20d1a048dd fixup imports 2020-02-10 12:21:56 +00:00
15b76a24b7 scrub useless phpdoc 2020-02-10 12:21:07 +00:00
e8bb6b8625 Command: fix output translation regression caused by 4c51f1dda3 2020-02-10 11:42:21 +00:00
2d51971b84 Revert "ClosureTask: drop requirement for void return type"
This reverts commit 9e993aa83f.

apparently PHPStan isn't cool with this ...
2020-02-10 11:40:47 +00:00
f08e411cad Merge branch 'stable' into next-minor 2020-02-10 11:40:08 +00:00
7ad44d8403 ChunkRequestTask: do not copy light information when sending chunks 2020-02-09 17:49:15 +00:00
d360439c92 FastChunkSerializer: expose a method to disable lighting serialization
this is useful for copies which don't care about lighting, such as chunk sending.
2020-02-09 17:48:30 +00:00
ce42ca958e InGamePacketHandler: do not execute use-item action if already using item, fixes #3246
the useHeldItem() sets the using-item flag back to true immediately after consumeHeldItem() sets it to false, which caused this bug.
stable has the same problem, but the effects don't show due to a well timed MobEquipmentPacket (a happy accident).
2020-02-09 12:13:15 +00:00
4c51f1dda3 Scrap TextContainer, make TranslationContainer immutable
TextContainer provided zero real value as a base of TranslationContainer, given that it required its own logic to be handled wherever accepted. As such, it's no better than a simple string.
Removing it also allows fixing an ambiguity when embedding translations inside other translations, allowing it to be made immutable.
2020-02-08 13:38:27 +00:00
2375e9519d RegionWorldProvider: fix CS 2020-02-08 09:34:22 +00:00
bfdfa4184b Merge branch 'stable' 2020-02-08 09:33:56 +00:00
1257378198 clean up function imports 2020-02-08 09:31:15 +00:00
17fc49db8a Player: fix regression in disconnect caused by 66a1134ca1 2020-02-08 09:07:09 +00:00
2e3a9f251f missed one 2020-02-07 22:17:33 +00:00
2d461251ed phpstan: ignore more errors reported by strict-rules 2020-02-07 22:14:51 +00:00
66a1134ca1 Player: avoid another empty() usage 2020-02-07 22:13:43 +00:00
ec9ece56f5 Player: fetch world via location
this code caters for the possibility of the world being null.
2020-02-07 22:11:14 +00:00
04a3e71047 ChunkSerializer: avoid using loop vars outside loop scope 2020-02-07 22:10:23 +00:00
ee36ac9875 ProcessLoginTask: use strict base64_decode() 2020-02-07 22:09:46 +00:00
bc60bb9462 remove useless type asserts on Entity->getWorld() 2020-02-07 22:08:38 +00:00
85f3dca11b HandlerListManager: make resolveNearestHandleableParent() a little easier to follow
and also sidestep phpstan complaining about using loop vars outside of loop
2020-02-07 22:07:36 +00:00
fd675449e9 BlockFactory: fill blastResistance with float(0)
technically there wasn't anything wrong with this code, but it caused the type inference to report incompatibility, and I can't be bothered to report a PHPStan bug.
2020-02-07 22:06:34 +00:00
d2aca6023b add native return types to closures (for phpstan) 2020-02-07 22:05:15 +00:00
aac7da6c96 eliminate remaining empty() usages 2020-02-07 21:51:50 +00:00
1ffabbb567 fixed ignoreError for registerEvent() 2020-02-07 20:25:08 +00:00
347b94b284 Merge branch 'stable' 2020-02-07 20:18:17 +00:00
758a68aa2c ItemFactory: add Item[] as type for list field (for auto complete) 2020-02-07 20:11:31 +00:00
bfce478e72 BlockFactory: keep the generic types for PHPStan, which actually understands it 2020-02-07 20:10:40 +00:00
681dd469a2 PluginManager: add class-string phpstan param to registerEvent() 2020-02-07 20:05:41 +00:00
3edbea8545 PluginManager: fix spacing of phpdoc comment for registerEvent() 2020-02-07 19:37:22 +00:00
3a9e6bb612 CallbackInventoryChangeListener: fix use of tab instead of space 2020-02-07 19:28:43 +00:00
31405f7587 EnumTraitTest: use @doesNotPerformAssertions 2020-02-07 18:35:55 +00:00
31fcd8e5fa ItemTest: use the proper method to explicitly fail a test 2020-02-07 18:35:26 +00:00
95896eb911 tests/phpunit: fill in some phpstan types 2020-02-07 18:34:57 +00:00
091873ca51 HandlerListManagerTest: fix phpunit 8.x compatibility 2020-02-07 18:14:43 +00:00
5e85705ec8 Merge branch 'master' of https://github.com/pmmp/pocketmine-mp 2020-02-07 18:14:10 +00:00
fb1126797a Merge branch 'stable' 2020-02-07 18:13:55 +00:00
93671d8bfe fixed broken tests from level->world rename
how did this not get noticed before ???
2020-02-07 17:22:49 +00:00
4140af459e travis: cache leveldb artifacts to reduce build time 2020-02-07 14:05:11 +00:00
f713cf25b1 travis: update leveldb version, only build sharedlibs targets on travis 2020-02-07 13:54:22 +00:00
ada8cbb545 phpstan: drop some ignoreErrors that don't occur on 0.12.9 2020-02-06 21:01:05 +00:00
0ac5e03ce9 Require PHPStan 0.12.9 minimum 2020-02-06 20:59:43 +00:00
9b02b8e51e Item: do not compare serialized NBT in equals()
this isn't cached anymore, and would be a performance drag.
It would be nice to have some kind of fast path for this, but comparing NBT binary isn't it.
2020-02-06 20:23:58 +00:00
6c7dada232 finally, integrate phpstan-strict-rules 2020-02-06 19:44:10 +00:00
25bc95cd1e removing more unnecessary casts 2020-02-06 19:33:34 +00:00
213bf8366a TranslationContainer: fix parameter type of setParameters() 2020-02-06 19:33:34 +00:00
4e693e91e6 ChestInventory: document that getHolder() may return Position
there is a variance issue with EnderChestInventory that was detected by phpstan-strict-rules which can't be addressed without a BC break. This fix will at least allow static analysers to be aware that code using this function might catch fire when it sees an EnderChestInventory without realizing it.
2020-02-06 19:33:34 +00:00
a1622fa345 UtilsTest: silence a phpstan-strict-rules warning 2020-02-06 18:53:05 +00:00
0ec869932f Item: clean up internal NBT storage, discard useless legacy network cache
this will now bail if the NBT string given is invalid upon setCompoundTag(), rather than shitting the bed when it's accessed.
2020-02-06 17:59:05 +00:00
79acaa3253 Utils: remove useless typecasts 2020-02-06 16:06:58 +00:00
da3742b39e Remove useless typecasts 2020-02-06 16:00:57 +00:00
d26fcf7dee Removed useless casts() from min/max calls 2020-02-06 15:58:27 +00:00
812424a619 GroundCover: drop useless variable in calculating startY 2020-02-06 14:26:03 +00:00
1bdc61dd5f Ore: do not destroy outer scope vars in for loops 2020-02-06 14:24:57 +00:00
86fc33fe26 Level: add phpstan generics to getNearestEntity() 2020-02-06 14:20:19 +00:00
70eb41470c ContainerInventory: remove redundant check 2020-02-06 14:19:33 +00:00
3a5709bf5e start using phpstan-phpunit
not using extension-installer because I want to part-integrate phpstan-strict-rules later on.
2020-02-06 13:23:18 +00:00
5ad66c3c9b BlockTest: throw exception instead of always-false assert 2020-02-06 13:21:39 +00:00
7885b54824 phpstan: run static analysis on tests 2020-02-06 13:13:12 +00:00
532dc0fb6f tests/phpunit: populate iterable types for phpstan 2020-02-06 13:11:56 +00:00
54ccc330d5 Bump irstea/phpunit-shim from 7.5.20 to 8.5.2 (#3296) 2020-02-06 12:50:51 +00:00
e12618c705 tests/phpunit: added missing native typehints 2020-02-06 12:13:42 +00:00
7d5f2eac8d Merge branch 'stable' of https://github.com/pmmp/pocketmine-mp into stable 2020-02-06 08:38:12 +00:00
e964dd2ca8 travis: cache composer vcs directory too 2020-02-06 08:37:38 +00:00
dbb594f130 Merge pull request #3297 from pmmp/dependabot/composer/adhocore/json-comment-0.1.0
Bump adhocore/json-comment from 0.0.7 to 0.1.0
2020-02-05 22:47:04 +00:00
8f434b9edd Bump adhocore/json-comment from 0.0.7 to 0.1.0
Bumps [adhocore/json-comment](https://github.com/adhocore/php-json-comment) from 0.0.7 to 0.1.0.
- [Release notes](https://github.com/adhocore/php-json-comment/releases)
- [Changelog](https://github.com/adhocore/php-json-comment/blob/master/CHANGELOG.md)
- [Commits](https://github.com/adhocore/php-json-comment/compare/v0.0.7...0.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-05 22:40:41 +00:00
34972c3327 Assume that getmypid() never returns false
my background research on this informs me that this returns false on negative PID, which never happens because the underlying C API call never fails - not on linux, bsd, or windows.
2020-02-05 21:00:56 +00:00
037c34d961 Living: fixed bad @var confusing PHPStan 2020-02-05 20:58:38 +00:00
4518d9d9ce Item: drop useless @var confusing PHPStan 2020-02-05 20:55:58 +00:00
1a5228e7a6 Fixed property types with missing null PhpDoc types 2020-02-05 20:55:03 +00:00
495bfda044 Drop a bunch of invalid null defaults
phpstan doesn't report these out of the box, for reasons I'm not clear on. It's also not clear if having null defaults has any effect on nullability behaviour, so they are best removed. In addition, these would be problematic on 7.4.
2020-02-05 20:53:54 +00:00
41b1fa7b48 Config: clean up inconsistent data parsing & handling 2020-02-05 20:50:36 +00:00
e689fd545b PocketMine.php: avoid use of short ternary 2020-02-05 20:48:54 +00:00
889cd5e206 PlayerNetworkSessionAdapter: clean up leftovers from multi quote support for json decode 2020-02-05 20:45:13 +00:00
e1ddf90695 Chunk: remove useless instanceof checks
these are always CompoundTags, and if they aren't we have a bug somewhere else.
2020-02-05 20:44:27 +00:00
2f325b8c91 Permission: loadPermission() never returns null 2020-02-05 20:43:40 +00:00
ac4f00be81 PluginManager: combine conditions into something less useless
the left side was already implying that the var is a Plugin instance, but PHPStan doesn't like non-bool conditions in strict mode.
2020-02-05 20:42:40 +00:00
914450c30b Entity: remove useless assert()
namedtag is always non-null here, and if it isn't, it should just catch fire the normal way.
2020-02-05 20:40:34 +00:00
25554f0d61 Level: remove useless code from unload() 2020-02-05 20:39:38 +00:00
e1a61cb51a BaseLang: get() never returns null 2020-02-05 20:38:45 +00:00
fe5620f097 ThreadManager: Lazy-init during getInstance() 2020-02-05 20:36:44 +00:00
faef4e8736 SimpleCommandMap: Command->getLabel() never returns null 2020-02-05 20:33:27 +00:00
0d19f6c968 Server: initialize auto updater before loading plugins, not after
from a plugin PoV, getUpdater() is always supposed to return an AutoUpdater instance, but it would return null during onLoad(), which is bad.
2020-02-05 20:32:51 +00:00
ecf662bf74 Server: Lazy-init static sleeper as-needed
this makes it testable without a server context.
2020-02-05 20:31:01 +00:00
8cba2e0346 Server: fixed wrong non-nullability of queryHandler 2020-02-05 19:56:16 +00:00
dfc8a6ffdd Player: remove useless code from save() 2020-02-05 19:54:50 +00:00
262728b091 PopulationTask: clean up overcomplicated garbage 2020-02-05 18:31:51 +00:00
4572ec8175 travis: run composer with --prefer-dist 2020-02-05 17:14:11 +00:00
0f6949ac34 phpstan 0.12.9 2020-02-05 17:11:08 +00:00
df8e0cf1f5 MemoryManager: eliminate unnecessary reference abuse in continueDump()
this makes the flow of data easier to understand, and also sidesteps some PHPStan bugs.
2020-02-05 17:06:05 +00:00
ad87c11ae1 ThreadManager: use array-access instead of variable property access 2020-02-05 16:36:11 +00:00
fa82cb26d8 added native types to closures (phpstan-strict-rules) 2020-02-05 16:35:10 +00:00
fd2a7797bd include make-release.php in phpstan analysis 2020-02-05 15:55:41 +00:00
e5a2cfb65f avoid type juggling in conditions, always use explicit boolean conditions 2020-02-05 15:44:06 +00:00
b96bb7d824 Player: use strict base64_decode() for login decoding
though, perhaps we should beware of false returns?
2020-02-05 13:55:38 +00:00
896cca0778 store composer cache for travis 2020-02-05 13:36:45 +00:00
59cf8e95f0 Tree: fixed populator not growing trees any lower than y=2
this would only be a problem for custom generators, but nonetheless...
2020-02-05 13:17:09 +00:00
99038c752c Avoid usage of for-loop vars outside of for-loop context
these problems were reported by PHPStan strict rules. They aren't actually bugs, but they could become bugs in the future.
2020-02-05 13:16:09 +00:00
88afedd1e8 Human: avoid overwriting non-foreach vars in foreach 2020-02-05 12:59:59 +00:00
c43e21235d HelpCommand: do not overwrite non-foreach vars in foreach 2020-02-05 12:57:27 +00:00
3f7e7352fb added SplFixedArray generics for phpstan 0.12.9 2020-02-05 11:57:37 +00:00
e1eb9186fe Merge branch 'stable' 2020-02-03 19:57:21 +00:00
32d6ea0fba Chest: do not crash on failure to fetch pair, closes #2701
isPaired() returning true is not semantically equivalent to getPair() returning non-null. getPair() might return null if the pair is inaccessible, such as when it's in an unloaded chunk (it doesn't check this yet, but it should).
For the sake of opening inventory, we don't care if the chest believes if it is paired, we care if there is actually a pair to be accessed for inventory viewing.
In addition, it's possible to create this broken-data scenario artificially by close()ing a chest tile without unpairing it first, because a tile doesn't know the difference between being closed due to unload and being destroyed.
2020-02-03 19:32:58 +00:00
28c787371a Server::$rcon may be null (disabled or failed to start) 2020-02-03 19:25:56 +00:00
dba14c9f08 PharPluginLoader: remove useless instanceof, offset is always PharFileInfo at this point 2020-02-03 12:35:34 +00:00
0e35ee8cb7 build/server-phar: drop unused imports 2020-02-03 11:18:21 +00:00
da5b7f47df build/server-phar: import global functions 2020-02-03 11:17:51 +00:00
d418dd7a09 build/make-release: fix formatting 2020-02-03 11:17:16 +00:00
f3209ccc33 build/make-release: remove unused import 2020-02-03 11:16:51 +00:00
4a4c28cd8c travis.sh: ditch PHP_BINARY variable, use PATH prefix instead
this is how normal people do it ...
2020-02-03 09:30:43 +00:00
eba8d77034 3.11.6 is next 2020-02-02 18:31:51 +00:00
13e4772f98 Release 3.11.5 2020-02-02 18:31:51 +00:00
092933105a Merge branch 'stable' 2020-02-02 18:14:51 +00:00
4bc2f28c6d Provide a ChunkUtils stub for PHPStan, so it doesn't get confused when the extension is loaded
for some reason the presence of the type problems were reported as
problems on ChunkUtils.php, despite being outside of the project scope
and the errors not applying to the polyfill.
2020-02-02 18:12:41 +00:00
afeb9838e4 Merge branch 'stable' 2020-02-02 16:47:19 +00:00
663469dfa7 travis: remove xdebug to improve build time
xdebug is almost completely useless here.
2020-02-02 16:30:00 +00:00
963abb718f build/server-phar: compress using gzip (except stub)
this produces a 75% reduction in phar size, at the expense of a slight degradation of autoloading speed and needing a writable tmpdir.
2020-02-02 16:27:38 +00:00
1f2fb73297 updated DevTools submodule to 1.14.0 2020-02-02 10:21:32 +00:00
7cb363d6e7 Merge branch 'stable' 2020-02-01 23:00:07 +00:00
1b50a2d8d4 updated composer dependencies 2020-02-01 22:59:52 +00:00
ff55b520b9 updated composer dependencies 2020-02-01 22:55:27 +00:00
3df9aaa916 Merge branch 'stable' 2020-02-01 22:19:34 +00:00
cedd8abf0c README: no need to specify 'community' Discord [ci skip] 2020-02-01 22:19:24 +00:00
80dc0eb8b8 rename BedrockData submodule 2020-02-01 22:14:53 +00:00
d48597ec5d move BedrockData submodule to resources/ 2020-02-01 22:14:24 +00:00
aad1a3400f Merge branch 'submodule-conflict-stable' into submodule-conflict-master 2020-02-01 22:13:43 +00:00
496732999c reintroduce BedrockData submodule 2020-02-01 22:05:07 +00:00
fed03fd535 Merge branch 'submodule-conflict-stable' into submodule-conflict-master 2020-02-01 22:02:44 +00:00
6a8105f5a0 delete BedrockData submodule 2020-02-01 22:01:22 +00:00
e3833ba4f0 Merge branch 'stable' 2020-02-01 21:03:21 +00:00
b59dc1ef16 Merge commit 'b11c350b2b0b0cd38114e4240e056c3aa2028707'
# Conflicts:
#	composer.json
#	composer.lock
#	resources/vanilla
2020-02-01 21:00:03 +00:00
c19b21db91 Merge commit 'f624e36faf2214fef76ad3b7148c17f7f7ff641f' 2020-02-01 20:59:23 +00:00
e8f31adc02 Merge commit '14ce9c10bb0895974008d415a3fb66ead1ab2361' 2020-02-01 20:55:31 +00:00
54604398f2 Merge commit 'f1083bd9c402c1456f4fc7dce8271c33360dc227' 2020-02-01 20:54:54 +00:00
38b7a9b76b Merge commit '199fa61aef50ee731bbf08e23616b6087e267992' 2020-02-01 20:54:27 +00:00
356ed5f1de DyeColor: fix PHP 7.2 compatibility 2020-02-01 20:50:16 +00:00
f02f45f248 Merge commit 'af82a6bbe1e4c37564ce1e0932a8177d31750b7d' 2020-02-01 20:45:16 +00:00
269066b2d0 added unit test for Enum lazy initialization 2020-02-01 20:42:04 +00:00
9c33ea8dd1 EnumTrait: use a better method to initialize enums
this method is simpler, and is also safe at the native type level.
Coincidentally, it also eliminates 30 PHPStan false-positives.
2020-02-01 20:33:30 +00:00
cc33c8155f Language: specify key type for lang and fallbackLang fields 2020-02-01 20:20:39 +00:00
ff63f6d055 fill in more iterable types (master) 2020-02-01 20:19:57 +00:00
0a566f8218 LevelProvider::generate() accepts class-string<Generator>, not any
string
2020-02-01 20:16:05 +00:00
829dd02eea Server: fixed more bad non-nullable phpdocs 2020-02-01 19:30:47 +00:00
200209b76c RegistryTrait: provide an explicit phpstan type for __callStatic arguments 2020-02-01 17:20:36 +00:00
3688f78986 Merge commit '004f7ef82e9613d60c3614dbf634836b7e2f3774' 2020-01-31 22:09:20 +00:00
c372f27e06 Empty merge of commit '89ebd2b88049d264cfa94543520f3af6e303a071' 2020-01-31 22:08:40 +00:00
89c6da13ac phpstan: use more class-string 2020-01-31 22:05:33 +00:00
f65bf76fd8 Merge commit '799183e13e61e89cc6820ad3132a4147454017c6'
# Conflicts:
#	resources/vanilla
#	src/Server.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/level/format/io/LevelProviderManager.php
#	src/pocketmine/tile/Tile.php
#	src/world/generator/GeneratorManager.php
2020-01-31 21:26:40 +00:00
cb16f5c142 Merge commit '260ac47588c76a2e6814cfba46773a990fb8c5da'
# Conflicts:
#	resources/vanilla
#	src/Server.php
#	src/lang/Language.php
#	src/network/mcpe/protocol/AddItemActorPacket.php
#	src/network/mcpe/protocol/AddPlayerPacket.php
#	src/network/mcpe/protocol/SetActorDataPacket.php
#	src/network/mcpe/serializer/NetworkBinaryStream.php
#	src/permission/Permission.php
#	src/pocketmine/block/Leaves.php
#	src/pocketmine/entity/DataPropertyManager.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/item/Banner.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/io/LevelProvider.php
#	src/pocketmine/level/format/io/LevelProviderManager.php
#	src/pocketmine/network/mcpe/protocol/AddActorPacket.php
#	src/pocketmine/network/mcpe/protocol/LoginPacket.php
#	src/pocketmine/tile/Banner.php
#	src/scheduler/BulkCurlTask.php
#	src/updater/AutoUpdater.php
#	src/utils/Config.php
#	src/utils/Utils.php
#	src/world/generator/Flat.php
#	src/world/generator/Generator.php
2020-01-31 21:07:34 +00:00
96ac95798b Merge commit '4ff4434a220813e446efde4a38e48a0416476dba'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/item/Banner.php
#	src/pocketmine/item/Item.php
2020-01-31 20:11:29 +00:00
ee4757303b Merge commit '9eebfa7cc30c8a5ac39f192c79023131623ad4b4'
# Conflicts:
#	resources/vanilla
#	src/Server.php
#	src/pocketmine/Achievement.php
2020-01-31 20:07:21 +00:00
721bd8f02b Merge commit 'd3021c628134293c2b8af505806efc2fba4fe947'
# Conflicts:
#	resources/vanilla
2020-01-31 20:03:27 +00:00
3401504bab Merge commit '9097d6c4d35b05576181f91bda68d316809f28b9'
# Conflicts:
#	resources/vanilla
2020-01-31 20:02:59 +00:00
3a68f5e3d0 Merge commit 'da43ae82fe3b8839a4d153b0365f815cf9859d77'
# Conflicts:
#	resources/vanilla
#	src/utils/Config.php
#	src/utils/Timezone.php
#	src/utils/Utils.php
2020-01-31 20:02:39 +00:00
3e80850938 Merge commit '60b405d944254c940f818ebd0b7aa2603d7968a7'
# Conflicts:
#	resources/vanilla
#	src/updater/AutoUpdater.php
2020-01-31 19:55:43 +00:00
1ae7960fc4 Merge commit '92a752053df598e5fe9366601bef070d967374fc'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/tile/Banner.php
#	src/pocketmine/tile/Sign.php
#	src/pocketmine/tile/Tile.php
2020-01-31 19:50:33 +00:00
9b9b955762 Merge commit '0537c66849b307465159306981bad78ba902f30b'
# Conflicts:
#	resources/vanilla
#	src/scheduler/BulkCurlTask.php
2020-01-31 19:47:59 +00:00
19a6fb35e7 Merge commit 'd94995e161d71659e2fe6ec1df47621f2de4b494'
# Conflicts:
#	resources/vanilla
2020-01-31 19:46:28 +00:00
b46712fbe9 Merge commit '58bc08838ba18df6361cede4b420d87d5973090a'
# Conflicts:
#	resources/vanilla
#	src/permission/Permission.php
2020-01-31 19:45:31 +00:00
20d39846b7 Merge commit 'fc0619ee6e4fa08aba2719e58a9289edd11f0b6e'
# Conflicts:
#	resources/vanilla
#	src/network/mcpe/protocol/AddItemActorPacket.php
#	src/network/mcpe/protocol/AddPlayerPacket.php
#	src/network/mcpe/protocol/SetActorDataPacket.php
#	src/network/mcpe/serializer/NetworkBinaryStream.php
#	src/pocketmine/network/mcpe/protocol/AddActorPacket.php
#	src/pocketmine/network/mcpe/protocol/LoginPacket.php
2020-01-31 19:42:07 +00:00
465d8cda79 Merge commit 'a5764b3ae98a70fe8f20f9b403a4ab84b51b11d8'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/level/format/io/LevelProvider.php
#	src/world/generator/Generator.php
#	src/world/generator/GeneratorRegisterTask.php
2020-01-31 19:32:38 +00:00
301460a0ea Merge commit '8bf469f7fcd428ebc8c3c9b9ab777c79e2824c67'
# Conflicts:
#	resources/vanilla
#	src/lang/Language.php
2020-01-31 19:22:14 +00:00
8262633820 Merge commit '3b9a5c5ccc22170499b686f59ea55e8be231407a'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/item/Item.php
2020-01-31 19:21:03 +00:00
09b24d3c32 Merge commit '4c36ca58e2710c8fd03eec1f50a885fb97fd9b68'
# Conflicts:
#	resources/vanilla
2020-01-31 19:19:06 +00:00
f66efa1aa2 Merge commit 'a67fa5c007de3a5e7e689c63955849ceba9d7541' 2020-01-31 19:18:35 +00:00
eb6bb1aae1 Merge commit '839a789180cb3acd2e16006afa9b787903ffbbcd' 2020-01-31 19:16:09 +00:00
dedf81a9af Merge commit 'e61c3e8bf697e5c5c6cddb4843b24279faaf25cb' 2020-01-31 19:12:32 +00:00
25ead18369 Merge commit '7ce6c8aa13bd1e8eb5aa3fe267a0116ab43e9313' 2020-01-31 18:55:49 +00:00
1388a2287a Merge commit '5c8a625d88e511a6ebad765714b75f1a86dfd37f' 2020-01-31 18:50:23 +00:00
5be45dd793 Merge commit '259f0425a9657befcc8ef5f474ecc24ec78042fa' 2020-01-31 18:43:47 +00:00
86f866de37 Merge commit '9cdea437947ed233feab875b2a6d30a68b8648fe' 2020-01-31 18:21:32 +00:00
b11c350b2b composer: use new pocketmine/log & pocketmine/classloader classes 2020-01-31 15:51:26 +00:00
f624e36faf composer: all of these packages are now available on packagist 2020-01-31 15:49:33 +00:00
14ce9c10bb BUILDING.md: fix typo 2020-01-31 13:27:29 +00:00
b27aaaeeb2 added build instructions, close #2839 2020-01-31 11:32:28 +00:00
f1083bd9c4 SimpleCommandMap: beware case mismatches in alias recursion, closes #3281 2020-01-31 10:36:47 +00:00
199fa61aef update composer dependencies 2020-01-30 22:41:58 +00:00
af82a6bbe1 phpstan: enable checkMissingIterableValueType 2020-01-30 22:31:42 +00:00
004f7ef82e phpstan: stub out the iterable bullshit with pthreads
this isn't a perfect fix, but it's better than it whining about all the things.
2020-01-30 22:31:15 +00:00
89ebd2b880 remove some dead ignoreErrors 2020-01-30 22:30:04 +00:00
799183e13e make use of phpstan class-string in some areas 2020-01-30 22:23:11 +00:00
260ac47588 add some phpstan array types 2020-01-30 22:23:11 +00:00
4ff4434a22 build/server-phar: mark metadata as mixed[] 2020-01-30 21:49:52 +00:00
5d8bb84269 add more mixed[] to item namespace 2020-01-30 21:48:11 +00:00
9eebfa7cc3 populate missing array value types in root namespace 2020-01-30 21:43:00 +00:00
d3021c6281 populate missing array value types in utils namespace, pass 2 2020-01-30 21:39:15 +00:00
9097d6c4d3 AutoUpdater: fixed type doc for updateInfo 2020-01-30 21:34:26 +00:00
da43ae82fe populate missing array value types in utils namespace, pass 1 2020-01-30 21:30:01 +00:00
60b405d944 populate missing array value types in updater namespace 2020-01-30 21:23:05 +00:00
92a752053d populate missing array value types in tile namespace 2020-01-30 21:20:42 +00:00
0537c66849 populate missing array value types in scheduler namespace 2020-01-30 21:19:15 +00:00
d94995e161 populate missing array value types in plugin namespace 2020-01-30 21:17:13 +00:00
58bc08838b populate missing array value types in permission namespace 2020-01-30 21:14:18 +00:00
fc0619ee6e populate missing array value types in network namespace 2020-01-30 21:12:00 +00:00
a5764b3ae9 populate missing array value types in level namespace 2020-01-30 21:01:59 +00:00
8bf469f7fc populate missing array value types in lang namespace 2020-01-30 20:55:03 +00:00
3b9a5c5ccc populate missing array value types in item namespace 2020-01-30 20:54:38 +00:00
4c36ca58e2 populate missing array value types in inventory namespace 2020-01-30 20:53:41 +00:00
a67fa5c007 populate missing array value types in event namespace 2020-01-30 20:52:54 +00:00
839a789180 populate missing array value types in entity namespace 2020-01-30 20:50:24 +00:00
e61c3e8bf6 populate missing array value types in command namespace 2020-01-30 20:48:14 +00:00
7ce6c8aa13 TimingsCommand: fix confusing indentation 2020-01-30 20:47:33 +00:00
9abcc99c10 Command: fixed spacing of phpdoc on execute() 2020-01-30 20:46:25 +00:00
5c8a625d88 populate missing iterable value types in block namespace 2020-01-30 20:43:13 +00:00
259f0425a9 ClientboundMapItemDataPacket: replace assoc array with MapDecoration class
I thought I'd done this already, but it appears not.
2020-01-30 20:05:18 +00:00
9311437d42 Utils: add some phpstan docs to fix analyse failure
fuck, I wish we had real generics :(
2020-01-30 12:07:14 +00:00
9cdea43794 provide more array type information for Internet functions 2020-01-29 20:45:03 +00:00
e007fad5b8 fix return types for Utils/Internet getURL()/postURL() 2020-01-29 20:43:09 +00:00
5cf2fcbbb7 simpleCurl() second return value is string[][], not string[] 2020-01-29 20:38:19 +00:00
9e6cbb5b6a Internet: fix type information for getURL(), postURL() and simpleCurl() 2020-01-29 20:20:52 +00:00
9492325eef Merge branch 'stable' 2020-01-29 20:01:30 +00:00
5c4487c980 added some callable prototypes for phpstan 2020-01-29 19:56:16 +00:00
68bea6d4aa ChunkRequestTask: fix @var for error hook fetch 2020-01-29 19:36:52 +00:00
64b3d02974 Chunk: remove useless condition from populateSkyLight()
this was detected by latest bleeding-edge PHPStan.
2020-01-29 16:42:42 +00:00
640df1003c add some Generator generics for PHPStan 2020-01-29 16:38:50 +00:00
a604176ac2 Merge branch 'stable' 2020-01-29 16:11:51 +00:00
2b402e525a add some PHPStan-specific callable prototypes 2020-01-29 15:03:55 +00:00
9a5d3e3d4f Merge branch 'stable' 2020-01-28 14:35:50 +00:00
e2871fad8e composer.json: move require-dev next to require 2020-01-28 14:32:55 +00:00
f68452a5d9 updated composer deps 2020-01-28 14:28:03 +00:00
ded0f5c80e network: added some missing native closure return types 2020-01-28 11:10:01 +00:00
85fdb7ec05 CallbackInventoryChangeListener: provide signature information for closures 2020-01-27 18:08:59 +00:00
42014311c5 BrewingStand: added missing void return type 2020-01-27 18:08:08 +00:00
41d02003c2 Install PHPStan and PHPUnit via dev dependencies 2020-01-27 12:04:42 +00:00
35c23ea89a com_exception is no longer missing from phpstan stubs 2020-01-27 09:35:27 +00:00
67e54d6fd6 Merge branch 'stable' 2020-01-27 09:34:48 +00:00
156ecd9bd8 travis: use phpstan 0.12.8 2020-01-27 09:31:27 +00:00
588ff8acf6 Merge branch 'stable' 2020-01-25 18:11:02 +00:00
e66197036d InGamePacketHandler: drop transactions with 0 actions without trying to execute them
often we throw out actions that have no value, which can lead to an empty transaction and re-syncing the inventory. This happens every time we interact with the creative inventory in 1.13+, which causes items to appear to vanish when taking them from the creative menu.
The correct fix for this is to resend only the slots affected by SlotChangeActions, but this fix will suffice for now without rewriting everything.
2020-01-25 18:10:37 +00:00
fa7736efbb phpstan 0.12.7 2020-01-25 17:16:14 +00:00
d71a7ff2fa travis.sh: fix indentation 2020-01-25 17:15:37 +00:00
5955ff5393 fix phpdoc spacing screwed up by phpstorm 2020-01-22 15:20:50 +00:00
8efc4d12ec trim phpdoc lines 2020-01-22 15:18:37 +00:00
0b423c5b96 Merge branch 'stable' 2020-01-22 15:16:10 +00:00
055b13a6cf strip extra blank lines (php-cs-fixer) 2020-01-22 15:14:10 +00:00
8d7a364b29 Empty merge of 'f624871b3fdd04c983c3d37e42b9862ef8f03b68' 2020-01-22 15:09:03 +00:00
a3bffd375b master-specific addendum to cd55cdf5c6 2020-01-22 15:07:47 +00:00
cd55cdf5c6 Merge commit '9cd6b3e1c7cd81d0a4b0da68d9b3ff026c9f6495' 2020-01-22 15:04:06 +00:00
4481474d41 Merge commit 'aad1eb5b3e9b2e3b3db968a000e5454152195d7f' 2020-01-22 15:01:46 +00:00
7f06002027 Merge commit 'bff5bf25aea5cf56bbbfaeaa89f5e1f0ac920c90' 2020-01-22 15:00:13 +00:00
8184a6b114 SkinImage: enforce that height/width must be positive 2020-01-22 14:58:36 +00:00
b8d44ff162 SkinImage: fix formatting error 2020-01-22 14:58:00 +00:00
f6611a38bc Explosion: fix trailing whitespace in explodeA() phpdoc 2020-01-22 14:51:49 +00:00
24ed823d96 WritableBook: remove extra line from phpdoc on setPages() 2020-01-22 14:51:14 +00:00
f624871b3f strip extra blank lines (php-cs-fixer) 2020-01-22 14:50:29 +00:00
9cd6b3e1c7 fix remaining multiline @var annotations 2020-01-22 14:44:36 +00:00
aad1eb5b3e CoreConstants: fix EOF newline 2020-01-22 14:40:03 +00:00
bff5bf25ae LegacySkinAdapter: make resource patch validity check more robust 2020-01-22 14:36:40 +00:00
1b33143f4f pass 2, manual removal of incorrect non-nullable phpdoc types 2020-01-22 12:06:47 +00:00
67bcc1c0fb phpdoc armageddon for master, pass 1 2020-01-22 11:55:03 +00:00
4bae3baa74 Empty merge of stable
easier to reapply these changes than to resolve conflicts
2020-01-22 10:56:43 +00:00
cda90fd7f1 Merge pull request #3280 from pmmp/stable-phpdoc-armageddon
Mass-removal of redundant @param / @return PhpDoc annotations
2020-01-22 10:48:50 +00:00
ccdf003c8d ResourcePacksPacketHandler: fixed chemistry being applied to top of stack instead of bottom
it seems like the stack order is reversed, so all 'regular' in-memory stack behaviour goes out of the window.
2020-01-22 08:26:44 +00:00
9f44adf04a pass 2, manual removal of incorrect non-nullable @param for nullable native types 2020-01-21 15:44:34 +00:00
c4793241f5 Mass removal of useless @param/@return PHPDoc annotations, pass 1 2020-01-21 15:10:18 +00:00
757f5b2fbf Merge branch 'stable' 2020-01-20 18:12:58 +00:00
7532c609fb 3.11.5 is next 2020-01-20 18:06:46 +00:00
13f28d8454 Release 3.11.4 2020-01-20 18:06:46 +00:00
5a97c378fc phpstan: green on level 6, minus iterable types
iterable types are a big pain in the ass because of pthreads' awful architecture, and there's nothing I can do about that without BC-breaking changes to pthreads.
2020-01-20 17:54:55 +00:00
f44c9adbb0 Merge branch 'stable' 2020-01-20 17:33:43 +00:00
545f04b2c8 Utils: apply phpstan generics to cloneObjectArray() 2020-01-20 17:28:26 +00:00
e5d62ec901 phpstan 0.12.6 2020-01-20 17:26:48 +00:00
cfd975009e Leaves: fix decay performance issue
this code was written with references in mind, but it looks like someone forgot the reference.
2020-01-20 11:52:11 +00:00
01016d7e17 Merge branch 'stable' 2020-01-19 19:59:56 +00:00
73257ffde7 updated pocketmine/spl dependency 2020-01-19 19:50:20 +00:00
8252bea699 phpstan: enable MissingMethodReturnTypehintRule
this was a bitch of a job, but it's one step closer to bypassing level 6.
2020-01-19 19:43:52 +00:00
ea935a1af5 pocketmine root: sweep missing return type information 2020-01-19 19:40:01 +00:00
e8a5fa8a37 updater: populate missing return type information 2020-01-19 19:38:41 +00:00
db734675d8 level: populate missing interface return types 2020-01-19 19:38:09 +00:00
6ede56015d level/biome: populate missing return type information 2020-01-19 19:37:08 +00:00
5334099fbf level/format: populate missing return type information 2020-01-19 19:36:34 +00:00
82e9072223 level/format/io: populate missing return type information 2020-01-19 19:35:45 +00:00
2c11742f9e Player: populate missing type information 2020-01-19 19:16:38 +00:00
bd4a63b668 Server: populate missing return type information 2020-01-19 19:09:08 +00:00
cd36af46bf Level: populate missing type information 2020-01-19 18:44:41 +00:00
aa7d55e21d level/generator: populate missing return type information 2020-01-19 18:07:54 +00:00
31e8efa6d1 level/light: populate missing return type information 2020-01-19 18:06:31 +00:00
facca13139 permission: populate missing return type information
PermissibleBase has some redundant phpdoc removed so that the Permissible interface can provide return types.
2020-01-19 17:23:52 +00:00
fffeeddca6 DataPacket: add magic method return types to keep phpstan happy
this really shouldn't be necessary, but it is what it is.
2020-01-19 17:14:34 +00:00
e6ba3ce8a6 item: populate missing return type information 2020-01-19 17:13:33 +00:00
11cae2f0c0 timings: populate missing return type information 2020-01-19 17:12:13 +00:00
f5a18df835 scheduler: populate missing return type information 2020-01-19 17:11:12 +00:00
1cc7027f92 plugin: populate missing return type information 2020-01-19 17:09:33 +00:00
8776b71d63 tile: populate missing return type information 2020-01-19 17:08:40 +00:00
0b9d0f3cdc utils: populate missing return type information 2020-01-19 17:07:48 +00:00
e419d76367 metadata: populate missing return type information 2020-01-19 17:06:48 +00:00
36cde9f352 inventory: populate missing return type information 2020-01-19 17:05:31 +00:00
05c602a044 event: populate missing return type information 2020-01-19 17:05:01 +00:00
0db7e57a15 lang: populate missing return type information 2020-01-19 17:04:25 +00:00
205e47c0c4 entity: populate missing return type information 2020-01-19 17:03:54 +00:00
e328d00cca command: populate missing return type info 2020-01-19 17:02:55 +00:00
ccbcc14600 Block: populate missing return type info 2020-01-19 17:02:03 +00:00
3ee6887792 populate remaining missing return types, using native returns where possible
this is done separately to stable so that stable changes can be integrated easily using an empty merge.
2020-01-19 10:26:35 +00:00
3cf0b50b4a update pocketmine/log and pocketmine/classloader dependencies 2020-01-19 09:58:40 +00:00
b4e6608e9f Merge branch 'stable' 2020-01-18 20:13:54 +00:00
e544bc0d4b Item: added missing return type info for clearCustomBlockData() 2020-01-18 20:11:47 +00:00
fd27227cc7 Item: fix @return annotations for fluent methods (needed for correct auto complete) 2020-01-18 20:10:46 +00:00
df2551ed4d NetworkSession: add missing return type for syncAttributes() 2020-01-18 20:00:05 +00:00
c0a45083b6 Packet: specify void return type in phpdoc (native return type not possible yet) 2020-01-18 19:58:14 +00:00
2b4ce3ea6d Merge branch 'stable' 2020-01-18 19:41:17 +00:00
b42966f61b network: explicitly specify @return void 2020-01-18 19:35:01 +00:00
ca86ec2ec2 Network: added missing return type information for getUpload() and getDownload() 2020-01-18 19:33:27 +00:00
69673e689b Merge commit '97b618340400a93b6f1d56a138ce607450d31c48' 2020-01-18 18:26:51 +00:00
2c1a0ca076 Merge commit 'c7f1b605f25d6945d4f3eea91492e5701c6292fb' 2020-01-18 18:26:20 +00:00
3317c2a52d Merge commit 'f069df65a8e2e8461be9ffa76f97911622fa19cf' 2020-01-18 18:25:19 +00:00
799db6efed Merge commit '1e624e7bb95bee7083dd6fb8f6e94b29e06a2b3a' 2020-01-18 18:24:43 +00:00
0c19b4e4dd Merge commit 'f16a53084931eaee7f2768071763548a785c8960' 2020-01-18 18:24:12 +00:00
9d42e50ae7 Merge commit '7137b8a8a4aadf9841e99a0a305c3c39b68051b6' 2020-01-18 18:23:38 +00:00
886ac4b788 Merge commit 'ab57914322d8e93790a88604b9bb3046a759da22' 2020-01-18 18:22:57 +00:00
ebce102167 Merge commit '260869c0d5904401178419c99e1f26e32b6ba07e' 2020-01-18 18:22:12 +00:00
835383b3c4 Merge commit '9135877da1e4a859ccc356fb914eca3f4a8f0cb8' 2020-01-18 18:20:33 +00:00
47ceb7fee2 Merge commit '07cb603231d143314c2bb69d6e3ee0dc281523a0' 2020-01-18 18:19:13 +00:00
489a1470dc Merge commit 'c22576a2668af4fb90d06f11d8b188a40d004832' 2020-01-18 18:16:04 +00:00
987e69bf1b Merge commit 'bac788fd00f02ca17591c8c34deae420defefc36' 2020-01-18 18:15:26 +00:00
a79021a83a Merge commit 'f6d96c58276bffe20d2444eeb5f4a638b0d78c02' 2020-01-18 18:15:00 +00:00
48a9e2a7ae Merge commit '2d2c9379cd482938026d65a6d6df8bcac0af30e9' 2020-01-18 18:14:15 +00:00
cd5b32c5b2 Merge commit '3400771770f820bd0936234d7081b1408afb18a8' 2020-01-18 18:12:40 +00:00
f97bdf64d9 Merge commit 'e12ecaf62960dfc71871520e52787589447346ee' 2020-01-18 18:11:53 +00:00
be821ea15e Merge commit '1303cbfe02bb6b5d36700f01f6b478a9be760470' 2020-01-18 18:10:32 +00:00
7762b73647 Merge commit 'd9bbab54f4608954a8ac0fffa88c2f32c07669f1' 2020-01-18 18:07:45 +00:00
97b6183404 PermissionManager: add native return types to private functions 2020-01-18 17:59:10 +00:00
0587d03c03 PluginDescription: add native return types to private functions 2020-01-18 17:57:24 +00:00
c7f1b605f2 PluginBase: remove useless duplicate doc comment from onLoad() stub 2020-01-18 17:56:44 +00:00
f069df65a8 PermissibleBase: added native returm types to private functions 2020-01-18 17:54:13 +00:00
1e624e7bb9 Attribute: add missing @return $this annotations 2020-01-18 17:50:58 +00:00
f16a530849 MainLogger: add native return types to private functions 2020-01-18 17:47:38 +00:00
7137b8a8a4 Config: added native void return types to private functions 2020-01-18 17:46:25 +00:00
ab57914322 CraftingDataPacket: added native return typehints to private methods 2020-01-18 17:45:15 +00:00
260869c0d5 Position: populate missing return type information for fromObject() 2020-01-18 17:44:14 +00:00
9135877da1 SetupWizard: add native void typehints to private methods 2020-01-18 17:39:06 +00:00
07cb603231 Liquid: add missing return type to getFluidHeightPercent() 2020-01-17 13:58:54 +00:00
f59094e6d6 Fence: add missing return type to canConnect() 2020-01-17 13:58:29 +00:00
d8acae5495 Door: add missing return type to getFullDamage() 2020-01-17 13:57:56 +00:00
239fe909be CobblestoneWall: add missing return type for canConnect() 2020-01-17 13:57:29 +00:00
c22576a266 CrashDump: add void native return types to private methods 2020-01-17 13:55:38 +00:00
bac788fd00 Timezone: add missing return type for detectSystemTimezone() 2020-01-15 20:18:35 +00:00
00869e81ba NetworkBinaryStream: fix server crash on wrong skindata size, close #3276 2020-01-15 19:48:25 +00:00
f6d96c5827 DataPacket: clean() returns $this, not void 2020-01-14 17:30:48 +00:00
b1458db47b Revert "CraftingDataPacket: fixed trying to return void result of parent function"
This reverts commit e12ecaf629.
2020-01-14 17:16:17 +00:00
2d2c9379cd DataPacket: apply @return void annotations to make phpstan happy
this eliminates 250+ errors on level 6.
2020-01-14 15:39:07 +00:00
3400771770 DataPacket: add missing return type info for pid() 2020-01-14 15:38:24 +00:00
e12ecaf629 CraftingDataPacket: fixed trying to return void result of parent function 2020-01-14 15:37:06 +00:00
1303cbfe02 UUID: add some missing return type annotations 2020-01-14 15:35:46 +00:00
ad4a211cba Color: add missing return type annotation for fromABGR() 2020-01-14 15:35:14 +00:00
d1e56c4611 Location: add missing return types for getYaw() and getPitch() 2020-01-14 15:34:40 +00:00
d9bbab54f4 Entity: fixing position and velocity sync on start/stop movement, closes #3133
the delta for velocity sync is WAYYYYYY too big, but that's a task for another commit.
2020-01-14 13:08:38 +00:00
07cf4eb7a9 Revert "Create .sonarcloud.properties"
This reverts commit 50a7663369.
2020-01-13 21:46:38 -06:00
50a7663369 Create .sonarcloud.properties 2020-01-13 21:31:36 -06:00
a4b810977a Merge commit '651ef500a3be530f5bf1f72990c711706eab3ca7' 2020-01-13 19:29:38 +00:00
f2f4715d97 Merge commit '30f2e7527818e3275ceb0ff26093c4f26a84c51c' 2020-01-13 19:17:54 +00:00
0e1cea043a added some phpstan-specific generic type annotations 2020-01-13 15:05:02 +00:00
acaa34785f Merge commit '2cfc25b4f8f084c155a871934a10cc9010b05f7d' 2020-01-13 11:02:01 +00:00
724ce2a674 Merge commit '5bded9cff86e7814af34b9799953685bdc88240e' 2020-01-13 11:00:45 +00:00
651ef500a3 Make pocketmine\PATH and pocketmine\RESOURCE_PATH always available
these are non-dependent on environment, so they can be determined with no external input.
    This fixes 2 PHPStan issues, fixes some code that couldn't run outside of PM, and makes it easier to write code that depends on PM.
2020-01-13 10:55:54 +00:00
30f2e75278 phpstan 0.12.5 2020-01-12 16:57:43 +00:00
2cfc25b4f8 phpstan: enable checkGenericClassInNonGenericObjectType 2020-01-11 23:04:16 +00:00
5bded9cff8 AttributeMap: add phpstan generic parameters for ArrayAccess 2020-01-11 23:03:21 +00:00
eba246eab3 SignText: provide typeinfo for checkLineIndex 2020-01-11 22:39:42 +00:00
9c06c1a06f Merge branch 'stable' 2020-01-11 22:36:57 +00:00
56a459ccee updated composer dependencies 2020-01-11 22:13:07 +00:00
5816ff85ba don't depend on phpstan 0.12.4 phpdoc inheriting
this causes build failure because the parameter names are different to
the base class.
2020-01-11 22:08:16 +00:00
8f7d8347ee update pocketmine/spl dependency 2020-01-11 22:05:37 +00:00
3614d9a78d phpstan: enable MissingMethodParameterTypehintRule 2020-01-11 21:54:42 +00:00
818d0e19ab RCONInstance: remove always-false branch (readPacket() never returns null) 2020-01-11 21:54:03 +00:00
17720041a3 phpdoc: populate missing parameter typeinfo 2020-01-11 21:53:24 +00:00
9c8095b0b4 Merge branch 'stable' 2020-01-11 21:51:17 +00:00
c329ff7d4f SubChunk: remove nonsensical reference from internal function 2020-01-11 21:49:33 +00:00
96b91af66a Merge branch 'stable' 2020-01-11 21:41:38 +00:00
8794292788 remove &$var reference notations in phpdoc
this isn't required by the spec and PHPStan chokes on it. I was previously having it ignore these errors, but it turns out that PHPStan is not making use of extended typeinfo provided if it can't parse the tag, which is problematic on level 6 and also a problem for array-of-type. Therefore, we are going to have to take the hit.
2020-01-11 21:20:55 +00:00
43601e57bf Merge branch 'stable' 2020-01-09 21:08:16 +00:00
0a39e580e9 MainLogger: log exception chains in logException(), closes #2447
this method is simpler than #2447 and easier to apply to stable.
2020-01-09 21:01:12 +00:00
c4580dd56d MainLogger: extract a printErrorMessage() function from logException() 2020-01-09 20:51:13 +00:00
fab81d28bc MainLogger: always log exceptions with CRITICAL level
if we reached this point, it's almost always due to a general exception handler which doesn't know what else to do with the error.
2020-01-09 20:44:21 +00:00
05a450df87 Merge branch 'stable' 2020-01-09 20:16:17 +00:00
039478223e phpstan: enable MissingFunctionReturnTypehintRule 2020-01-09 20:14:15 +00:00
64b5db4bf2 bootstrap: add some @return annotations for phpstan 2020-01-09 20:13:53 +00:00
c85f4256c7 phpstan: enable MissingFunctionParameterTypehintRule 2020-01-09 20:10:15 +00:00
1192b8bdf1 bootstrap: add PhpDoc to critical_error to make phpstan happy
it wants phpdoc or typehints, and we can't provide typehints because bootstrap needs to be compatible with old PHP versions.
2020-01-09 20:09:33 +00:00
715a5c55f4 Merge branch 'stable' 2020-01-09 20:02:22 +00:00
6dcd2a4ece phpstan: start phasing in some level 6 checks 2020-01-09 19:56:04 +00:00
16bab02b13 actually use the DisallowEnumComparisonRule (derp) 2020-01-09 17:54:52 +00:00
aba71762e9 master-specific @var annotations 2020-01-09 17:50:01 +00:00
cda1143a79 Merge branch 'stable' 2020-01-09 17:17:42 +00:00
e0ed123236 Merge commit 'cda3e6f4dcc5a642c6c2597b77df7f29ecbb9397' 2020-01-09 16:49:04 +00:00
c73001d65e Merge commit 'e6a58e269099a7942d157a214beacc6c30f5617d' 2020-01-09 16:46:58 +00:00
220b28dd27 Merge commit '27350c4673dff62eed6d52633f4a0c776fdbd60c' 2020-01-09 15:29:39 +00:00
3fff0a0656 BigTree: evict unmaintained dead code
phpstan whines about all this stuff, and everything left is private, so we can get rid of it. Sadly we can't ditch the class without breaking BC, so that sticks with 4.0.
2020-01-09 14:26:46 +00:00
e1e1bfa5e3 CompressBatchedTask: remove useless code causing build failure
assuming that pthreads does not have leak issues, this code is pointless, and if pthreads does have leak issues, this may not prevent them anyway.
2020-01-09 14:19:35 +00:00
1eedac87b2 added missing @var property types (reported by phpstan) 2020-01-09 14:13:54 +00:00
cda3e6f4dc PluginDescription: clean up type information for extensions field 2020-01-09 11:20:01 +00:00
a733f094ac phpstan: added a custom rule to disallow strict equality operators on enum members
comparing enums with equality operators is unreliable because there is no guarantee that the enum objects won't be somehow duplicated, through serialization, cloning or ext-parallel dumb object copying. This means that two equal enum objects may not be thw same object.
2020-01-08 19:45:05 +00:00
e6a58e2690 format/leveldb: fix crash on truncated level.dat file 2020-01-08 09:55:03 +00:00
e76cc8eb33 RakLibPacketSender: fixed session leak on server-side disconnect 2020-01-07 11:32:23 +00:00
27350c4673 3.11.4 is next 2020-01-04 16:46:55 +00:00
0d5704b156 Release 3.11.3 2020-01-04 16:46:55 +00:00
fde888bf59 Merge commit 'f3550446267f975b33219bdde6aec8fbea614cb2' 2020-01-04 16:36:33 +00:00
40936c42f2 Empty merge of commit '4794ba236a551bd839bbb8565474c19f93d97c30' 2020-01-04 16:26:29 +00:00
305b4007d2 Merge commit '6490a49c702d0a3a9f62ffb915ffa22272f17b08'
# Conflicts:
#	resources/vanilla
#	tests/travis.sh
2020-01-04 16:25:40 +00:00
dd5be9692c Merge commit '5cd7e11b298a35bf796b41b577c28441e41ff411' 2020-01-04 16:24:29 +00:00
0050e12515 Merge commit '9232f4509c4b74718bce2d8f33ba71ca74b38d97'
# Conflicts:
#	resources/vanilla
2020-01-04 16:21:31 +00:00
d25e0c3d98 Merge commit 'cef77907c6b21e1fb167bc3085d00a5b1e740813'
# Conflicts:
#	resources/vanilla
#	src/timings/TimingsHandler.php
2020-01-04 16:21:05 +00:00
2cfb7000ae Empty merge of '06ec8b83978fcc52a7964d678a97c73b50a97aa8'
this change has been reverted, so this is just to bring the branches
inline.
2020-01-04 16:18:44 +00:00
f355044626 resources: do not remove client-side resource packs when forcing resources
I wanted to make this into a dedicated option, but it had some side effects (see 4794ba236a).
I'll settle for just disabling this useless behaviour, since we have other ways to force vanilla resources anyway; setting this flag to always-false has no user-facing effects anyway.
2020-01-04 16:14:08 +00:00
4794ba236a Revert "resource packs: added new option remove_client_resources, fixed client packs being removed when forcing resource pack download"
This reverts commit 06ec8b8397.

unfortunately, this had some unanticipated side effects, thanks to
idiotic behaviour in the client ... when having optional downloads but
trying to force resources, the client chokes because it thinks the
server is forcing it to apply a pack that it doesn't have. Since
there's no way to detect when this problem occurs in the protocol, the
only option is to revert this.
2020-01-04 16:04:07 +00:00
6490a49c70 tests: drop lint.sh - no longer needed now that we have PHPStan 2020-01-04 15:23:53 +00:00
5cd7e11b29 Use specialized build script for Travis 2020-01-04 15:15:01 +00:00
08e3b8ffdc build: added specialized script to create a server phar
this is much easier to use than devtools, and allows us to make additional specializations for PM build that would otherwise just be a colossal pain in the ass.
2020-01-04 14:56:53 +00:00
9232f4509c TimingsHandler: don't bail on redundant attempts to stop non-running timers
while it would be nice to bail, providing the environment to allow bailing without breaking stuff requires some complex changes that would reduce performance when timings is not running. Considering the limited usefulness of bailing here anyway, and the fact that it just has to be prevented to not have side effects, it doesn't make a whole lot of sense right now.

closes #3261, closes #3269, closes #3254
2020-01-04 14:44:55 +00:00
cef77907c6 Timings: fixed grandparent timers not working correctly, closes #3229 2020-01-04 13:23:04 +00:00
06ec8b8397 resource packs: added new option remove_client_resources, fixed client packs being removed when forcing resource pack download 2020-01-04 13:16:47 +00:00
cbc6bb29bc Merge commit 'ee08286ecaf76cd11914c5a3e914093b991c32db' 2020-01-04 12:08:47 +00:00
aaa81fb346 Merge commit 'a83211f96a64167f4334a83b12bef31b4b7d55d2' 2020-01-04 12:00:57 +00:00
9336b963a6 Merge commit '0b3c4ee4964faba76e1880abcf237fe6860f5248' 2020-01-04 12:00:20 +00:00
79aa4959b8 Merge commit 'a9081979071ec8ad56d14474cfbc48b5c60fb440' 2020-01-04 11:28:21 +00:00
ee08286eca moved git hash detection code to its own unit 2020-01-02 21:01:31 +00:00
a83211f96a VersionInfo: add strict_types to stop CS tools screwing with it 2020-01-02 20:05:50 +00:00
0b3c4ee496 bootstrap: don't choke on paths that have spaces in them 2019-12-30 11:58:44 +00:00
54de518634 bootstrap: fixed incorrect git hash detection when cwd is not the repo root 2019-12-30 09:09:47 +00:00
a908197907 Effect: document that duration is expected in ticks 2019-12-29 19:03:32 +00:00
9204b11948 phpstan: 0.12.3 fixes for master 2019-12-29 17:55:03 +00:00
cccade9ade Merge branch 'stable' 2019-12-29 15:31:10 +00:00
3e23a568ca phpstan: properly fixing FPs on constant comparisons 2019-12-29 14:25:44 +00:00
dadc5c1b87 3.11.3 is next 2019-12-29 13:11:30 +00:00
a37d740111 Release 3.11.2 2019-12-29 13:11:30 +00:00
2de0ec02ba phpstan 0.12.3 2019-12-28 17:22:08 +00:00
6968a4232e Merge commit 'd83820477fe905a85a4d1fd11bad1dba211f0f4f' 2019-12-25 14:20:38 +00:00
0f718ea28b Merge commit '8726604899d1a371567141e0831ed570d3233356' 2019-12-25 14:19:35 +00:00
27fa73a4d2 Merge commit '216138a37e52e545abdba5a3600eabbcced867be'
# Conflicts:
#	resources/vanilla
2019-12-25 13:53:25 +00:00
e845415b17 Merge commit 'b08c38f8f9615e47ae3e5df8267b8986aadabead'
# Conflicts:
#	resources/vanilla
2019-12-25 13:52:50 +00:00
b6071bff36 Merge commit '911b6feaf927a7dd9f54240d9bf6b0f7684df692' 2019-12-25 13:52:21 +00:00
e214ef0d13 Merge commit '2cb6990698e2575e0b64fef7e5172d9dd9694ff6' 2019-12-25 13:45:33 +00:00
bfc2a9107c Merge commit 'f7d66613df87f5bd3586daf02922af0a64efdce5' 2019-12-25 13:41:31 +00:00
d83820477f TimingsHandler: throw on attempt to stop timer that is not running
I do not think that this bug is in effect in the core code, but I can't be sure.
2019-12-21 13:17:40 +00:00
8726604899 Merge #3251: Remove usages of empty() 2019-12-19 11:08:08 +00:00
9cbe378e8c Timezone: fix possible crash on CentOS 2019-12-18 11:23:24 +00:00
494660102e Replace empty() usages with count() 2019-12-18 11:23:24 +00:00
216138a37e PlayerAuthInputPacket: Fix assigning variable in static context 2019-12-17 22:04:24 +08:00
b08c38f8f9 build/make-release: remove redundant require_once
this is included by vendor/autoload.php since 3.7.x.
2019-12-17 11:47:07 +00:00
911b6feaf9 NetworkInventoryAction: remove dead code
the trading & beacon types need to be checked as well, but I don't have the tools to check that right now.
2019-12-17 11:17:40 +00:00
2cb6990698 Enchantment: don't throw exceptions on out of range IDs
this function is used for data deserialization, and data may have bad enchantment IDs in it.
2019-12-14 10:04:51 +00:00
f7d66613df CompletedUsingItemPacket: added missing #include, closes #3219 2019-12-13 19:50:40 +00:00
f7eea9bebb Merge branch 'stable' 2019-12-13 18:23:01 +00:00
7c15fd6b00 Merge commit '9e1f6a24868823ad06edb6a79d0cb391e637bcb8' 2019-12-13 18:21:57 +00:00
95c32d26df Explosion: fixed ray trace getting stuck on a block when it encounters an empty subchunk
this might have caused unexpected behaviour in large caves.
2019-12-13 18:07:59 +00:00
bcc3e20c31 DiskResourceProvider: do not arbitrarily suffix /resources/ 2019-12-13 17:58:53 +00:00
9e1f6a2486 protocol: updated particle IDs 2019-12-13 10:52:09 +00:00
81620441a4 CompoundTagMetadataProperty: fix unhandled exception when decoding 2019-12-12 20:27:40 +00:00
0a4a1f634f Item: fixed possible type violation in jsonDeserialize() 2019-12-12 20:26:26 +00:00
771ccbb727 Server: require a DynamicClassLoader instance 2019-12-12 20:13:51 +00:00
c36377ea5a Merge branch 'next-minor' 2019-12-12 19:47:12 +00:00
870c66d1fe Merge branch 'stable' into next-minor 2019-12-12 18:29:04 +00:00
76994f15ac phpstan: green on level 5 2019-12-12 18:27:26 +00:00
cf73d74bd0 format/anvil: fixed possible type violation on saving chunk 2019-12-12 18:24:21 +00:00
37a8d95464 world IO: fixed crashes when garbage data found in tile/entity NBT data 2019-12-12 18:21:23 +00:00
9a4b72add5 PlayerInventory: fix type violation when calling equipItem() for non-Player holder 2019-12-12 16:31:22 +00:00
919534d978 EnderChest: fixed crash when plugins overwrite tile classes with incompatible ones
relates to 47a959dace
2019-12-12 16:28:30 +00:00
cb598155a4 Server: add @return annotation to crashDump() to make phpstan happy
this is technically a bug in PHPStan, but it's easier to do this than report a bug.
2019-12-12 16:19:57 +00:00
00888fdc55 TranslationContainer::__construct() accepts float and int too (they can be casted to string) 2019-12-12 16:19:04 +00:00
77795ae3bc BaseLang::translateString() accepts float and int too (they can be casted to string) 2019-12-12 16:18:11 +00:00
f39fc7e525 CompressBatchedTask::__construct() accepts Player[] not string[] 2019-12-12 16:16:48 +00:00
77f7595e0e Location::__construct() accepts floats for x,y,z 2019-12-12 16:16:16 +00:00
e8d3a25028 Position::__construct() accepts floats for x,y,z 2019-12-12 16:15:49 +00:00
1370930ea9 Entity: remove redundant defaults from lastX lastY lastZ, remove nullability
these fields are never null because they are initialized in the constructor, and they are never written to with null nor ever expected to be null.
2019-12-12 16:14:30 +00:00
1c6d3cd580 master: green on phpstan level 4 2019-12-12 15:25:15 +00:00
6ace4733ce DataPacket: fixed var_dump() buffer bin2hex not working
in BinaryUtils new versions, BinaryStream->buffer is private.
detected by phpstan level 4
2019-12-12 15:02:42 +00:00
9a31cbf5ef ChunkCache: fixed possible undefined offset crash in restartPendingRequest() 2019-12-12 13:55:30 +00:00
137245ed7b ItemFactory: fix var type doc in get() 2019-12-12 13:54:44 +00:00
89458660cf VanillaEffects: return null instead of throwing on invalid effect ID
we don't expect plugin devs to be using this any more, and it doesn't make sense to throw on data deserialize. This throw was unchecked and a potential server crash might have occurred in Living on data load.
2019-12-12 13:54:05 +00:00
a9c09e4517 Merge branch 'next-minor' 2019-12-12 13:52:14 +00:00
1a467420e3 Merge branch 'stable' into next-minor 2019-12-12 13:07:02 +00:00
70c3008b7b phpstan: green on level 4 2019-12-12 13:00:57 +00:00
46930b98b7 Timings: add a dedicated field for checking initialization 2019-12-12 12:59:01 +00:00
92be8c8ec0 PopulationTask: don't assume anything about TLS return values
while these SHOULD be what we say they are, it's possible for something else to overwrite them with junk and make the server catch fire.
2019-12-12 12:19:54 +00:00
62069bc7af Level: fix return type content doc comment for getAdjacentChunks() 2019-12-12 12:18:35 +00:00
26230c1f9b Player: don't report never-played for a disconnected player
this should catch fire like everything else does.
2019-12-12 12:17:52 +00:00
a9fafbc5eb BanEntry: remove nullable return from parseDate()
this function never returns null
2019-12-12 11:59:41 +00:00
b8778cb791 LevelProvider: fix doc comment of ::generate()
this raised false positives on phpstan level 4
2019-12-12 11:59:12 +00:00
73c5fe5cf9 BaseInventory: correctly annotate content type of slots field
fixes warnings on phpstan level 4
2019-12-12 11:58:11 +00:00
b3cfa5a3a0 TimingsHandler: use weak comparison for stopTiming start check
this could be an int or float, and 0 !== 0.0.
2019-12-12 11:48:34 +00:00
6127a02a8b phpstan 0.12.2 2019-12-12 10:43:45 +00:00
6935030e0c entity: use 0 for no-target a la vanilla 1.13, fix player arms bug
I have no idea why this was changed, -1 is still used for every other property, but packet traces confirm this is correct.
2019-12-12 00:20:09 +00:00
80917692c1 Merge branch 'stable' 2019-12-11 23:37:36 +00:00
a1610500e9 Merge tag '3.11.1' 2019-12-11 23:35:20 +00:00
c926674d07 Merge commit '95683642774b1896c5de6f09dd528c1d3766d04d' 2019-12-11 23:26:40 +00:00
4651bcf8c3 master: imports cleanup
it was easier to make an empty merge and re-run php-cs-fixer afterwards.
2019-12-11 23:23:03 +00:00
62f9991e17 Merge commit '73d4ff6b52189c0a15ea7a2c9bd57af178d234f2' 2019-12-11 23:18:00 +00:00
19f75768ed Merge commit '1a99938e4b5af0295e449379dbdb0a3ffe703efd' 2019-12-11 23:15:48 +00:00
2714c7ab59 Merge tag '3.10.1'
it looks like the changes were already integrated by the previous merge,
which I screwed up with a stash.
2019-12-11 23:13:02 +00:00
c85c1c3c3f Merge commit '82d9e481d2a0a389fbbc6dfd3672fc366127febc' 2019-12-11 23:06:35 +00:00
dbca36e5e2 SkinImage: throw on wrong data length 2019-12-11 22:45:14 +00:00
1171bae691 login: read the correct key SkinAnimationData 2019-12-11 22:40:05 +00:00
494f8e8251 login: fixed missing base64_decode() for animation images 2019-12-11 22:39:40 +00:00
40a2211a5a Release 3.11.1 2019-12-11 20:20:26 +00:00
3c9af56e06 3.11.2 is next 2019-12-11 20:20:26 +00:00
0196aa21d7 updated BedrockData submodule, close #3222, close #3223 2019-12-11 20:19:17 +00:00
833f3e574b 3.11.1 is next 2019-12-11 18:35:03 +00:00
a386ff8ce7 Release 3.11.0 2019-12-11 18:35:03 +00:00
e6c3b0fc0d Changes for 1.14
there are no protocol changes in 1.14 that matter; the reason the protocol version has been bumped is because of new blocks, items, mobs and recipes.
2019-12-11 18:32:22 +00:00
0e1321933f ScriptCustomEventPacket: added missing interfaces 2019-12-10 10:41:36 +00:00
9568364277 fix minor formatting issue in SkinAdapterSingleton 2019-12-09 21:19:15 +00:00
73d4ff6b52 more missed function imports 2019-12-09 21:16:35 +00:00
7e98aa1497 leveldb: remove usage of multi-import statement
this doesn't conform to the code style.
2019-12-09 20:28:02 +00:00
f00c69c513 added missing function imports 2019-12-09 20:13:02 +00:00
50a4c42f3f NetworkBinaryStream: fix misplaced import 2019-12-09 19:53:32 +00:00
6b61efcfc8 remove unused imports 2019-12-09 19:49:21 +00:00
1a99938e4b LegacySkinAdapter: clean up nonsensical code ordering 2019-12-09 18:26:20 +00:00
a4d68fb32b LegacySkinAdapter: fix some wacky cape handling logic
I added checks for length validity locally and ran into some interesting behaviour because of this code.
2019-12-09 18:16:46 +00:00
97866cd8f6 updated RakLib dependency 2019-12-09 11:27:00 +00:00
3fa628f259 updated NBT dependency 2019-12-09 11:26:43 +00:00
02fcfcc383 Merge branch 'stable' into next-minor 2019-12-09 10:47:53 +00:00
ab628d0254 Merge tag '3.9.8' 2019-12-08 17:49:39 +00:00
705228f427 Chunk: remove useless field defaults 2019-12-08 11:08:07 +00:00
6b21f160bd Chunk: fix type docs for NBTentities and NBTtiles 2019-12-08 11:07:14 +00:00
af6cb605c5 Chunk: fix data loss caused by d3d7709ead 2019-12-08 11:02:40 +00:00
4eb59c0372 Release 3.10.1 2019-12-07 16:41:41 +00:00
5682cc8d53 3.10.2 is next 2019-12-07 16:41:41 +00:00
3486db3f1b update RakLib to 0.12.6 2019-12-07 14:20:35 +00:00
733d530ed0 fixing EOF newlines on new files 2019-12-07 10:08:29 +00:00
c10ce84035 fix invisible legacy skins which have empty geometry names 2019-12-07 10:02:22 +00:00
82d9e481d2 3.10.1 is next 2019-12-06 20:53:15 +00:00
d27c7f7141 Release 3.10.0 2019-12-06 20:53:15 +00:00
394c999710 Merge branch 'drew-1.13' into stable 2019-12-06 20:38:49 +00:00
6399dacba7 Release 3.9.8 2019-12-06 20:33:51 +00:00
b6bbf655d7 InventoryTransactionPacket: fixed crafting flags being set on useless empty transactions
this fixes some misleading debug noise when getting stuff from creative inventory and triggers some different spam instead.
2019-12-06 20:08:09 +00:00
3d2c018442 BiomeDefinitionListPacket: load pregenerated data from file 2019-12-06 11:32:33 +00:00
da8c54cf8b AvailableEntityIdentifiersPacket: load pregenerated data from file 2019-12-06 11:31:55 +00:00
8e984a1bc3 RuntimeBlockMapping: use new data, item frames & doors fixed
floor & ceiling item frames not supported though
2019-12-06 11:31:18 +00:00
124e60301a updated submodule to pmmp/BedrockData@a38b427888 2019-12-06 11:26:58 +00:00
4d13c48e5c UPnP: COM constructor never returns false anymore 2019-12-05 16:07:06 +00:00
9159e8f002 MainLogger: mark static logger field as nullable 2019-12-05 15:48:58 +00:00
f5aa461945 GlobalConstants: assume we are on 64-bit when declaring INT32_MASK
fixes a FP reported by phpstan level 4
2019-12-05 15:48:11 +00:00
16817ff301 Player: remove superfluous conditions for RESPAWN action handling
spawned is always true here because of the condition at the top of the function.
isOnline() is always true here because the handler won't even be called if it isn't.
2019-12-05 14:52:12 +00:00
18863b1098 Player: remove superfluous check from processMovement()
if we reached this branch, revert is always false because it is not modified between this branch and the parent one.
detected by phpstan level 4
2019-12-05 14:47:15 +00:00
ff5aedaf6b master: green on phpstan level 3 2019-12-05 14:35:02 +00:00
a5e8419d5b Merge branch 'next-minor'
# Conflicts:
#	phpstan.neon.dist
#	resources/vanilla
#	src/item/WritableBookBase.php
#	src/pocketmine/metadata/MetadataStore.php
#	src/world/Position.php
2019-12-05 14:11:59 +00:00
e3cffca34b StartGamePacket: fixed possible type violation on decoding block table 2019-12-05 11:05:34 +00:00
d20d9fb689 Merge branch 'stable' into drew-1.13 2019-12-05 10:59:53 +00:00
7d89f91fea Leaves: fixed decay
detected by phpstan level 4
2019-12-04 23:21:01 +00:00
48e2473696 Position: mark world field as nullable (equivalent to 39c607cbd5) 2019-12-04 22:58:55 +00:00
59793d4b68 Player: mark networkSession field as nullable
while we do null this to break cycles, we also null it for other purposes, and it's null-checked in a few places.
2019-12-04 22:54:04 +00:00
fb78ec1f62 AsyncTask: mark threadLocalStorage static field as nullable 2019-12-04 22:50:30 +00:00
908aa20eff EntityFactory: fixed type doc of knownEntities 2019-12-04 22:49:25 +00:00
09961b5cd0 Merge branch 'stable' into next-minor 2019-12-04 22:16:04 +00:00
7b1ae2a822 phpstan: green on level 3 2019-12-04 22:12:14 +00:00
8ecf5e02b9 bad fix for WritableBook phpstan warning
master has this shit so much better
2019-12-04 22:00:19 +00:00
39c607cbd5 Position: mark level field as nullable
allowing the level to be null is, to be honest, a big design flaw, but one that can't be fixed without BC breaks.
2019-12-04 21:31:35 +00:00
d867ffc60d MetadataStore: fix some doc comments 2019-12-04 21:14:09 +00:00
0e3ce7ff39 Merge branch 'next-minor' 2019-12-04 19:59:57 +00:00
71a472e0eb Merge branch 'stable' into next-minor 2019-12-04 19:52:01 +00:00
c57eb26fd5 phpstan-bugs: add some extra patterns for level 3 false positives 2019-12-04 19:50:15 +00:00
c35d91a104 phpstan: allow blanket ignoreErrors in src to reduce merge work for master 2019-12-04 19:42:18 +00:00
9fc260fb1a keep phpstan.neon.dist ignoreErrors sorted by file 2019-12-04 19:38:54 +00:00
b43bd5fb67 PluginCommand: separate CommandExecutor param
looking at the code now it's clear that this class combines two jobs into the same class.
closes #3203
2019-12-04 19:14:52 +00:00
2ff25dfbd2 Color: make mix() first parameter mandatory, closes #3204 2019-12-04 18:39:14 +00:00
60154d8127 SubChunkIteratorManager: assert type of subchunk to make PHPStan happy
we know this should be a SubChunk, even though it doesn't.
2019-12-04 18:26:18 +00:00
e35a92d8e8 tile\Banner: fixed bad default value for patterns field
detected by PHPStan on level 3
2019-12-04 18:25:08 +00:00
850dbb38c6 phpstan-bugs: remove false positive that is fixed in 0.12.0 2019-12-04 11:38:01 +00:00
c0ea871599 updated rules for master on PHPStan 0.12 2019-12-04 11:35:57 +00:00
117e46f639 LevelDB: fix doc comment handling for deserializeLegacyExtraData() 2019-12-04 11:29:41 +00:00
66aa940ed1 Item: fixed foreach doc comment in deserializeCompoundTag()
detected by PHPStan 0.12.0
2019-12-04 11:28:59 +00:00
dc5d985cf4 Merge branch 'next-minor' 2019-12-04 11:23:30 +00:00
e65bc5c3ae Merge branch 'stable' into next-minor 2019-12-04 11:11:29 +00:00
73d0f799c2 Update to PHPStan 0.12.0 2019-12-04 10:29:49 +00:00
ecb2e6e3af PluginManager: remove useless information from softDepend debug
we don't report the parameter type anywhere else, and since PHP doesn't support overloading, we don't need to.
This fixes PHPStan 0.12 complaints about ReflectionNamedType. I figured this was the best solution instead of adding an extra few lines of code.
2019-12-04 10:17:25 +00:00
7b75b6928d AvailableCommandsPacket: fixed foreach docs
these probably aren't necessary at all to be honest.
2019-12-04 10:15:50 +00:00
753a8a6937 Event: remove useless @var $this annotations
we are not in a trait here, the scope is always Event.
2019-12-04 10:15:04 +00:00
bc76b1cafe Server: remove several redundant @var annotations (copy pasta)
these are all useless because it is implied by the parameter type anyway.
2019-12-04 10:14:15 +00:00
f302517a2d Door: fix deserialization of top flag
it's not clear what bugs this caused, if any, but nonetheless it is incorrect.
2019-12-03 21:04:04 +00:00
962e6162eb Merge branch 'next-minor' 2019-12-03 20:00:08 +00:00
2ae37cc1c5 Merge branch 'stable' into next-minor 2019-12-03 19:59:35 +00:00
00e415fc79 move phpstan.neon to phpstan.neon.dist to allow phpstan.neon to be locally modified for development 2019-12-03 19:57:19 +00:00
29ce829247 fix error counts for UPnP 2019-12-03 17:45:23 +00:00
5b91be81cc Entity: rewrite dbbe1f2d5c for master 2019-12-03 12:16:10 +00:00
54c2778e56 phpstan: update split configs for master branch 2019-12-03 12:08:56 +00:00
5f9ce78814 WorldProviderManager: removed incorrect param doc
this was used to trick phpstorm, but PHPStan doesn't like it, and it isn't consistently used anyway.
2019-12-03 12:08:04 +00:00
fede6b8234 protocol: fixed static analysis warnings in MetadataProperty::equals() implementations 2019-12-03 12:06:57 +00:00
e110ea5aea LoginPacket: fixed param doc for validate() 2019-12-03 11:59:28 +00:00
d3d7709ead Merge branch 'next-minor' 2019-12-03 11:55:45 +00:00
9a67192f74 Merge branch 'stable' into next-minor 2019-12-03 10:45:51 +00:00
dbbe1f2d5c Revert "Entity: remove redundant check from spawnTo()"
This reverts commit 3028832cd3.

When I created this commit, I made the flawed assumption that spawnTo()
would not be used by plugins. In addition, I was not aware that there
are some usages of spawnTo() in the core which do not check for chunk
usage, such as in Player->showPlayer().

This caused a collection of problems including memory leaks and crashes
due to disconnecting players not removing their references from viewed
entities.

The reverted commit may be the cause of #3178.
2019-12-03 10:41:13 +00:00
740f0a2314 crafting now works on 1.13, but it's not good 2019-12-02 21:50:52 +00:00
7fdfe947b0 inventory: fix some transactions being rejected for no good reason
since 1.13, transactions such as interacting with creative inventory cause a spoof windowID 124 slot 50 action to appear which changes air -> air. This currently gets rejected because only cursor is mapped to ID 124, and it only has a single slot.

It is not clear what the purpose of 124:50 is, but this fix filters out any actions which do not change anything, since they won't affect transaction balance anyway.
2019-12-02 21:41:08 +00:00
b7c4379700 StartGamePacket: fixed asymmetry in block table handling 2019-12-02 19:35:55 +00:00
02c1dabc3d update pocketmine/nbt dependency 2019-12-02 19:24:00 +00:00
20b7418916 PlayerAuthInputPacket: added encode & decode, and some aux classes 2019-12-02 15:14:59 +00:00
85521f5e7a EducationSettingsPacket: added encode & decode 2019-12-02 13:57:19 +00:00
f37ea6a203 AvailableCommandsPacket: fix nonsensical placement of HARDCODED_ENUMS 2019-12-02 12:57:05 +00:00
abf8081ebc RuntimeBlockMapping: add a type check for decoded NBT root type
this is kinda redundant since this function can blow up in so many other ways anyway, but it makes PHPStan happy, so it'll do.
2019-12-02 08:21:42 +00:00
8594cb3e74 AvailableCommandsPacket: fixed doc comment for putEnumConstraint() 2019-12-02 08:17:00 +00:00
d155de35ed Merge branch 'dktapps-drew-1.13' into stable 2019-12-01 22:03:03 -05:00
e37c8e3a5d Merge branch 'drew-1.13' of https://github.com/dktapps/PocketMine-MP into dktapps-drew-1.13 2019-12-01 22:02:40 -05:00
e38c0c0fe1 Merge remote-tracking branch 'upstream/stable' into stable 2019-12-01 21:55:50 -05:00
ce27c03774 PlayerChatEvent: fixed crash when non-CommandSender permissibles subscribe to broadcast permission
doing such a thing doesn't make any sense, but the system allows it, so it has to be accounted for.
2019-12-01 21:44:13 +00:00
c4a8781b5c Fixed doc type inconsistencies surrounding chat broadcast handling (several problems that are all related) 2019-12-01 21:40:11 +00:00
dbab8b5733 Level: fixed type doc of tickRateTime field 2019-12-01 21:21:42 +00:00
2b08bbc7b1 Server: fixed type doc comment of nextTick field 2019-12-01 21:18:20 +00:00
17037f5e9c Chunk: clean up nonsensical code in initChunk()
I have no idea why the extra check was there, or why the null assignment was used, because it doesn't make any sense.
2019-12-01 21:14:23 +00:00
fee3c17148 CraftingManager: fixed type doc of craftingDataCache field 2019-12-01 21:06:34 +00:00
25e6cb74b3 Squid: fixed type doc comment of swimDirection field 2019-12-01 21:06:03 +00:00
8d2e59222e Entity: fixed not calculating surrounding blocks on entity creation
it's unclear if this was actually causing any bugs, but if it was it would likely manifest in the form of, for example, not burning in lava.
2019-12-01 21:05:36 +00:00
cd778661c2 Entity: fixed type doc comment for blocksAround field 2019-12-01 21:03:57 +00:00
c2afc05e7c Entity: fix type doc comment for static knownEntities field 2019-12-01 21:03:29 +00:00
9be95bf263 Block: return [] instead of null in getMetadata() (return type is non-nullable) 2019-12-01 21:02:49 +00:00
4b65e1cbe1 Command: fix type doc comment for commandMap field 2019-12-01 21:01:57 +00:00
5caae37768 Server: fixed return type doc comment for getCommandAliases() 2019-12-01 21:00:49 +00:00
92e1811b06 DataPacket: fixed bad null assignment to buffer in clean()
this is never expected to be null, so implicitly relies on PHP magic behaviour to convert it to string when appended.
2019-12-01 20:36:56 +00:00
293c2710d0 PlayerCreationEvent: fixed doc comments for baseClass and playerClass fields 2019-12-01 20:19:59 +00:00
8a7017fd6b Enchantment: fixed doc comment for static enchantments field 2019-12-01 20:16:45 +00:00
15f8886958 phpstan: separate non-PM bugs from the main neon config
everything left in here is now a PM problem that needs to be looked into.
2019-12-01 20:12:41 +00:00
3226a9dc6a phpstan: ignore more optional-leveldb errors 2019-12-01 19:52:49 +00:00
1a1e3ff63b BaseInventory: fixed incorrect & redundant default value for slots field 2019-12-01 19:45:16 +00:00
ea413d0882 phpstan: analyze on level 2, close #3193 2019-12-01 19:32:03 +00:00
0890b5fc99 AsyncPool: assert() that the unstacked task is actually an AsyncTask
it's possible that it might not be if the workers were accessed directly, but that shouldn't be possible.
This also silences a PHPStan warning on level 2.
2019-12-01 19:28:05 +00:00
163ed225f2 NetworkBinaryStream: fixed crash when non-compound root tag is provided for itemstack 2019-12-01 18:41:02 +00:00
a4a6d3e094 PlayerCreationEvent: fixed illegal doc comment types 2019-12-01 18:08:25 +00:00
ecbf3e9722 GamemodeCommand: fix CommandSender assignment causing troubles for type inference on static analyzers
this would never crash, but in strongly typed code it would be a compile failure.
2019-12-01 09:33:12 +00:00
47a959dace block: fix some possible crashes when plugins overwrite tile classes in bad ways
phpstan was complaining on level 2, and it's not wrong to ...
2019-12-01 09:29:22 +00:00
3968f85c82 sync composer dependencies 2019-12-01 08:54:48 +00:00
d8188b807a CraftingDataPacket: read & write potion recipes 2019-11-30 21:18:54 +00:00
8e68655fc7 Merge branch 'stable' into drew-1.13 2019-11-30 21:15:50 +00:00
6d109bfc6f CraftingDataPacket: fixed not retaining cleanRecipes during decode 2019-11-30 21:15:37 +00:00
b7a5a53c9d MoveActorDeltaPacket: flags is now a short 2019-11-30 12:56:16 +00:00
76bd0f452c AvailableCommandsPacket: add special handling for enums which aren't referenced by any command directly
the CommandName enum is a magic enum used by the  argtype.

TODO: It's possible that not sending the CommandName enum might be causing client sided crashes. Investigate.
2019-11-30 12:41:44 +00:00
363556e9b6 AvailableCommandsPacket: encode & decode for enum value constraints
This is a peculiarly overengineered system that is used for restricting access to enum members under certain conditions, e.g. to disallow changing specific gamerules in survival.
2019-11-30 12:31:31 +00:00
6f08853b29 Merge branch 'stable' into drew-1.13 2019-11-30 12:04:46 +00:00
42d8357821 AvailableCommandsPacket: fixed missing decoded overloads with 0 arguments
these should be listed even if they have 0 arguments
2019-11-30 11:58:29 +00:00
0bff5d9bff sync composer deps 2019-11-29 20:20:13 +00:00
994781494f Merge branch 'next-minor' 2019-11-29 12:06:27 +00:00
4cfceeeb8e bootstrap: fix merge error introduced by cb76f8a5df
this error is harmless since it points to a deprecated function, but it showed up as conflicted in master merge.
2019-11-29 12:03:07 +00:00
8ee3d4486a update build/php submodule to pmmp/php-build-scripts@7e985c932a 2019-11-29 11:56:36 +00:00
3e4e0d51df Merge branch 'stable' into next-minor 2019-11-29 11:55:12 +00:00
f2ac63d235 update build/php submodule to pmmp/php-build-scripts@8308571448 2019-11-29 11:54:42 +00:00
5d17405b92 Better checks on resource patch 2019-11-28 19:48:34 -05:00
3dd53ad998 Remove offset for crafting grid 2019-11-28 19:42:34 -05:00
a303c4b294 Add some isset checks to prevent server from crashing on an invalid resourcepatch 2019-11-21 17:58:33 -05:00
fa56290bb4 Reflect StartGamePacket changes in Player 2019-11-21 15:05:09 -05:00
01d6cbe9c3 Added : void typehint to SkinAdapterSingleton & provide documentation 2019-11-21 15:01:34 -05:00
f682c16740 Changed eduMode to eduEditionOffer and added an unsignedVarInt in availablecommandspacket 2019-11-21 14:55:29 -05:00
74c09dc202 Remove inline assignment 2019-11-21 14:49:01 -05:00
0917b67573 Generate param docs for constructor 2019-11-21 14:46:10 -05:00
5cb0eafcb2 Should be checking the string, not an object 2019-11-21 14:24:47 -05:00
221e6db47d Remove persona capes off of classic skins, add checks for empty cape data when converting 2019-11-21 14:21:08 -05:00
8d06018d81 make toSkinData return statement multi lined 2019-11-21 13:54:22 -05:00
600e16d9f6 Fixed floatingtextparticle yet again 2019-11-21 13:54:00 -05:00
4340349db7 Generate getters for SkinData, applied suggested change, and fixed an underfined variable in PlayerListPacket 2019-11-21 13:52:27 -05:00
cb76f8a5df Merge branch 'stable' into next-minor 2019-11-21 23:21:16 +08:00
6105198313 Update AvailableCommandsPacket constants 2019-11-20 22:47:48 -05:00
c96ba13c23 Extract geometry name from resource patch 2019-11-20 22:42:56 -05:00
c8d0cb315b Move persona skin hack to legacyskinadapter 2019-11-20 21:52:49 -05:00
be9c413a9e Added network components for skins, to collect instead of throw out data 2019-11-20 21:43:41 -05:00
3e4366b30d readme: add XLM since Keybase made it so easy
... and also gave lots of keybase users free XLM. Well played, Keybase, you managed to make me adopt Stellar.
2019-11-20 10:51:07 +00:00
7f3460190b Merge pull request #5 from dktapps/drew-1.13
more 1.13
2019-11-12 14:19:31 -05:00
10d44292e1 fix classic capes 2019-11-12 12:27:50 -05:00
70f81334ae MultiplayerSettingsPacket 2019-11-12 11:58:40 -05:00
ead572fab9 fix skin sharing stupidity 2019-11-12 07:08:48 -05:00
ef8e286277 Merge branch 'stable' of https://github.com/drew-mcbe/pocketmine-mp into drew-1.13 2019-11-12 06:57:57 -05:00
ba5a5981a0 Update Player.php 2019-11-12 08:19:05 +00:00
c428596009 AddPlayerPacket: missing field 2019-11-11 16:36:55 -05:00
a81d8dd6d5 Return false in unexpected condition 2019-11-11 16:25:53 -05:00
5bcbef90ea Added variables for getSkin's animation for easier readability 2019-11-11 15:32:48 -05:00
1c67f094e3 Change get and put SkinImage visibility to private 2019-11-11 15:29:57 -05:00
99d350914e Remove convertToLegacyName 2019-11-11 15:29:42 -05:00
49a9e0a880 Remove changes to FloatingTextParticle 2019-11-11 15:26:36 -05:00
7b152def7d Move SkinAnimation and changed SerializedImage to SkinImage
Also change putImage and getImage to getSkinImage and putSkinImage
2019-11-11 15:23:48 -05:00
3eb78fb0ff Merge pull request #4 from dktapps/drew-1.13
moar 1.13 changes
2019-11-11 15:04:33 -05:00
38c759c86e ResourcePackStack: missing field 2019-11-11 14:58:45 -05:00
314ce1d012 build/make-release: push after 5 seconds instead of 10 2019-11-11 16:41:50 +00:00
7fcd40df15 add encode/decode for some new packets 2019-11-11 11:20:37 -05:00
ba39327b28 Merge remote-tracking branch 'origin/stable' into drew-1.13 2019-11-11 10:42:25 -05:00
8d2e3894ef DataPacket: fixed var_dump() not showing private & protected subclass properties 2019-11-11 15:41:08 +00:00
8ee0fbccc5 Merge branch 'stable' of https://github.com/drew-mcbe/pocketmine-mp into drew-1.13 2019-11-11 05:48:17 -05:00
fe4354959b SkinAnimation: fix typo 2019-11-11 10:07:45 +00:00
19377c86a4 PlayerSkinPacket: reduce diff pollution 2019-11-11 09:47:04 +00:00
fb23aade34 Clean up unused imports 2019-11-10 21:49:58 -05:00
57e9fe78a3 change buildPlatform parameter to -1 2019-11-10 21:45:33 -05:00
6b97281c58 Update SkinAnimation constants and docs 2019-11-10 21:41:00 -05:00
da67a085fc Remove unused imports and unused todo 2019-11-10 21:37:55 -05:00
e2fc7cdf88 Friendly BC skins (persona not supported) 2019-11-10 21:04:38 -05:00
635bb08fb9 Update playerskinpacket to use the strings 2019-11-10 19:39:07 -05:00
308d9ce3a8 auto generated baseline 2019-11-10 17:40:04 -05:00
5a76c38363 Merge remote-tracking branch 'origin/stable' into drew-1.13 2019-11-10 17:02:46 -05:00
54530da6c1 reduce visibility of offset to private 2019-11-10 00:09:29 -05:00
dd55a0bccd Use unknown os for PlayerListEntry 2019-11-10 00:01:12 -05:00
f03bd982b5 Empty fields in PlayerSkinPacket, thanks @Minejong 2019-11-09 23:56:18 -05:00
7276eda0e5 Moved SetTitlePacket usage to NetworkSession (#3186) 2019-11-09 19:56:06 +00:00
92700b2e18 phpstan.neon: remove error patterns that don't occur on 4.0 2019-11-09 18:10:53 +00:00
c16337a80f Merge branch 'stable' with changes 2019-11-09 18:01:04 +00:00
025cb73bf5 update travis pthreads 2019-11-09 17:34:04 +00:00
2a6ffb5aa9 updated build/php submodule 2019-11-09 17:33:25 +00:00
d53b84386f Merge pull request #3 from dktapps/drew-1.13
clean up 1.13 a little
2019-11-08 16:46:01 +05:00
a7ed933b37 superfluous import 2019-11-08 11:32:09 +00:00
29cc9283f8 reverse unnecessary formatting changes 2019-11-08 11:29:00 +00:00
e60962c31f reverse BC-breaking change to Player->changeSkin()
this change would cause LSP violations for subclasses
2019-11-08 11:22:55 +00:00
f6b5301e17 Player: remove unused import 2019-11-08 11:10:20 +00:00
73b923e3a1 cleanup eating clusterfuck 2019-11-08 11:08:22 +00:00
d2e4eb40b3 CompletedUsingItemPacket is superfluous 2019-11-08 08:29:25 +00:00
6a31628e78 Clean up whitespace disaster and add getIngredient back 2019-11-07 23:43:26 -05:00
bfb1ad1327 Removed PlayerUIInventory and BaseUIInventory 2019-11-07 23:17:01 -05:00
dfa603c335 Simplify if null statement 2019-11-07 20:06:46 -05:00
eef979db4c Switch to isUsingItem()
I don't plan on using this, as you informed me on discord that I didn't need the extra step, and it's a BC break anyway
2019-11-07 19:49:04 -05:00
6166c90bfd No need for a try catch statement around reading a file 2019-11-07 19:45:47 -05:00
35d1d0080a Removed count const and fixed BC break 2019-11-07 19:45:33 -05:00
3bacb1a9cb Moved skin back
Not too sure what I planned on doing with that
2019-11-07 19:45:20 -05:00
898af49e97 Add typehints to completedusingitempacket 2019-11-07 19:45:06 -05:00
3061eb4157 Fixed convertToLegacyName not using variables, add typehints to it too 2019-11-07 19:44:49 -05:00
b8d1d8f212 Clean up unused imports 2019-11-07 19:43:53 -05:00
8c6189775b Removed root directory runtime states 2019-11-07 19:33:53 -05:00
932418b951 fixing some PHPStan complaints about bootstrap
this isn't an ideal fix, but it'll do.
2019-11-07 18:22:37 +00:00
95812252d6 NetworkBinaryStream: fix a mistake in doc for putEntityRuntimeId() 2019-11-07 18:22:37 +00:00
7dec912d15 Fixed FloatingTextParticles 2019-11-06 23:22:41 -05:00
dbd36d66ae Cape data can be null 2019-11-06 23:01:06 -05:00
40b4166a6e created method sendCompletedUsingItemPacket for less duplication 2019-11-06 22:30:05 -05:00
51d18ffb89 Merge branch 'stable' of https://github.com/pmmp/PocketMine-MP into stable 2019-11-06 22:10:41 -05:00
af3c7b7c76 Updated ResourcePackType 2019-11-06 21:57:09 -05:00
3511ac010d Fixed crafting 2019-11-06 20:42:53 -05:00
cac3c356a5 Painting: fix dropping multiple items when multiple blockupdates occur in the same tick
test case: place sand on top of a line of signs, put a painting on the sand and break the supporting sign
fixes #2774 for stable
2019-11-06 14:29:43 -05:00
07f19dd4a1 Fixed respawning 2019-11-05 22:33:12 -05:00
17a17c31f3 Fixed items, but I'm not so sure how well this'll work out, it'll need improved in the future 2019-11-05 22:25:11 -05:00
75742b487f Fixed stupid mistake 2019-11-05 21:56:20 -05:00
4e9a2b6d8c Added CompletedUsingItemPacket 2019-11-05 21:19:49 -05:00
4ea907ae1a Start saving new skin data 2019-11-05 21:01:01 -05:00
8b912c1363 Removed some useless casts 2019-11-05 20:59:48 -05:00
080209c469 Fixed persona skins being messed up on join 2019-11-05 20:35:33 -05:00
5b11ddee35 Clean up duplicated skin entries 2019-11-05 20:30:41 -05:00
3b7ded0ba3 Fixed changing skins crashing the server 2019-11-05 20:25:45 -05:00
c5d3e9be76 phpstan: silence leveldb noise
maybe there's a better way to do this, but I don't know it yet.
2019-11-05 20:21:36 +00:00
714f4dc023 fortify CI with PHPStan 2019-11-05 19:42:37 +00:00
a86bcd5110 travis.sh: don't redownload phpunit if it already locally exists 2019-11-05 19:39:04 +00:00
7ffc477d76 introduced baseline PHPStan configuration 2019-11-05 11:16:49 +00:00
4cb0b319c0 load some non-class constants with composer
this makes PHPStan happy and also makes working with PM code externally less of a pain in the ass.
2019-11-05 11:16:22 +00:00
5ebe9859e9 Moved runtime_block_states to vanilla 2019-11-04 21:47:44 -05:00
cd2b60a860 Initial update to 1.13 2019-10-30 21:36:08 -04:00
cbef2bbc51 move ThreadException to pocketmine\thread namespace 2019-10-29 12:42:38 +00:00
5edff79f5f 3.9.8 is next 2019-10-28 16:07:35 +00:00
0c91d568b4 Release 3.9.7 2019-10-28 16:07:35 +00:00
35fabc7765 updated DevTools submodule to 1.13.5 2019-10-28 16:03:26 +00:00
2e446e4df3 added pocketmine/classloader dependency (extracted from pocketmine/spl) 2019-10-28 12:29:48 +00:00
b5a98a993f lazy-init RuntimeBlockMapping 2019-10-27 20:58:43 +00:00
0840ba8067 PocketMine.php: reduce unnecessary pocketmine\NAME dependencies 2019-10-26 21:37:15 +01:00
274cf58ccf PocketMine.php: remove useless ini_set() (this is a PHP_INI_SYSTEM directive which can't be changed at runtime) 2019-10-25 21:38:47 +01:00
1bce5d0bc2 PocketMine.php: move BaseClassLoader creation to where it's actually used 2019-10-25 21:26:22 +01:00
0d5d5e21a8 CommandReader: define $w and $e to make PHPStan happy 2019-10-25 16:11:02 +01:00
a145e18c1e CrashDump: use fully qualified reference for GIT_COMMIT constant
this makes it easier to filter out PHPStan noise.
2019-10-25 16:08:37 +01:00
d1ca779c1a fix PHPStan @throws incompatible warning 2019-10-25 15:49:47 +01:00
c8cf329c94 Plugin::getLogger() interface no longer depends on PluginLogger (#3160)
The Plugin contract now typehints the relied on AttachableLogger contract rather than the concrete PluginLogger implementation.
2019-10-24 20:26:42 +01:00
46e005543f update pocketmine/log 2019-10-24 19:49:53 +01:00
0a751857cc added pocketmine/log dependency 2019-10-24 19:39:58 +01:00
abbb8bbf55 travis.sh: allow latest phpunit v7 now that we have XML
not ready to move to v8 yet because of BC breaks
2019-10-24 13:37:24 +01:00
e4d2a4d911 canary: update build/php submodule 2019-10-24 13:30:05 +01:00
466580197d Merge branch 'stable' 2019-10-24 13:29:44 +01:00
86c7870427 update build/php submodule 2019-10-24 13:28:27 +01:00
15762b03f8 EntityMetadataCollection: fixed wrong parameter doc type on set() 2019-10-24 13:27:38 +01:00
ec13cd695d travis: use ds 1.2.9 2019-10-24 13:19:29 +01:00
dbc4f84bcb travis: add igbinary 2019-10-24 13:18:42 +01:00
043f1a5577 ext-igbinary is mandatory since e1352668d1 2019-10-24 13:17:04 +01:00
acdcb99566 fixed 2cac7331f5 merge error 2019-10-24 11:46:47 +01:00
2cac7331f5 Merge branch 'stable' 2019-10-24 09:35:57 +01:00
48080b7f90 PocketMine.php: define INT32_MASK earlier
this is non-dependent on any of the PM crap.
2019-10-24 09:23:37 +01:00
b216fb8910 PocketMine.php: set INI entries as early as possible 2019-10-24 09:18:50 +01:00
d3171d6a8e backport a53f698d38: PocketMine.php: remove useless set_time_limit() call
this is hardcoded to zero in the PHP core anyway.
2019-10-24 09:14:18 +01:00
c063a4da29 backport 5c1f1f00cb: move assert.exception to PocketMine.php with the other stuff 2019-10-24 09:12:05 +01:00
cc79dfa64c backport 8b40a8f217: PocketMine.php: move INI entry setting to a separate function 2019-10-24 09:09:53 +01:00
d6b9950901 backport fdfbaf4e95: make startup performance warnings a little more coherent 2019-10-24 09:06:28 +01:00
1815fe5b46 backport 647f86a5b8: PocketMine.php: remove redundant ini_set()
this is overridden later on by MemoryManager.
2019-10-24 09:02:37 +01:00
3e993250d8 backport 0c31b8731f: PocketMine.php: use main logger to emit force-kill debug 2019-10-24 08:57:31 +01:00
1163ac1d7a backport 0c31b8731f: PocketMine.php: get rid of redundant LOCK_FILE_PATH constant 2019-10-24 08:55:28 +01:00
9a51ba697a PocketMine.php: move some mission-critical stuff earlier in boot sequence
fixes #3161
2019-10-24 08:50:13 +01:00
9aab97578b World: clean up lighting update API 2019-10-23 21:52:39 +01:00
3768f3008e World: group light-related functions
i don't know why these were dumped between getBlock() and setBlock() to begin with.
2019-10-23 21:29:00 +01:00
f01b7b74ba World: remove setBlockLightAt() and setBlockSkyLightAt() 2019-10-23 21:25:29 +01:00
a3b73d95a7 LightUpdate: allow providing effective light levels for propagation, fix #2999 2019-10-23 21:01:19 +01:00
f3f9ebf312 SubChunkIteratorManager: added isValid() 2019-10-23 20:21:09 +01:00
21e9bca64a World: remove getHeightMap() and setHeightMap()
these are too specialized to be of any use to plugin developers, and they are also misleading - plugin devs often think this refers to the highest block Y coordinate, but it doesn't.
2019-10-23 19:30:06 +01:00
eedc9eaee1 Chunk: move protocol-specific getSubChunkSendCount() to network chunk serializer 2019-10-23 18:34:47 +01:00
23e2e7c320 Chunk: remove useless instanceof check from collectGarbage() 2019-10-23 18:29:01 +01:00
f71eecfe56 Chunk: clean up internals that were designed for variable subchunk stack size
this exposed a few bugs in lighting updates too.
2019-10-23 18:27:30 +01:00
508c53b53a Merge branch 'stable'
# Conflicts:
#	resources/vanilla
2019-10-22 23:01:35 +01:00
dddc3e8407 FastChunkSerializer: remove legacy code, simplify encoding
this is also faster than the old technique (theoretically).
2019-10-22 23:00:49 +01:00
02ff8d671b Mostly phase out EmptySubChunk
copy-on-write and zero-layer SubChunk objects are much easier to manage and have less cognitive overhead.

obviously, the goal is to get rid of EmptySubChunk completely, but right now it does still serve a purpose (filling in dummy values for reading out-of-bounds on chunks), and that's a problem that takes a little more work to fix.
2019-10-22 23:00:49 +01:00
b7d1d11eb4 Chunk: remove useless field "height" 2019-10-22 23:00:49 +01:00
295d14e0d9 Chunk: make setSubChunk() throw exception on invalid Y instead of returning false 2019-10-22 23:00:49 +01:00
b8c857df64 World: prevent getHighestAdjacentBlockLight() and getHighestAdjacentBlockSkyLight() trying to exceed world bounds
this creates a problem for sky light above y=256, but this problem exists in lots of other places already anyway.
2019-10-22 23:00:49 +01:00
9d3637c999 Chunk: remove useless proxy field emptySubChunk 2019-10-22 23:00:49 +01:00
e1352668d1 LightPopulationTask: Don't overwrite the whole chunk on completion
this is more efficient (less data copied for ITC), fixes #2873, and also fixes terrain changes during task run getting overwritten.

This still leaves the problem that the light information provided may be out of date by the time the task completes, but this is nonetheless a step forward.
2019-10-22 23:00:21 +01:00
32ad9d0c1a Squid: fix spammy rotation in enclosed spaces
this bug was caused by 2f3c77c68a. It looks unrelated to the commit title, so it may have been committed by mistake.
2019-10-22 22:50:35 +01:00
296825b87e LightArray: collect garbage on unserialize
serialize/unserialize don't preserve const refs, so this is necessary to reassign global refs post-unserialize
2019-10-22 20:09:51 +01:00
bf0e855a9b updated composer dependencies 2019-10-22 19:07:42 +01:00
ebbb99b96b Merge branch 'next-minor' 2019-10-22 19:05:11 +01:00
0591458ef6 Merge branch 'stable' into next-minor 2019-10-22 18:49:22 +01:00
3d840e969d 3.9.7 is next 2019-10-22 14:38:02 +01:00
d1b70bd400 Release 3.9.6 2019-10-22 14:38:02 +01:00
29f002b32c LightUpdate: fixed type doc for updateNodes field 2019-10-22 12:23:42 +01:00
da17ade575 AvailableCommandsPacket: fixed wrong parameter type doc for putEnum() 2019-10-22 12:23:01 +01:00
f0c36f3413 ClientCacheMissResponsePacket: fix broken type assert in create()
ouch! PhpStorm never saw these...
2019-10-22 11:57:10 +01:00
77d8f133f1 LevelChunkPacket: fixed broken type assert in withCache() 2019-10-22 11:54:37 +01:00
43ebb23085 Permission: remove dead code from loadPermission() 2019-10-22 10:42:22 +01:00
e198c8fa8b Task: mark taskHandler field as nullable 2019-10-22 10:26:49 +01:00
cc3285c8fe Chest: fixed type doc of doubleChestInventory field 2019-10-22 10:25:24 +01:00
305c63ba4d MainLogger: initialize shutdown field in the conventional manner
this avoids uninitialized uses
2019-10-22 10:21:17 +01:00
acaa0e33b0 update DevTools submodule to pmmp/PocketMine-DevTools@3fadb2c3f4 2019-10-22 10:16:44 +01:00
f63857deed update build/php submodule to pmmp/php-build-scripts@1b3fe3120c 2019-10-22 10:15:29 +01:00
eda3d9b5e4 sync composer dependencies 2019-10-22 10:13:47 +01:00
c3872619cd Block: mark boundingBox as nullable 2019-10-22 10:07:27 +01:00
39cc590829 Skin: accommodate JSON geometry containing comments, closes #3121 2019-10-21 22:26:48 +01:00
f347345bb3 Human::getInventory(): explicitly declare return type
the lack of this causes type inference bugs and documentation problems.
thanks PHPStan
2019-10-21 15:25:57 +01:00
bb05cfb36c Shears: fixed always-false hardness check
thanks PHPStan
2019-10-21 15:21:22 +01:00
7d5c3c9b46 backport 4364d2a94: AvailableCommandsPacket: Clean up internals
this is still disgusting, but it's a little more bearable now.
2019-10-21 14:51:36 +01:00
cff2d37add backport ec0558597b: CommandParameter: change byte1 field to "flags" (#3115) 2019-10-21 10:03:59 +01:00
b7665fd906 remove unused imports 2019-10-20 21:26:22 +01:00
6d24760174 Merge branch 'stable' 2019-10-20 21:25:39 +01:00
447477c5fb RegionLoader: Write location table changes when deleting chunks 2019-10-20 20:54:46 +01:00
abdbb2bf0e backport 3f6660027: RegionLoader: Extract location table validation to separate function 2019-10-20 20:53:47 +01:00
783c13926f backport f2404804d: RegionLoader: clean up lastSector handling 2019-10-20 20:48:29 +01:00
45329ddf67 backport 07a9c35ee: RegionLoader: Use objects instead of arrays 2019-10-20 20:42:55 +01:00
20af789963 backport 3e58708130: Add some missing @throws annotations 2019-10-20 20:23:51 +01:00
93cb9390e0 RegionLoader: backport 62185d476b 2019-10-20 19:59:02 +01:00
0aed7f86f5 Updated BossEventPacket comments (#3155)
* Updated BossBar comments

* Fixed comments
2019-10-20 19:23:07 +01:00
bf44bd016d TransferServerCommand: add missing boilerplate permission check 2019-10-20 14:28:53 +01:00
04e4a36653 LevelDB: remove unnecessary \pocketmine\NAME dependency
this is non-obvious and makes it a pain the ass to use outside of PM.
2019-10-17 18:56:51 +01:00
7439e1971d Server: stop spamming crashdumps on unsupported / corrupted worlds
really we should look into making the server stop if any world fails to load, but flooding the place with crashdumps isn't the way to do it.
This is a simplified version of cf73c7f5c1
2019-10-17 11:27:00 +01:00
b961b4e003 SetupWizard: use constant for default gamemode 2019-10-16 11:48:25 +01:00
d9eac8fc0a Server: fixed default difficulty being EASY instead of NORMAL 2019-10-16 11:45:30 +01:00
aeeee5eb53 Added encode/decode for StructureTemplateDataExport(Request|Response)Packet (#3145) 2019-10-14 11:14:42 +01:00
13994055d9 SetupWizard: disable spawn protection by default
we can't change anything else wrt. this on a patch version, disabling it in the main core by default involves possible behavioural breaks
2019-10-09 11:26:58 +01:00
d456cb2419 Filesystem: added some documentation for createLockFile() and releaseLockFile()
[ci skip]
2019-10-07 10:03:29 +01:00
247875e3d5 Explosion: add documentation for explodeA() and explodeB()
these functions really ought to be renamed, or possibly redesigned entirely. However, that's no task for a patch version.

[ci skip]
2019-10-07 09:44:17 +01:00
ee60a7bc36 Item: add documentation for addCreativeItem(), removeCreativeItem() and clearCreativeItems()
[ci skip]
2019-10-07 09:37:59 +01:00
348c2a599b Internet: report PM version in user agent
this is useful for statistics
2019-10-04 10:59:32 +01:00
37763685aa LiquidBucket: add getLiquid() (#3123) 2019-10-04 09:34:14 +01:00
562b47a1e5 Player: guard against repeated resource pack sequence
this can happen because of the client being super broken in 1.12
close #3036
2019-10-03 11:20:44 +01:00
b1de973d96 changelog: world save performance is improved
[ci skip]
2019-10-03 10:51:33 +01:00
4e060bc13f EventPacket: Added some new constants (#3132) 2019-10-02 13:37:05 +01:00
2807f14fcd 3.9.6 is next 2019-10-01 15:02:34 +01:00
f0539f4898 Release 3.9.5 2019-10-01 15:02:33 +01:00
464b2116a6 Merge remote-tracking branch 'origin/stable' 2019-10-01 14:41:54 +01:00
63d7e7b811 Fixed decoding form responses with double commas inside quotes (#3131)
closes #3113
2019-10-01 14:28:55 +01:00
4da06078ed Server: promote Patreon on startup 2019-10-01 14:22:07 +01:00
8a6381c3fa StupidJsonDecodeTest: add some extra test vectors 2019-10-01 13:25:20 +01:00
735efeaa13 Merge branch 'stable' 2019-09-26 11:30:36 +01:00
d0d61597c7 StupidJsonDecodeTest: use getClosure() instead of traditional mess
this is faster and requires less code.
2019-09-26 11:28:40 +01:00
7a2a4e2aa3 change some heading sizes [ci skip] 2019-09-25 12:59:04 +01:00
e41a2c0792 Link to StackOverflow in README (#3084) 2019-09-23 11:56:37 +01:00
262dbc0346 ParticleCommand: fixup for 6e9d2e1c8a 2019-09-23 11:54:17 +01:00
6e9d2e1c8a InstantEnchantParticle: add Color into constructor (#3118) 2019-09-23 11:43:06 +01:00
15694279c7 Merge branch 'stable' 2019-09-18 13:30:58 +01:00
ec0558597b CommandParameter: change byte1 field to "flags" (#3115) 2019-09-18 11:10:42 +01:00
11a6e04a28 EnderPearl: remove collision box hack (this isn't needed for MCPE anyway)
This was intended to address the problem that ender pearls would not stop on grass, saplings, and other similar objects. However, they don't stop on such objects in MCPE anyway, only PC.
2019-09-18 10:02:52 +01:00
70b1ac856d ZippedResourcePack: fix mishandling of wrong root JSON type (crashdump #2840512) 2019-09-17 11:01:33 +01:00
d724374d1a StupidJsonDecodeTest: add failing test case for #3113 2019-09-16 15:53:00 +01:00
1866de269b OfflinePlayer: fix reading wrong NBT type in getFirstPlayed(), close #3112
This bug was introduced by 65927e6965.
2019-09-04 07:59:28 +01:00
f755ea6043 DestroyBlockParticle: keep block reference around instead of runtimeID
we'll need this for protocol abstraction
2019-08-27 19:25:55 +01:00
1de5d35dfc add a CLI tool for conversion 2019-08-26 19:03:48 +01:00
f720a58013 RegionWorldProvider: don't assume that path has a trailing directory separator 2019-08-25 19:50:51 +01:00
a53f698d38 PocketMine.php: remove useless set_time_limit() call
this is hardcoded to zero in the PHP core anyway.
2019-08-25 19:41:53 +01:00
c4376d13ae update to latest SPL 2019-08-25 19:32:20 +01:00
6e692d76d5 make lock-file code more reusable 2019-08-25 18:50:33 +01:00
5c1f1f00cb move assert.exception to PocketMine.php with the other stuff 2019-08-25 18:18:14 +01:00
2bcb720668 Server: get rid of \pocketmine\DEBUG 2019-08-25 18:11:10 +01:00
d1a8bef1e6 fix test 2019-08-25 17:52:39 +01:00
8b40a8f217 PocketMine.php: move INI entry setting to a separate function 2019-08-25 17:50:45 +01:00
0c31b8731f PocketMine.php: use main logger to emit force-kill debug 2019-08-25 17:48:13 +01:00
9d1239ed67 PocketMine.php: get rid of redundant LOCK_FILE_PATH constant 2019-08-25 17:39:57 +01:00
3eea2442a7 move filesystem-related functions to pocketmine\utils\Filesystem 2019-08-25 17:36:50 +01:00
40da5059c9 PocketMine.php: remove \pocketmine\DATA dynamic constant 2019-08-25 16:55:24 +01:00
51ed564c5e SetupWizard: remove non-obvious dependencies on dynamic constants, require path in constructor 2019-08-25 16:46:01 +01:00
fdfbaf4e95 make startup performance warnings a little more coherent 2019-08-25 16:34:26 +01:00
ad0f100f8e remove \pocketmine\START_TIME, add Server->getStartTime() 2019-08-25 16:25:27 +01:00
647f86a5b8 PocketMine.php: remove redundant ini_set()
this is overridden later on by MemoryManager.
2019-08-25 16:14:35 +01:00
39d5903c3e Remove INT32_MIN and INT32_MAX global constants 2019-08-25 16:09:51 +01:00
95a4081d24 update composer dependencies 2019-08-25 16:04:51 +01:00
42ffc45c1c world providers: don't assume that getPath() has a trailing directory separator 2019-08-25 15:45:40 +01:00
aa006cca0e WorldProviderManager: added getAvailableProviders()
this will be used by standalone CLI conversion tool
2019-08-24 19:59:57 +01:00
6a4ae4cb94 remove position parameters from BlockFactory::get() and BlockFactory::fromFullBlock() 2019-08-24 17:19:27 +01:00
c9cd6ee038 ExperienceOrb: fix passing invalid argument to multi-signature Vector3::subtract()
I knew I should have scrapped these multi-signature functions years ago...
2019-08-24 15:58:06 +01:00
75a2d79671 convert more constant interfaces to final classes, close #2885 2019-08-24 15:39:23 +01:00
ef8eba43d7 RegisteredListener: validate priority at a more sensible time 2019-08-23 19:54:41 +01:00
4b0b923ca0 turn EventPriority into final class instead of abstract class 2019-08-23 19:12:55 +01:00
b2cd13daac Merge branch 'master' of https://github.com/pmmp/PocketMine-MP 2019-08-23 17:16:37 +01:00
e5b02ee5e0 make logic for fetching handler lists more consistent 2019-08-23 17:16:07 +01:00
aa60aa69ee World: fix bug in getNearestEntity()
fuck you PhpStorm
2019-08-21 18:51:08 -04:00
7e5193355e Remove old entity movement hack
This was intended to try and mitigate player movement clipping through blocks triggering anti cheat. Now that the anti cheat is gone, this code is no longer needed.
2019-08-21 18:46:39 +01:00
dbdcabcc56 Player: get rid of CID requirement from player info, CID is still available via extradata if supported by client impl
this is useless for PM and it doesn't have any fit purpose for plugin use either, so it doesn't make sense to expose it to the API.
2019-08-21 18:17:31 +01:00
018a4467bf fix bug in LoginPacketHandler (incorrect metadata array in PlayerInfo)
this was intended to make available things like the deviceOS, input method etc without placing an API requirement for custom implementations to provide such information.
2019-08-21 18:06:18 +01:00
e9fd57275a remove LevelEventSound, remove pitch from sounds that don't support it (most of them) 2019-08-21 17:59:00 +01:00
ea2c418a77 update dependency versions 2019-08-20 19:48:06 +01:00
122238d57e add NetworkSession->onEnterWorld() hook 2019-08-20 16:25:20 +01:00
3a41a798ad move forced overflow of SetTimePacket to SetTimePacket::create() 2019-08-20 16:24:47 +01:00
794c7b2469 clean up imports 2019-08-20 15:59:27 +01:00
ea374f5c37 [ci skip] update changelog 2019-08-20 15:52:50 +01:00
6b22f68674 Player: remove sendDataPacket() 2019-08-20 15:50:34 +01:00
965177fb74 Server: drop redundant proxy function broadcastPacket()
this is just making it harder to search for broadcast usages, and we want to get rid of all packet broadcasting shit from Server anyway.
2019-08-19 19:30:57 +01:00
8557c93f04 remove GenericParticle, work on isolating network crap in particles 2019-08-19 19:26:26 +01:00
4dfa335ae7 convert ParticleIds to final class with private constructor
I got tired of auto complete suggesting this shit every time I typed `implements Particle`
2019-08-19 19:05:59 +01:00
e52ba7201c add LevelEventPacket::standardParticle() sugar 2019-08-19 19:01:09 +01:00
3274db3ddc DustParticle constructor now uses Color object 2019-08-19 18:57:26 +01:00
1262b06797 [ci skip] update changelog 2019-08-19 17:22:22 +01:00
2d4a32fc77 first look at separating Entity and Location 2019-08-19 17:20:34 +01:00
591d35889e make use of EnumTrait->id() 2019-08-17 16:37:36 +01:00
a7d51a273d EnumTrait: add a numeric runtimeID field for arrays and switches 2019-08-17 16:36:05 +01:00
69e23998f4 Merge branch 'stable' 2019-08-16 19:06:36 +01:00
a19143cae7 3.9.5 is next 2019-08-16 17:58:02 +01:00
1be6783c34 Release 3.9.4 2019-08-16 17:58:01 +01:00
092edc9d43 avoid breaking concrete powder 2019-08-16 17:41:50 +01:00
2ba8eac27f FallingBlock: fix endless falling on top of fences
this is a shitty fix, but I don't think there's a better way to do it on 3.x. This also fixes dropping on cactus.
close #2449, close #2895
2019-08-16 17:27:41 +01:00
9321eef683 Merge branch 'stable' 2019-08-16 16:49:24 +01:00
25ff90b2c6 PluginManager: fix chained softdepend plugins load order
Test case:
- plugin2 depends on nonexistent plugin1
- plugin3 depends on plugin2

At random occasions, plugin3 would be loaded before plugin2, because plugin2 load would be deferred in the expectation of plugin1 being loaded. This would result in the assumption that plugin3's softdepend plugins would not be loaded, so they were ignored.
We fix this problem by removing missing plugins from softdepend if they were not present on a scan of the directory. This way, we don't ignore any unresolved deferred dependency resolutions.
2019-08-16 16:46:59 +01:00
4898a35613 cleanup block dual bounding box clusterfuck
"bounding box" serves no tangible purpose, only collision boxes do right now.
2019-08-15 17:23:55 +01:00
d58339b2fd fix doors being considered 3 blocks tall by collision detection in some cases 2019-08-15 16:54:14 +01:00
73b2669712 remove World->isFullBlock(), add Block->isFullCube(), clean up some BB mess 2019-08-15 16:22:54 +01:00
e29ac514d7 Block->getBoundingBox() and Block->getCollisionBoxes() are now final
Force usage of Block->recalculateBoundingBox() and Block->recalculateCollisionBoxes()
2019-08-15 16:16:08 +01:00
6dd1cdc413 sync php submodule version 2019-08-14 18:22:08 +01:00
b912ae78bc Merge branch 'stable' of https://github.com/pmmp/PocketMine-MP into stable 2019-08-14 18:21:24 +01:00
200bcb485e Merge branch 'stable' 2019-08-14 18:20:55 +01:00
677d43028a add php-build-scripts as a submodule 2019-08-14 18:08:26 +01:00
d04793145c Remove usages of AxisAlignedBB->setBounds() and AxisAlignedBB->setBB()
these usages make no sense in the contexts they are used in, because their uses require another BB to be created anyway. It makes more sense to simply destroy the old one instead of having it mutable.
2019-08-14 17:28:06 +01:00
e9ed46a9c7 Entity: avoid bad hack on high load which causes bugs on entity move 2019-08-13 18:08:56 +01:00
47b905007e add more legacy metadata constants 2019-08-13 18:01:24 +01:00
7bfb55ec9a Fixed some errors in support.yml (#3095)
[ci skip]
2019-08-13 14:09:03 +01:00
2b38098243 Explosion: fix pos refactor mess 2019-08-12 19:05:21 +01:00
2f61d42518 backport d23eeff832: FallingBlock: remove useless check 2019-08-11 19:38:12 +01:00
dbb669b156 Entity: add some deprecation warnings to despawnFrom() and despawnFromAll() 2019-08-11 19:34:57 +01:00
4d0e8741fe Added a deprecation notice to Entity->getBlocksAround() 2019-08-11 19:32:21 +01:00
53dc6e2050 fix TallGrass and Tree random/base amounts never being initialized, closes #2996 2019-08-11 19:06:20 +01:00
807b860cfe protocol: fixup data type changes, closes #3072 2019-08-11 19:02:16 +01:00
514f395280 SubChunk: reduce visibility of blockLight and skyLight fields 2019-08-10 19:47:41 +01:00
399f9242e0 InventoryManager: avoid use of PlayerHotbarPacket
it doesn't work so well when the selected slot is empty.
2019-08-10 18:09:38 +01:00
85ad78dda8 DataPacketSendEvent: remove setters
these create unnecessary complexities in the internals.
2019-08-10 18:00:46 +01:00
d1775030c3 Remove DataPacketBroadcastEvent, DataPacketSendEvent now supports multiple recipients & packets in one swoop
this makes it simpler to consistently process outbound packets from a plugin. Previously it was necessary to handle 2 events to do 1 job.
2019-08-10 17:59:02 +01:00
4c694c57f4 DaylightSensor: Avoid triggering useless block updates if calculated power is unchanged 2019-08-10 17:49:31 +01:00
774e6fe8a3 Make chemistry textures always enabled 2019-08-10 17:38:00 +01:00
fae6289eb8 protocol: move resource-pack related types to their own subnamespace 2019-08-08 19:58:24 +01:00
d87b6f9ff7 Remove resource pack packets dependency on ResourcePack, now supports decoding 2019-08-08 19:36:54 +01:00
a52e4f0392 AsyncPool: Return whether there are tasks left to be collected from collectTasks()
this allows a while($pool->collectTasks()); style code.
2019-08-08 18:48:58 +01:00
bce126b6d0 fix BB of daylight sensor 2019-08-07 19:51:52 +01:00
c533f6a0bd Implemented partial chunk saving on LevelDB (#3078) 2019-08-07 17:39:36 +01:00
d756500928 Also updated Discord link in suppor template and README 2019-08-08 00:03:10 +08:00
7ef27a1a21 support.yml Discord link should point to #rules 2019-08-07 14:54:01 +08:00
9598af7683 commands: remove some nonsensical isValid() checks
a player who doesn't have a valid world has no business sending commands anyway.
2019-08-06 15:42:17 +01:00
dec6f73f2f Remove unnecessary BannerPattern copying on block clone 2019-08-06 10:18:02 +01:00
9671b4d5cb fix improper cloning of some blocks, closes #3079 2019-08-06 10:07:16 +01:00
4e5b296c8c Tiles now encapsulate positions instead of extending them 2019-08-05 19:33:34 +01:00
d355d5b5b5 Remove hack to break cyclic dependency on double chests
Since these now reference positions instead of tiles, the cyclic dependency is removed.
2019-08-05 19:01:21 +01:00
f0505c0284 Remove dead comments from PlayerInventory and PlayerCursorInventory
these aren't overrides anymore.
2019-08-05 18:53:46 +01:00
9353f616a2 All BlockInventory descendents now have a Position as holder
this allows multiple problems to be solved:
1) Cycle between tile and inventory is now removed.
2) BlockInventory now provides a consistent API for plugins to get the block holding an inventory.
2019-08-05 18:50:29 +01:00
358fea9645 Move Location to Entity namespace 2019-08-05 17:20:48 +01:00
927e05d038 [ci skip] update changelog 2019-08-05 17:15:10 +01:00
53ab860db5 first shot making Block not extend Position
this makes some stuff a lot less pretty, but this seems to be the bare minimum necessary to do this task. It can be enhanced later.
2019-08-05 16:44:09 +01:00
cf271dab2b Entity: fixed undefined variable in getTargetEntity() 2019-08-05 16:19:49 +01:00
1fcec87b98 Block: remove unused function 2019-08-03 17:13:02 +01:00
1cd955c216 Entity: added getEyePos() 2019-08-02 17:29:32 +01:00
e03f918806 AttributeMap: drop ArrayAccess interface
this makes no sense because it isn't type safe and isn't used anywhere. It's just extra maintenance cost for no good reason.
2019-08-02 17:19:14 +01:00
c1ef5ba8ab Entity: remove redundant check from spawnToAll() 2019-08-02 17:10:58 +01:00
cc4b2959a7 Player: ditch deprecated dataPacket()
it doesn't make sense to deprecate this on a major version, particularly given all the other changes that plugin devs will have to accommodate.
2019-08-02 16:43:45 +01:00
56dc3ce6ee Human: remove obsolete comment from sendSpawnPacket()
the referenced function doesn't exist anymore.
2019-08-02 16:41:30 +01:00
aa5395d6ed Merge branch 'next-minor' 2019-08-02 16:35:17 +01:00
eeddaced9f PluginManager: Remove useless deprecation warning message
this message just confuses end users and is of little use to a developer. It doesn't make any sense to make a special case for events when we have lots of other deprecated things to think about anyway which won't be shown warnings for.
2019-08-02 16:34:00 +01:00
c237ff538c Merge branch 'stable' into next-minor 2019-08-02 16:32:00 +01:00
2e806d8a6c [ci skip] changelog update 2019-08-02 16:26:04 +01:00
58e9728710 Removing useless armour descendent classes, move armour slot to ArmorTypeInfo 2019-08-02 16:17:04 +01:00
056c5ed6cd ItemFactory: break down init() a little 2019-08-01 20:01:29 +01:00
135a2f520c add some UTF-8 validation 2019-08-01 19:51:31 +01:00
399ef13069 WritableBookPage: add missing EOF newline 2019-08-01 19:39:32 +01:00
7e4236a3ec add a more flexible hook system to EffectManager 2019-08-01 19:36:13 +01:00
d09e79e682 Player: update properties when assigning game mode, fixes #3005 2019-08-01 19:02:06 +01:00
4818e04540 Player: fix possible comparison bug in setGamemode() 2019-08-01 18:57:47 +01:00
eaf5226f08 [ci skip] update changelog 2019-08-01 17:53:42 +01:00
5c95e25326 Enchantment: use a simple array instead of SplFixedArray 2019-08-01 16:03:08 +01:00
28c9a2c0cd fixed Protection enchantments being dropped from items, closes #3066 2019-08-01 16:02:05 +01:00
296061d25d reduce boilerplate around attribute handling 2019-07-31 16:41:09 +01:00
dc33b9e573 VanillaEffects: add some TODOs 2019-07-31 16:37:25 +01:00
b4c55a8c37 fix incorrect power calculation of daylight sensor 2019-07-31 15:44:53 +01:00
bf5519b0cf fix travis 2019-07-30 19:40:27 +01:00
5499ac620c Removed pocketmine subdirectory, map PSR-4 style 2019-07-30 19:14:57 +01:00
7a77d3dc30 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
2019-07-30 19:00:50 +01:00
6b4d8b91c6 fix crashdump plugin detection
some things which were copy pasting PM classes into plugins were causing incorrect detection here. The path cleaning guarantees that all plugin paths will start with "plugins/", so we can use that to check instead.
2019-07-30 18:58:31 +01:00
ece28e5d7b World: avoid triggering light updates when the target block light level/filter haven't changed 2019-07-30 18:01:23 +01:00
3eb1a56985 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/world/World.php
2019-07-30 15:38:38 +01:00
8f5eb7ef37 Level: fix memory leak on scheduled blockupdate in unloaded chunk 2019-07-30 15:37:24 +01:00
cf1b140d57 fix chunks with entities & tiles not being saved after first autosave
this bug was introduced by 211836274f, which did not take into consideration that the dirty flag is cleared after the first time the chunk is saved, meaning that later entity and tile changes wouldn't be saved.
I considered this fix more elegant than reverting the bug commit.
2019-07-29 19:38:47 +01:00
2ecdea2cc6 LevelDB: increase default block size to 64KB
this might be a little too big, but it's definitely better than the leveldb default 4KB, since most of our data is bigger than 4KB.
2019-07-29 18:54:27 +01:00
334d15339f updated Math dependency 2019-07-29 18:25:32 +01:00
c40074d0bf Entity: remove unused import 2019-07-29 18:25:05 +01:00
96d8790028 rename Entity->propertyManager -> Entity->networkProperties 2019-07-29 18:24:29 +01:00
452cfe2f59 World: drop getChunkEntities(), use getChunk()->getEntities()
everywhere this function is used, it should be assumed/expected that the chunk in question is already present and loaded.
2019-07-29 18:20:33 +01:00
a4042e5d18 World: fix more implicit chunk loading bugs (getCollidingEntities(), getNearbyEntities(), getNearestEntity()) 2019-07-29 18:07:17 +01:00
1111d0d4c7 World: remove dead function getChunkTiles() 2019-07-29 18:00:23 +01:00
17a3ca066e fix wrong type for Fuel tag on brewing stand 2019-07-29 17:50:02 +01:00
52412e9c21 remove remaining dependencies on Bearing 2019-07-29 17:45:23 +01:00
a621bf66ff Remove implied dependence on Facing/Bearing constant values
this introduces mapping tables for redundancy for when those things change or disappear.
2019-07-29 17:43:36 +01:00
18d05f57b5 Merge branch 'next-minor' 2019-07-29 17:33:08 +01:00
23b00bea5b Merge branch 'stable' into next-minor 2019-07-29 17:31:06 +01:00
0ea9a08963 3.9.4 is next 2019-07-29 17:27:21 +01:00
18a1bfe4dd Release 3.9.3 2019-07-29 17:27:21 +01:00
2d3562c687 World: fixed scheduled updates causing chunk loading
this probably needs to be backported.
2019-07-29 17:21:54 +01:00
f3f8cd98de World: fixed scheduled updates causing chunk loading
this probably needs to be backported.
2019-07-29 17:17:05 +01:00
b98dad6f63 Fixed WritableBook PC format deserialization 2019-07-29 16:37:40 +01:00
e06ab0869a mostly rewrite internal entity metadata handling
- Only sync the metadata set when needed for sending
- Don't use metadata set for storing data, add properties instead
- Use objects inside metadata sets instead of arrays
2019-07-28 19:40:47 +01:00
6c0ae6bf0b fuck off PhpStorm 2019-07-27 19:22:33 +01:00
379a40c13a break up the pocketmine\network\mcpe\protocol\types namespace
this namespace nesting is getting out of hand, but it's more manageable this way.
2019-07-27 19:19:48 +01:00
c9ecd04353 rename DataPropertyManager -> EntityMetadataCollection 2019-07-27 19:10:18 +01:00
cde2c10c1d AsyncTask: partial backport of 6ac0c517f5 (simplify TLS)
- deprecated AsyncTask::peekLocal()
- AsyncTask::fetchLocal() no longer deletes stored data
2019-07-27 15:09:42 +01:00
34ed2980e5 Merge branch 'next-minor' 2019-07-27 14:59:38 +01:00
87fb42cabd Merge branch 'stable' into next-minor 2019-07-27 14:53:13 +01:00
cb40484a2e AsyncTask: Remove a bunch of reference-management drivel from documentation of storeLocal()
this works (mostly) the same way regular properties do, so the usual rules are implied.
2019-07-27 14:52:53 +01:00
6566dd8c8f AsyncPool: Remove useless warning about complex data leftovers
this is automatically cleaned up anyway, so this warning is just redundant noise.
2019-07-27 14:44:40 +01:00
1e65ac0d85 Merge branch 'stable' into next-minor 2019-07-27 14:40:31 +01:00
e75a08a5a3 AsyncPool: ensure TLS is always cleaned on task removal, closes #3059 2019-07-27 14:39:40 +01:00
cb247a5f28 AsyncTask: Deprecate methods removed in 2c4f2810d2 2019-07-26 19:52:26 +01:00
bb048fb361 Merge branch 'stable' into next-minor 2019-07-26 19:50:17 +01:00
95dfff727e Wrap PocketMine.php body inside a function
this isolates variables from the global scope and also prevents doxygen documenting these variables.
2019-07-26 19:47:03 +01:00
d55889d85f AsyncTask: fixing docs 2019-07-26 19:41:45 +01:00
99f65f19ac BulkCurlTask: point to the right place in docs 2019-07-26 19:18:09 +01:00
581eeee01d fix rogue @package doc making doxygen choke 2019-07-26 19:15:02 +01:00
7275952fc2 added some missing legacy ID constants
i'm not sure why my script missed these
2019-07-26 19:08:50 +01:00
17341d7406 Load Mathjax from https to prevent unsafe scripts error (#3058) 2019-07-26 18:49:02 +01:00
a91a86bf1d Removing achievements 2019-07-26 18:07:31 +01:00
b543744534 Rename Solid -> Opaque
the old naming was misleading, particularly in conjunction with isSolid().
2019-07-22 19:56:01 +01:00
e95b9fa432 Block: use isSameType() in some places 2019-07-22 19:23:28 +01:00
72c0af2e82 Merge branch 'stable' 2019-07-22 17:39:44 +01:00
04c0cd142d 3.9.3 is next 2019-07-22 17:28:33 +01:00
7a747d6f93 Release 3.9.2 2019-07-22 17:28:33 +01:00
e93d034a4e fix bucket empty sound position, close #3051 2019-07-22 17:17:15 +01:00
5a08a10448 update dependency requirements 2019-07-22 17:15:18 +01:00
622f93df45 remove usages of deprecated {} string access, closes #3035 2019-07-22 16:39:33 +01:00
80d277f1b5 removed return value of ChunkManager->setBlockAt() and World->setBlock() 2019-07-21 18:55:22 +01:00
703ae3a172 Merge branch 'master' of https://github.com/pmmp/PocketMine-MP 2019-07-21 18:53:25 +01:00
6fdcb09891 fix PhpStorm's screwup with World->setBlock() doc comment
it's not the first time i've seen it do this, and i still have no idea why it does this.
2019-07-21 18:52:33 +01:00
a9c6489e08 updated consistency check for e388ac9c8b 2019-07-21 13:11:59 +01:00
e388ac9c8b implemented lantern 2019-07-20 17:48:09 +01:00
08a654760c Allow PlayerInfo to contain additional metadata 2019-07-20 15:19:17 +01:00
b788982d60 Item: fixed setCustomName() not removing display NBT tag with empty name (#3049) 2019-07-19 20:07:53 +01:00
1e057394c0 Utils: added cloneCallback() and cloneObjectArray() to reduce list copying boilerplate 2019-07-19 19:19:04 +01:00
47b120fa0e crafting: avoid unnecessary recipe mutability 2019-07-19 19:11:36 +01:00
556beacdbf make PlayerAchievementAwardedEvent less useless 2019-07-19 18:59:06 +01:00
b4df1ac547 Remove Achievement::broadcast(), remove cyclic dependency, inline code in Player 2019-07-19 18:47:18 +01:00
3965c9419d Merge branch 'stable' 2019-07-19 18:20:38 +01:00
26faf4a952 Player: fixed sendTranslation() passing parent parameters to translate parameters 2019-07-19 18:15:35 +01:00
14d79c205b TranslationContainer: remove redundant setters
i'd like to make this completely immutable, but there are some problems to solve first.
2019-07-19 18:09:00 +01:00
99bba66f13 Block no longer implements BlockLegacyIds 2019-07-19 17:49:59 +01:00
1fee70abfb Item no longer implements ItemIds 2019-07-19 17:43:06 +01:00
ac12911561 move network entity IDs to network namespace
we're going to need a dedicated data package, because this stuff isn't just network-specific.
2019-07-19 15:33:30 +01:00
0ebd3e6ca2 fix /effect crash 2019-07-19 14:10:19 +01:00
5a5ce84ebc yucky fix for crash on invalid keychain 2019-07-19 14:01:21 +01:00
a4c7744188 [ci skip] changelog updates 2019-07-19 13:53:44 +01:00
c5ebc12f1a Merge remote-tracking branch 'origin/stable' 2019-07-19 13:45:53 +01:00
5e8c92b1da Fix test failure #3047 2019-07-19 13:42:03 +01:00
a8fa3ba434 Add test for whether item retains it's display properties after deserialization (#3047) 2019-07-19 13:06:07 +01:00
670bf2b9d1 doxygen: sort more things, for our sanity (#3045) 2019-07-19 10:52:32 +01:00
f5491346ce doxygen: set HIDE_IN_BODY_DOCS = yes (#3044)
fixes #3043
2019-07-19 10:34:41 +01:00
b5b4133c5d Item: fixed always-false null checks on getNamedTag() result 2019-07-18 19:45:59 +01:00
e22986f065 EffectCommand: Remove support for internal MCPE effect IDs 2019-07-18 19:30:20 +01:00
3632e07cdb EffectCommand: Remove internal ID from translated message 2019-07-18 19:29:43 +01:00
64948f38d0 Separate effect registry from base Effect class 2019-07-18 15:49:58 +01:00
728aa8aae7 RegistryTrait: Alias internal methods by default
it's always necessary to wrap these methods with the appropriate typehints.
2019-07-17 19:59:28 +01:00
1a1feefd3e Pull tier info out of TieredTool, create ToolTier enum 2019-07-17 18:06:49 +01:00
7954a81602 fixing finality and constructor visibility on some enums 2019-07-17 18:04:15 +01:00
73d3f9f7f7 Fix loadbefore sometimes not working (#3040)
loadbefore operates by injecting self into the target plugin's soft-dependencies. The problem is that these soft-dependency lists are overwritten if the target plugin's soft-dependencies are resolved after the loadbefore of the origin plugin.
2019-07-17 16:52:29 +01:00
ccf165b107 mark some assumed-immutable classes as final 2019-07-17 16:24:29 +01:00
6aba9fadfc Encapsulate Item enchantment handling parts within a trait for scope isolation
as a happy side effect, this makes the Item class smaller, makes the code easier to read, and also makes the code more easily testable.
2019-07-17 16:12:13 +01:00
af73c5f2b1 Make EnchantmentInstance immutable, remove enchantment clone from Item
it doesn't make sense to set the level of an existing enchantment instance because under the old API it would have no effect anyway (if it was returned from an itemstack) or you had access to the constructor (if applying a new enchantment). Allowing this to be mutable creates needless complexity and performance headaches.
2019-07-17 16:03:08 +01:00
fec8c75fd8 [ci skip] changelog: document more misc API changes 2019-07-17 15:55:28 +01:00
74572fde08 [ci skip] changelog: add some information about NBT handling changes 2019-07-17 15:52:52 +01:00
ad4ed1c95c [ci skip] expand changelog on item changes 2019-07-17 14:46:43 +01:00
382d97a178 Merge branch 'stable' 2019-07-17 13:58:43 +01:00
b57dcebb6f Living: tighten validity checks on health NBT, don't use generic getValue() (it could return anything) 2019-07-16 19:59:15 +01:00
711ea3185d update composer dependencies 2019-07-16 19:53:47 +01:00
ff21977461 Item: simplify equals()
getNamedTag() can't return null anymore.
2019-07-16 18:11:09 +01:00
49a6821195 fix @return hints on Item fluent methods 2019-07-16 18:06:21 +01:00
8f64d6b053 Don't mess with NBT when creating signed books 2019-07-16 17:59:39 +01:00
73a847123b WritableBookBase: Make setPages() fluent 2019-07-16 17:59:01 +01:00
3d0e47ba14 WritableBookBase: Don't expose page deque on the API
putting this stuff on the API creates a nightmare because DS structures are both mutable and by-reference, so they have to be manually copied everywhere.
2019-07-16 17:52:58 +01:00
27352486a0 Remove item NBT runtime usage, marginalize to serialize/deserialize
this is a more tame version of my initial attempt to firehose item NBT. It marginalizes the use of item NBT to the places where it's needed on interfaces, leaving the internals clean to operate on whatever they like.
2019-07-16 16:51:45 +01:00
d624c38ab1 Remove dead proxy functions Item::get(), Block::get() and Item::fromString()
with the introduction of the VanillaBlocks and VanillaItems API, it's expected that plugins will no longer need these methods.
2019-07-16 14:31:04 +01:00
52de5a6e49 Removed remaining usages of Item::get() 2019-07-16 14:27:32 +01:00
d874be99a6 PrimedTNT: fix explosion position, close #3037 2019-07-16 13:55:31 +01:00
1767cbe80d Player: Lower moved-too-fast warning and illegal-move warning to debug
many users have complained that this spams their consoles and they can't turn it off.
2019-07-16 13:51:38 +01:00
484f2f43c0 fixed merge error, close #3030 2019-07-14 19:29:16 +01:00
0ba3121c43 Merge branch 'stable' 2019-07-14 19:19:33 +01:00
64fbf5025a 3.9.2 is next 2019-07-14 19:10:29 +01:00
aaa01bb6f8 Release 3.9.1 2019-07-14 19:10:29 +01:00
50d71809e1 Entity: fixed onfire flag being set when setting fire ticks to zero, closes #3031 2019-07-14 19:03:06 +01:00
6839712394 added new PlayerActionPacket constant, silence debug noise every time a player clicks a block 2019-07-14 17:30:37 +01:00
9b5ae7ec75 regenerate LevelSoundEventPacket sound IDs 2019-07-14 17:28:29 +01:00
94eb64c2be 1.12: fix resource packs, closes #3023 2019-07-14 17:22:44 +01:00
3fae57508b update particle ids 2019-07-13 20:08:17 +01:00
f637f14e4a VanillaItems: fixing gold -> golden 2019-07-13 19:24:17 +01:00
1391e4826f ItemFactory: fix name consistency gold -> golden, close #3020 2019-07-13 19:21:00 +01:00
544bbf849d Merge branch 'stable' 2019-07-13 18:17:04 +01:00
a883c35fd0 clean up yesterday's mess 2019-07-13 18:15:14 +01:00
6a93eb8361 Merge branch 'stable' 2019-07-13 18:08:45 +01:00
740398282f [ci skip] added some detail about packet changes in 3.9.0 release 2019-07-13 15:35:00 +01:00
9d14bc54d6 3.9.1 is next 2019-07-12 19:03:24 +01:00
bd69c66d03 Release 3.9.0 2019-07-12 19:03:23 +01:00
c58a1bf9b7 Protocol changes for 1.12.0.28 2019-07-12 19:00:15 +01:00
59c310b914 unfuck the make-release script 2019-07-12 18:59:54 +01:00
790fcc4ebb Release 3.8.7 2019-07-12 18:20:47 +01:00
5430f19e7a make-release: allow specifying a version number explicitly 2019-07-12 18:18:26 +01:00
12ee885432 Bookshelf: fix drop count 2019-07-11 14:14:01 +01:00
39bcd2ec3d added VanillaItems static interface and start using it where possible 2019-07-10 14:44:55 +01:00
e8fe3d0664 Replace some ItemFactory blockitem fetches with VanillaBlocks::THING()->asItem() 2019-07-09 18:30:02 +01:00
41705db687 fix banner block picking 2019-07-09 18:21:08 +01:00
08e1f6405c implemented Carved Pumpkin 2019-07-09 17:56:09 +01:00
b6efb33b91 improved VanillaBlocks registry 2019-07-09 17:33:00 +01:00
c07396442c Merge branch 'stable' 2019-07-09 15:57:02 +01:00
1cf4cf8614 Fixed decoding entries in SetScorePacket
closes #3000
2019-07-09 15:49:24 +01:00
5f959a148f chunkutils: remove dead legacy code 2019-07-09 14:44:01 +01:00
5a2e84eb9f LightArray: added fill(), remove duplicated code 2019-07-09 13:49:54 +01:00
4264923f4f SubChunk: get rid of dead light getters and setters
these were here for fast access, but that fast access path now goes through getBlock(Sky)LightArray() instead.
2019-07-09 13:43:01 +01:00
c1212eab8e EmptySubChunk: get rid of useless allocations 2019-07-09 13:38:26 +01:00
bda9bd2f2d Merge branch 'experimental/vanilla-block-registry' 2019-07-08 19:38:09 +01:00
9ef5f9518c generator: prevent access to chunks that don't exist on this thread
the generator shouldn't be creating chunks that it wasn't given.
2019-07-08 18:29:19 +01:00
fe3a4baddb added StairShape enum
this has no practical value to plugins yet, but it will in the future.
2019-07-08 18:08:52 +01:00
c42817f02f optimizing lighting performance a little 2019-07-08 15:39:57 +01:00
007aee72f8 SubChunk: remove BlockLegacyIds dependency, allow parameterising default block 2019-07-08 15:01:11 +01:00
4e2f430f06 shift default left instead of set value right
don't remove metadata bits for block comparison, because they could be part of the ID.
2019-07-08 14:53:19 +01:00
cdab3e967a Extract a LightArray unit from SubChunk 2019-07-08 14:37:48 +01:00
55cccff850 Player: fixed documentation of isValidUserName()
[ci skip]
2019-07-07 23:50:59 +01:00
03e70e68f4 Player: fixed documentation of getDisplayName()
[ci skip]
2019-07-07 23:49:11 +01:00
2cab22fd38 Merge branch 'stable' 2019-07-07 18:10:19 +01:00
7c52b4c93d make-release: added a missing newline 2019-07-07 18:02:25 +01:00
3f31dbde57 3.8.7 is next 2019-07-07 17:49:37 +01:00
1bfd6f2a90 Release 3.8.6 2019-07-07 17:49:37 +01:00
c7a5b8b0b4 Fixed noDamageTicks not preventing damage when last damage cause is null
noDamageTicks should make the entity completely invulnerable while active.
2019-07-07 17:37:52 +01:00
11fc16617a Liquid: fix max cost calculation for flow direction search, closes #2995 2019-07-07 14:32:52 +01:00
f9bfaa0c6a Merge branch 'stable' 2019-07-06 19:41:00 +01:00
77a4393c7b Fixed possible out-of-bounds access on corrupted playerdata when loading inventory contents 2019-07-06 19:39:07 +01:00
5274a0fe3c Extract an ExperienceManager unit from Human 2019-07-06 19:31:39 +01:00
da0358529a Extract a HungerManager unit from Human 2019-07-06 18:50:34 +01:00
4d7c18f65b first look at a giant static interface for block fetching 2019-07-06 17:29:40 +01:00
119cb083bf [ci skip] update changelog 2019-07-06 15:22:27 +01:00
5c25f770c2 World: reduce legacy id/meta dependencies 2019-07-06 15:21:45 +01:00
f3995f7cb0 Destroy EffectManager <-> Living cyclic reference on close (#2993) 2019-07-06 15:18:09 +01:00
a2bb6a41d9 World: some cleanup to random blocktick registry 2019-07-06 15:16:03 +01:00
ce77e283ab Revert "fix race condition between chunk generation and light population"
This reverts commit 80747814fb.
2019-07-05 19:56:58 +01:00
13de99315b fixed some artifacts getting cut in half 2019-07-05 19:56:31 +01:00
80747814fb fix race condition between chunk generation and light population 2019-07-05 19:40:33 +01:00
bda3631c24 Merge branch 'stable' 2019-07-05 19:21:49 +01:00
f714ed6e90 Generator: fixed incorrect negative seed parsing in convertSeed() 2019-07-05 19:20:21 +01:00
124640737a Explosion: make use of fromFullBlock()
this is in preparation for out-phasing legacy IDs.
2019-07-05 17:58:15 +01:00
ceeed57118 Player: remove iusername premature optimization 2019-07-05 17:28:37 +01:00
45b0cbc796 Human: remove getRawUniqueId() premature optimization
this is never used in a hot path and presents a potential for inconsistency.
2019-07-05 17:17:48 +01:00
2e01bd1029 cleanup imports from f356bf0893 2019-07-05 16:34:22 +01:00
77919b70b2 Stop cloning Color objects
since these are now immutable, there's no need to clone them.
2019-07-05 16:20:56 +01:00
f356bf0893 Extracted an EffectManager unit from Living 2019-07-05 16:15:58 +01:00
fe850a184c deal with fern mapping properly 2019-07-05 15:14:03 +01:00
2bd2e1125c Block: don't be stupid in getSide() 2019-07-05 15:04:13 +01:00
b021cc2138 ItemFactory: add PhpDoc for getAllRegistered() 2019-07-05 13:46:06 +01:00
453c5a329d Tile: remove useless code 2019-07-05 13:41:18 +01:00
ceb6529ee3 encapsulate light recalculation logic inside LightUpdate classes
now we can do a standard light recalculation from anywhere.
2019-07-04 19:55:48 +01:00
3d118a415c Merge branch 'stable' 2019-07-04 18:48:53 +01:00
7fc45bc5c3 partial fix for #2986 2019-07-04 18:18:42 +01:00
3bdf740597 formatting 2019-07-04 18:04:23 +01:00
9ed13bf112 Color: make use of intdiv() 2019-07-04 18:03:45 +01:00
a125980ada utils: Color is now immutable
as is always the case with mutability, allowing this creates lots of complications that aren't worth the hassle.
2019-07-04 18:00:48 +01:00
062e692069 AAAAAAAAAAAAAAAAAAAA 2019-07-03 20:02:33 +01:00
1d96c1810f wtf PhpStorm 2019-07-03 19:20:24 +01:00
4c5d8c12dd [ci skip] more updates to changelog 2019-07-03 18:32:20 +01:00
134a87ec7d BlockFactory: regenerate TODOs 2019-07-03 18:26:01 +01:00
ee885bb725 shorten BlockToolType constants 2019-07-03 17:57:11 +01:00
85051554c4 disallow logins from players with phony XUIDs
this simplifies XUID handling.
2019-07-03 16:47:02 +01:00
e07523056d Merge branch 'stable' 2019-07-03 16:35:29 +01:00
ab4b1be363 add constants for boat action of AnimatePacket
closes #2991
2019-07-03 16:30:45 +01:00
4a6d4953f2 updated consistency check for previous commit 2019-07-03 16:19:24 +01:00
80b29250c8 added all the element blocks 2019-07-03 16:17:17 +01:00
02bbf50dbe Make DragonEgg::teleport public (#2992) 2019-07-03 15:04:17 +01:00
5b02ca8a64 InGamePacketHandler: return unhandled for command requests without a leading /
some clients send things without the /, f.e. websocket stuff, and we aren't ready to handle that properly yet. The result is that the command gets dumped directly into the chat instead of being unhandled.
2019-07-03 14:34:22 +01:00
720254f64f fix crash on falling block above the height limit, closes #2803 2019-07-02 19:56:26 +01:00
d23eeff832 FallingBlock: remove useless check 2019-07-02 19:54:56 +01:00
206b397ee1 Living: drop useless knockBack() parameters, closes #2634 2019-07-02 19:52:51 +01:00
b0a85155d7 [ci skip] add inventory changes to changelog 2019-07-02 14:06:11 +01:00
3c7f68dc1e Fix Entity::isNameTagAlwaysVisible() was returning the wrong value (#2990)
* Fix Entity::isNameTagAlwaysVisible() was returning the wrong value

* "> 0" to "=== 1"
2019-07-02 10:44:41 +01:00
b90be8dc5f fix PhpStorm's screwups 2019-07-01 18:49:07 +01:00
7aa4d974ef move crafting stuff to pocketmine\crafting namespace 2019-07-01 18:47:09 +01:00
601ba4264d [ci skip] added incomplete changelog for 4.0 2019-07-01 17:42:18 +01:00
a325b1f3a1 Merge branch 'next-minor' 2019-07-01 17:19:57 +01:00
9e993aa83f ClosureTask: drop requirement for void return type
this creates unnecessary boilerplate for many inline usages.
2019-07-01 17:19:19 +01:00
fab12707ae Merge branch 'stable' into next-minor 2019-07-01 17:18:20 +01:00
b1ef1026ee WorldManager: Use the world's own logger to report tick overload 2019-07-01 15:24:45 +01:00
1156d5bdba batch optimize imports 2019-06-30 14:51:44 +01:00
5e5f43242e Extract a HandlerListManager unit from HandlerList 2019-06-30 14:49:09 +01:00
68bff6cf69 moved RegisteredListener to event namespace 2019-06-30 14:31:53 +01:00
80d4eeaa3c fix some occurrences of terrain truncation during generation 2019-06-29 11:14:34 +01:00
0d769aab48 Removed anti-noclip checks 2019-06-29 11:10:20 +01:00
44a205b1cc Remove MainLogger singleton and remaining MainLogger hard-dependencies 2019-06-28 16:36:17 +01:00
a4b50e57a4 move player arm swing processing to server side 2019-06-28 15:08:51 +01:00
e7733718b6 divide network\mcpe namespace into more subnamespaces 2019-06-27 19:39:59 +01:00
872b6ed708 Switch back to using fast-serialize for chunk send prepare
network serialize on the main thread is 3-5x more expensive than fast-serialize right now.
2019-06-27 19:28:47 +01:00
0e4966dfdf Split ProcessLoginTask into two tasks: 1) verify, 2) server handshake 2019-06-27 18:09:43 +01:00
193a41566d NetworkSession: Show the correct name on the player list 2019-06-27 17:04:36 +01:00
1749b57a83 ChunkManager: drop light-related methods
these were added in 2017 with the intent of async'ifying light updates. However, light updates now use an optimized code path which bypasses these functions completely, rendering them useless.
2019-06-27 16:56:46 +01:00
6da2bd4bb3 SimpleChunkManager: implement last-access performance optimization
this improves performance of writing blocks by ~30%.
2019-06-27 16:53:24 +01:00
45f5f112dd SubChunkIteratorManager now accepts $create as a moveTo() parameter instead of in the constructor 2019-06-27 16:22:56 +01:00
6f087190f4 SimpleChunkManager: added $create parameter 2019-06-27 16:13:14 +01:00
a279648c68 FastChunkSerializer: optimize palette writing 2019-06-27 15:42:10 +01:00
6838a1e07a BossEventPacket: fix crash in ::unknown6() 2019-06-27 15:16:06 +01:00
f3882dd658 Entity: remove more useless classes
these were slated for removal some time ago, but it never happened because they were used in the API. This is no longer the case on 4.0, so these classes are now entirely useless.
2019-06-27 14:23:24 +01:00
2ba76bd97d Convert UPnP into network interface
closes #2710, closes #2751
2019-06-27 13:41:58 +01:00
7f56f27505 some cleanup to held item handling 2019-06-26 19:40:40 +01:00
61d443bf4e Living: remove sendPotionEffects() network crap 2019-06-26 19:17:38 +01:00
9fe073fa73 move RakLib-specific components to mcpe\raklib namespace 2019-06-26 18:36:42 +01:00
3f9493bcd0 Remove another NetworkSession <-> NetworkInterface cyclic dependency 2019-06-26 18:22:32 +01:00
7eaca6bbaa Separate packet-sender functionality from NetworkInterface, break cyclic dependency between NetworkInterface and NetworkSession 2019-06-26 18:19:29 +01:00
9cedfeb2b2 Use the appropriate synchronization for held item rollbacks 2019-06-26 17:56:39 +01:00
f62d9cbb99 Player: rename equipItem() to selectHotbarSlot() 2019-06-26 15:52:01 +01:00
7bdb99ae8b Player: fixed consumable relying on undefined network behaviour to set using-item flags 2019-06-26 15:47:16 +01:00
eee039a490 Player: don't fire events on equipItem() when sending the same slot 2019-06-26 15:32:57 +01:00
ee72680f44 Removing "metadata": overengineered useless Bukkit copy-pasta
the intentions of this are good, but the usability is terrible and it's not fit for purpose. Since there are a total of zero plugins on Poggit which use this garbage, it makes more sense to eliminate the technical debt. See #2766 for discussion about replacing this.
2019-06-26 14:43:21 +01:00
26178b4435 InventoryManager: remove redundant cyclic dependency 2019-06-26 13:57:52 +01:00
9bebc6c69d PreSpawnPacketHandler: drop useless sending time
this is already sent in StartGamePacket.
2019-06-26 13:46:53 +01:00
4448919a8b Consider unknown chunk formats as corrupted
the reasoning for this is that the world version number should have accounted for a chunk format change. If it didn't, then we assume any chunk with a wrong version number is corrupted, since the handling of unknown formats is the same as that of corrupted chunks.
2019-06-26 13:22:45 +01:00
42b1c45fa5 Player: remove deprecated parameter from sendPopup() 2019-06-25 19:41:00 +01:00
a6395c9ac7 allow use of any iterable for enum initialization
this allows possible use of generators
2019-06-25 19:37:31 +01:00
44b7239847 SetDefaultGameTypePacket: added ::create()
not using this yet, but it was in my workspace and it might come in useful
2019-06-25 19:28:30 +01:00
e8d9acb59f added NoteSound and NoteInstrument enum 2019-06-25 19:26:18 +01:00
73938486fc added PaintingPlaceSound 2019-06-25 18:39:02 +01:00
6bbae4b2df SetDifficultyPacket: added create() 2019-06-25 18:34:12 +01:00
ec25a71396 Merge branch 'stable' 2019-06-25 18:16:36 +01:00
15fa1056b7 added make-release script 2019-06-25 18:03:48 +01:00
ff55f5e9ac Make BlockInventory non-abstract 2019-06-25 17:45:07 +01:00
8c2ca098e1 updated BedrockData submodule 2019-06-25 17:31:10 +01:00
f152ae9cbf EntityFactory: Allow registering entities without legacy numeric IDs associated
this shit really ought to be broken up into factories for each world format.
2019-06-25 17:23:41 +01:00
c19c42a934 PlayerBlockPickEvent: pre-cancel the event when picking would fail in survival 2019-06-25 16:30:07 +01:00
edccce1419 added ChunkListenerNoOpTrait to reduce chunklistener boilerplate 2019-06-25 16:23:43 +01:00
d85a27c5b2 BanList: remove useless Server dependency 2019-06-25 15:54:26 +01:00
8ec25b59a3 Remove useless $items parameter from inventory constructors 2019-06-25 15:43:55 +01:00
94ee33e47b Moved common Thread parts to trait 2019-06-25 14:57:40 +01:00
75a4136ab2 Player: fix bug in unloadChunk() causing entity artifacts on world change 2019-06-25 14:17:56 +01:00
de10e401bf Fixed wrong chunks being sent to players post-teleport or post-world-change 2019-06-25 13:41:03 +01:00
d15284e638 work on moving inventory network functionality to network layer 2019-06-25 13:28:01 +01:00
feac2df088 readme: point to /plugins on poggit
[ci skip]
2019-06-25 13:11:36 +01:00
4c2015fd0f Update README.md
[ci skip]
2019-06-25 10:48:11 +01:00
16482e6a95 Update README.md
[ci skip]
2019-06-25 10:46:44 +01:00
9f09dc3dd7 Player: Log a debug message when GC kicks in
I use this frequently to identify leaks. This isn't expected to appear immediately after disconnect, but it shouldn't take long to appear.
2019-06-24 17:46:30 +01:00
91580ce321 fix bug in InventoryCloseEvent 2019-06-24 17:27:12 +01:00
ae9115ad0d 3.8.6 is next 2019-06-24 14:55:38 +01:00
6b090d653c Release 3.8.5 2019-06-24 14:55:38 +01:00
012f015e7d [ci skip] update changelog md for 3.8.5 2019-06-24 14:25:47 +01:00
181cfef731 Remove a whole bunch of useless crap from PluginLogger
this is pretty much just an implementation of a NTS attachable logger now. It should probably be converted into a trait.
2019-06-23 19:39:40 +01:00
197a56e3e1 move BookEditPacket handler out of Player 2019-06-23 19:23:20 +01:00
3103579ba6 Merge branch 'stable' 2019-06-22 20:26:21 +01:00
6925451f3f StartGamePacket: added rogue field
this was added after 1.11.0 without a protocol version bump.
2019-06-22 20:25:50 +01:00
6db2a3a0fb Merge branch 'next-minor' 2019-06-22 19:49:18 +01:00
51f299f196 Merge branch 'stable' into next-minor 2019-06-22 19:46:23 +01:00
0273bd4f53 Merge branch 'next-minor' 2019-06-22 16:05:17 +01:00
2bb52cf811 Merge branch 'stable' into next-minor 2019-06-22 16:03:28 +01:00
6afc689529 Add Level->getTimeOfDay(), closes #2908 (#2979) 2019-06-22 16:00:18 +01:00
ce74549ba3 Use 10 bits for Y coordinate in blockhash
fixes #2553
2019-06-22 15:53:56 +01:00
46054803d5 [ci skip] tinkering with readme logo alignment 2019-06-19 14:04:30 +01:00
a9f99240b5 readme: even less noise [ci skip] 2019-06-19 13:57:20 +01:00
a16b44ea12 readme: reduce useless noise [ci skip] 2019-06-19 13:51:16 +01:00
ff8ca99c9f CrashDump: revert removal of RCON password redact in 738e310798
there's guaranteed to be some plant pot who uses 4.0, leaks his RCON password, downgrades back to 3.x, and then gets hacked.
2019-06-18 19:53:43 +01:00
c5707f6174 update DevTools submodule 2019-06-18 18:58:53 +01:00
2559f5ec2b Moved Player-related classes to pocketmine\player namespace 2019-06-18 18:51:36 +01:00
e82a40b2ba forgot to stage this for b18bd4f33c 2019-06-18 17:37:38 +01:00
c66af4648c Move thread-related classes from pocketmine to pocketmine\thread namespace 2019-06-18 17:36:25 +01:00
075f49aef0 don't send double disconnect messages 2019-06-18 16:22:41 +01:00
709963f90a shut up PhpStorm 2019-06-18 16:07:43 +01:00
b18bd4f33c rename SessionHandler -> PacketHandler 2019-06-18 16:02:46 +01:00
87c3636d44 ResourcePacksSessionHandler: moar debug 2019-06-18 15:10:58 +01:00
94299534b3 NetworkSession: fix some blind spots on logging 2019-06-18 15:01:44 +01:00
9df2ca3655 fixup some formatting issues 2019-06-18 14:12:37 +01:00
bb675ac99b Set parallel bootstrap file if the extension is loaded 2019-06-18 14:05:39 +01:00
7b049b6db1 NetworkSession: use a better check for timeout 2019-06-17 17:30:42 +01:00
e0a9ea2573 Player: clean up some crazy spawn logic in constructor
this was probably a leftover from some old code, I guess
2019-06-17 17:07:31 +01:00
db3305cb16 Remove Entity->isClosed() checks from places where they don't make sense
in all of these cases, this is just potentially concealing bugs. Closed entities should never appear at these points.
2019-06-17 16:39:46 +01:00
92e81e3298 Player: move some respawn net sync logic to NetworkSession 2019-06-17 16:27:04 +01:00
3c677bd3ec added PermissibleDelegateTrait to cut down boilerplate in Player and ConsoleCommandSender 2019-06-17 16:10:13 +01:00
20f092a685 Living: Do not use spl_object_id() for identifying effects
it's possible for these to have different IDs if they were cloned, serialized or copied between threads.
2019-06-17 15:58:33 +01:00
fe98b6c765 EnumTrait: rename getEnumName() -> name()
this is more concise and brings it more in line with Java.
2019-06-17 14:55:25 +01:00
c45c1c930e SetEntityMotionPacket: Mark as garbage serverbound 2019-06-17 14:22:08 +01:00
b344427a30 Added a hack to allow dropping garbage serverbound packets sent by a buggy client 2019-06-17 14:20:29 +01:00
698193622a WorldManager: rename get/setAutoSaveTicks() to get/setAutoSaveInterval()
this is less ambiguous.
2019-06-16 18:23:13 +01:00
4878fc4c93 Merge branch 'stable' 2019-06-16 17:18:17 +01:00
cd48d8272c added changelog for 3.8.5 2019-06-16 17:17:21 +01:00
6d09460abc Merge branch 'changelogs' into stable 2019-06-16 17:12:57 +01:00
b71bb867f4 DefaultPermissions: remove pocketmine.command.reload 2019-06-16 16:52:47 +01:00
94180cda72 Merge branch 'next-minor' 2019-06-16 16:42:05 +01:00
5a17a0d1aa Merge branch 'stable' into next-minor 2019-06-16 16:37:23 +01:00
b38c81c96f backport f84a1729c: Inventory: added swap() function 2019-06-16 16:35:34 +01:00
0fabc0c199 backport b8d1eb20b: EntityDeathEvent: add XP amount API, closes #2690 2019-06-16 16:31:03 +01:00
0ca07ad075 Fire QueryRegenerateEvent every 1 second instead of every 25, fixes #2670 2019-06-16 16:17:06 +01:00
60b183b0d9 backport a753c1342: Clean up Query cache handling, remove useless timeouts
the timeout was entirely useless, because:
- when shorter than 25.6 seconds (512 ticks) it would cause caches to be needlessly destroyed and regenerated
- when longer than 25.6 seconds, just made outdated caches persist for longer, even after the query info was regenerated.

This now uses a mark-dirty model to deal with caches, which means that plugin modifications to the query data will be reflected immediately, regardless of when they are made. Previously, modifying the result of Server->getQueryInformation() would have inconsistent results.
2019-06-16 16:08:27 +01:00
ec5598dbb1 Deprecate things removed in acb794e72 and 97c836f19 2019-06-16 15:37:27 +01:00
5d3b4f23a3 Merge branch 'next-minor' 2019-06-16 14:52:37 +01:00
7b98d203f4 Merge branch 'stable' into next-minor 2019-06-16 14:47:01 +01:00
dbf4054b1f backport 209135492: UUID: add type docs 2019-06-16 14:44:13 +01:00
82e4ef6d48 backport d8c81c0a1: UUID: remove useless default values
these are overwritten by the constructor, so they have no use here.
2019-06-16 14:43:28 +01:00
4635b93f4d backport 23071d257 + deprecations: Extract process-related functions from Utils into a separate Process class 2019-06-16 14:40:51 +01:00
a8433697ad backport aaaddd1fd: Terminal: stick a RESET on the end when writing a newline 2019-06-16 14:25:16 +01:00
d0d300a6f8 backport 342b48b75: VersionString: Use the correct bitwise operators 2019-06-16 14:21:02 +01:00
680cdb8e3e backport f5dbbea5f: Utils: added recursiveUnlink() 2019-06-16 14:20:05 +01:00
eaa78fe849 backport 205e13d88: Config: add getPath() (#2758)
Config->getPath() returns the path of the config i.e. the place where the config file is located.
2019-06-16 14:18:50 +01:00
eedea4998b Terminal: Added write() and writeLine() to allow easily emitting Minecraft-formatted text to the console 2019-06-16 14:16:14 +01:00
4e5a80c481 Recipe: deprecate interface 2019-06-16 14:12:49 +01:00
4d54dc30c1 crafting: deprecate some stuff that's been removed on bleeding edge 2019-06-16 14:11:08 +01:00
ac5339414a Merge branch 'stable' into next-minor
# Conflicts:
#	build/preprocessor
2019-06-16 14:08:06 +01:00
6161155660 CraftingManager: micro optimization: reuse closure for item deserialize & reduce indirection 2019-06-16 14:05:37 +01:00
2a5561fcd1 added more MultiRecipe UUIDs 2019-06-15 19:51:59 +01:00
4e734989bc fixing add/remove items from anvil & enchanting table
the functionality of these don't work yet, but the inventories work more correctly now.
2019-06-15 18:56:42 +01:00
93b83b4189 Player: Window system now only allows 1 window at a time 2019-06-15 18:19:09 +01:00
312a755a27 Player: rename $windows to $inventoryNetworkIdMap 2019-06-15 15:51:43 +01:00
a94541c531 Split CreativeInventoryAction into two new action types 2019-06-15 14:40:15 +01:00
4bbf1d56dc NetworkInventoryAction: shorten exception message
This is logged with the network session's logger, which provides context information already.
2019-06-15 14:27:11 +01:00
50a7fc0ba3 Rework inventory window open/close handling
- This fixes InventoryOpenEvent and InventoryCloseEvent being fired for persistent windows. Close #2950
- The ability to specify a custom network ID to assign the inventory to in addWindow() has been removed.
- The ability to assign a non-removable window in addWindow() has been removed.
- The ability to remove non-removable windows in removeWindow() and removeAllWindows() has been removed. This was previously needed for internal purposes.
2019-06-15 14:23:02 +01:00
c77e75fa93 FastChunkSerializer: fix typo 2019-06-14 19:42:50 +01:00
468340d55b this was stupid 2019-06-14 19:41:19 +01:00
8356285b66 Consistently call InventoryCloseEvent
this wasn't being fired when a plugin did the removal.
2019-06-14 19:39:35 +01:00
f671f2ebfa Inventory: drop useless proxy functions 2019-06-14 19:37:45 +01:00
787d305c2a Player: call InventoryOpenEvent consistently 2019-06-14 19:32:38 +01:00
2cb6fda286 Moved network chunk serializing code to network\mcpe namespace 2019-06-14 18:25:06 +01:00
08de657c8d Extract FastChunkSerializer unit from Chunk
this functionality doesn't directly pertain to Chunk functionality.
2019-06-14 18:19:46 +01:00
92035ac2ec Chunk: drop premature optimizations 2019-06-14 18:07:13 +01:00
722da5e88d Simplify hasChanged handling for chunk init
we always want chunks to be saved if they have tiles or entities
2019-06-14 18:00:37 +01:00
c8eefddfc0 Chunk: fix tiles not being loaded from NBT in some cases 2019-06-14 17:59:00 +01:00
211836274f World: remove redundant checks
when entities are added and removed which are savable, the dirty flag is set anyway, so these checks aren't needed.
2019-06-14 17:47:39 +01:00
5d531b56db travis.sh: lock down PHPUnit at 7.5.11
7.5.12 makes changes which assume libxml is present, which isn't the case with our PHP builds.
2019-06-14 16:58:56 +01:00
9e9de1e8ba Log a debug message when receiving a mismatch transaction 2019-06-13 19:52:53 +01:00
da4c646d27 Simplify InventoryAction implementation
none of these action types are able to fail now.
2019-06-13 18:35:05 +01:00
44be2179c4 SlotChangeAction: fix feedback loop 2019-06-13 18:31:25 +01:00
8551d1e282 Remove Inventory->sendSlot() and Inventory->sendContents()
the plan is to remove this from inventory entirely and use listeners for this.
2019-06-13 18:14:11 +01:00
7ba1dd3242 BaseInventory: remove setSize()
no inventory is designed to deal with this. Changing this can break transactions, specialized logic like double chest / furnace and more.
2019-06-13 17:24:17 +01:00
f128fc1849 Merge branch 'stable' 2019-06-13 16:07:00 +01:00
3568c7b1c7 Merge branch 'stable' of https://github.com/pmmp/PocketMine-MP into stable 2019-06-13 16:05:18 +01:00
862c844759 Write PID into lock file 2019-06-13 15:11:59 +01:00
6bd67730eb AsyncWorker: use a shorter name on logs 2019-06-13 14:00:26 +01:00
e95d81e04b Server: fix possible comparison bug in load orders 2019-06-12 19:50:27 +01:00
31f0576725 Server: remove useless constructor assignment 2019-06-12 19:47:51 +01:00
8afea36919 Clean up some internal commands protocol handling 2019-06-12 19:35:14 +01:00
4364d2a942 AvailableCommandsPacket: Clean up internals
this is still disgusting, but it's a little more bearable now.
2019-06-12 16:54:30 +01:00
42954c1d72 Server: document the crazy behaviour of some innocent looking functions 2019-06-12 10:14:29 +01:00
9765d78a5d Merge branch 'stable' 2019-06-11 19:19:32 +01:00
4c5f6eb1b7 Moved preprocessor submodule to build/ directory 2019-06-11 17:56:13 +01:00
02bc43b440 missed a bit 2019-06-11 16:48:24 +01:00
5832f42783 added changelogs as mdfiles 2019-06-11 16:44:05 +01:00
858f440bcf TimingsHandler: return the result of $closure() for easier usage
this isn't type safe, but it doesn't matter a whole lot, and there's nothing we can do about it without generics.
2019-06-11 15:04:30 +01:00
de6053de11 TimingsHandler: use a try/finally block in time() 2019-06-11 14:54:54 +01:00
f349a58f2b TimingsHandler: added time(Closure) function
I find myself often using try/finally blocks to avoid accidentally forgetting to stop a timer. This allows a cleaner more concise way of doing it.
2019-06-11 14:46:19 +01:00
1c69226187 NetworkSession: add an extra debug 2019-06-11 09:55:32 +01:00
8e6f21afad clean up gamemode net sync 2019-06-10 19:58:14 +01:00
f0d56f25b6 Moved creative inventory sync to NetworkSession 2019-06-10 19:54:24 +01:00
dd45753fa9 NetworkSession: add some more debug 2019-06-10 19:47:02 +01:00
3ac0c98199 De-spaghettify spawn notification handling 2019-06-10 19:31:54 +01:00
714393820f MainLogger: Use millisecond precision on log timestamps 2019-06-10 19:14:08 +01:00
3175a319a2 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/VersionInfo.php
2019-06-10 18:20:01 +01:00
7c1f038f20 3.8.5 is next 2019-06-10 17:56:23 +01:00
a42f68d3cf Release 3.8.4 2019-06-10 17:55:50 +01:00
b6f3f6120b InventoryTransaction: Shuffle actions on execution to prevent plugins relying on the order
closes #2955
2019-06-10 17:24:16 +01:00
96d3f4f78b Updated documentation for transaction classes 2019-06-10 17:19:03 +01:00
6756203aec InventoryTransaction: Added a warning about ordering 2019-06-10 16:54:45 +01:00
419fc418fe SubChunk: reduce memory usage on fast-deserialized chunks
this saves about 25MB RAM on an idle server on HEAD commit with 856 chunks loaded.
2019-06-10 15:52:21 +01:00
261ba017a6 Merge branch 'stable' 2019-06-10 11:15:17 +08:00
adb78679c5 Added link to docker image 2019-06-09 18:47:04 +08:00
c1f900ab18 Start using transactions for block placement 2019-06-08 18:56:27 +01:00
f84040a7ad FlowerPot (tile): Allow BlockFactory to determine id/data validity 2019-06-08 17:55:50 +01:00
1b629d7ac0 implement daylight sensor power recalculation 2019-06-08 17:52:47 +01:00
73964e6e2f Always do chunk relighting for unlit chunks on load
this is necessary because we stopped saving light info some time ago, so it has to be calculated on load for things to work properly.
2019-06-08 17:47:55 +01:00
ad1b9e5cdd fix item pickup animation 2019-06-08 17:35:56 +01:00
43dfc8ae0f Remove update mechanism for tiles, delegate to block instead
block handles triggering tile update on furnace for now.
2019-06-08 15:44:38 +01:00
fefc9b5278 wtf PhpStorm 2019-06-07 19:36:56 +01:00
5e88fda824 added BrewingStand tile (implementation incomplete)
since we already have a partial implementation of brewing stand, we should also have the corresponding tile so that PM doesn't create any more busted blocks.
2019-06-07 19:29:26 +01:00
3bc8244673 proper remapping for the old all-sided-log bug block 2019-06-07 19:25:44 +01:00
659cad0eff BlockFactory: added a hacky method to allow block state remapping
we need this for fixing old data in some cases
2019-06-07 18:31:37 +01:00
f30cee15ca added Dried Kelp block 2019-06-07 18:03:17 +01:00
a2274429ab Chest: constrain pair positions to immediately horizontally adjacent blocks
under normal circumstances a chest will never pair with a chest which isn't directly next to it anyway.
2019-06-07 17:24:59 +01:00
cc6296b019 Furnace: give some properties clearer names 2019-06-07 15:41:32 +01:00
7eb9b33fd6 Extract a CreativeInventory unit from Item
this will probably undergo further changes, but I'm primarily interested in just encapsulating the existing functionality for now.
2019-06-07 14:24:03 +01:00
41039cecc1 Furnace: remove redundant network properties
these properties are continuously updating when the furnace is active, but they never trigger cache destruction, which means this is sending outdated garbage over the network, which is entirely unnecessary anyway.
2019-06-07 14:15:47 +01:00
857092cf65 Furnace: Use the correct method to sync furnace fuel max burn time to the client 2019-06-07 14:06:17 +01:00
741d2a7380 devtools rollback 2019-06-07 10:49:58 +01:00
b0071ed703 Revert "remove PluginBase->getFile()"
This reverts commit 67321bb3f6.
2019-06-07 10:44:52 +01:00
b5805c2d0a Extract a ResourceLoader unit from PluginBase
this will allow addressing the resource accessing crash issue for script plugins, once fully implemented.
2019-06-06 19:32:23 +01:00
67321bb3f6 remove PluginBase->getFile()
this is in preparation for opening the doors to more exotic kinds of plugin loaders, such as eval()d or web plugins.
2019-06-06 18:35:47 +01:00
d176f6f1ca update DevTools submodule 2019-06-06 18:35:05 +01:00
f8a7766880 PluginBase: remove useless function
it's possible to check the loader instance instead of doing this, and we're gunning to get rid of the path from the plugin base.
2019-06-06 18:22:20 +01:00
b60731607d Update travis.sh 2019-06-06 17:20:16 +01:00
44c791f03e Thread/Worker run() are now final, to set up common environment things 2019-06-06 16:44:32 +01:00
e07f3e8e65 fine, variadics are annoying and this is easy to break ... 2019-06-06 15:12:46 +01:00
5c5fbf9b78 fixed oopses in 287c8c2dd4 2019-06-06 15:09:35 +01:00
32c832c87e Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Server.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter.php
#	src/pocketmine/network/mcpe/RakLibInterface.php
#	src/pocketmine/network/query/QueryHandler.php
#	src/pocketmine/utils/Utils.php
2019-06-06 15:04:05 +01:00
0058bfcd23 Utils: Limit length of printed stack trace strings to 80 characters 2019-06-06 14:56:19 +01:00
9f31b479e1 Improve stack trace rendering, show array and string lengths 2019-06-06 14:53:50 +01:00
eb161f8e1c Use base64 instead of hex to display binary in some places
base64 takes less space than hex, which is beneficial for logging larger payloads.
2019-06-06 14:43:20 +01:00
61afc7b62c NetworkSession: report the zlib error that happened 2019-06-06 14:16:04 +01:00
9f0a184a5d Packet: Remove mayHaveUnreadBytes()
this was an old hack to prevent debug spam being emitted when we halted decoding of logins over breaking protocol changes. Since then, we've gone back to trying to decode the packet regardless, so this property is useless.
2019-06-05 15:37:35 +01:00
3b5df90b0b BossEventPacket: add some functions to ease creation 2019-06-05 15:14:37 +01:00
287c8c2dd4 Added static create() functions for many packets
There are a few motivations here:
1) Less boilerplate code (this can be written inline)
2) It's possible to provide multiple constructors for different packet variations to reduce the chance of errors.
3) It makes things catch fire on updates in ways that static analysers can understand.
2019-06-05 15:00:08 +01:00
09afb8e772 Living: don't create MobEffectPacket directly 2019-06-04 19:53:08 +01:00
cda565ba8c Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/inventory/ArmorInventory.php
2019-06-04 18:19:47 +01:00
80f8a27094 Fixed implicit dependency on MobArmorEquipmentPacket field ordering
the order of the slots is entirely dependent on Mojang whims, so we shouldn't let our internals rely on it.
2019-06-04 18:16:56 +01:00
6f29fe063f move PlayerListPacket sending responsibility to NetworkSession 2019-06-04 18:02:36 +01:00
89d4f596bd World: add and use a prefixed logger in some places 2019-06-04 14:23:40 +01:00
3c3e5a9850 ConsoleCommandSender: Do not hard-depend on MainLogger
this dependency makes it impossible to swap out.
2019-06-04 14:06:45 +01:00
5d16a48361 FormatConverter: Follow the standard format for log prefix 2019-06-04 14:04:29 +01:00
0ae3c734ea RakLibInterface: remove unused variable 2019-06-04 14:00:01 +01:00
f5b149a022 RakLibInterface: Use the session's own logger to report handling errors 2019-06-04 13:56:52 +01:00
6743234461 AutoUpdater: add a prefixed logger 2019-06-04 13:51:17 +01:00
e69ab60034 MemoryManager: use prefixed loggers 2019-06-04 13:49:07 +01:00
3569f8dfbe QueryHandler: move to a prefixed logger 2019-06-04 13:44:35 +01:00
df0acea2f4 Player: add a prefixed logger 2019-06-03 19:30:26 +01:00
56a4e8c032 Hopper: add more boilerplate code to fix inventory leak 2019-06-03 19:17:13 +01:00
7a05c46ff6 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
2019-06-03 18:21:49 +01:00
341c480e13 ContainerSetDataPacket: added missing furnace property ID 2019-06-03 18:21:29 +01:00
8e24e5655a Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/entity/Attribute.php
2019-06-03 17:45:25 +01:00
971ad04299 Attribute: add more things
i got tired of commenting out exceptions in packets, so this is the quickest way to fix the problem.
2019-06-03 17:37:18 +01:00
087df45a3c added some effect ID constants 2019-06-03 16:17:36 +01:00
9d42bc3c0c updated consistency check for ad79e6cd8e 2019-06-01 12:12:55 +01:00
ad79e6cd8e partial implementation of hopper (just enough to load/save all data) 2019-05-31 19:32:19 +01:00
e091cfe1de interface Container extends InventoryHolder 2019-05-31 18:59:18 +01:00
df8db3b8e3 Merge branch 'stable' 2019-05-31 17:13:13 +01:00
025b72e2f2 Randomize the order of plugins retrieved from disk, fixes #2945 (#2948)
On most filesystems, plugins are loaded in lexical order because that's how the filesystem gives the files to us. This is a problem because it can hide bugs with dependency resolution on specific platforms with this behaviour, while inexplicably breaking on other platforms where the load order is different or undefined.

This change prevents plugins depending on any file yield order by randomizing the order in which plugin files are checked for loadability.
2019-05-31 17:11:20 +01:00
efe30ffb07 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
2019-05-31 15:31:32 +01:00
cf538afb84 LevelEventPacket: added two extra IDs 2019-05-31 15:31:03 +01:00
1049ffecc9 Sound->encode() now accepts Vector3|null
this will be needed for proper no-relative sound support.
2019-05-30 19:51:27 +01:00
77ace57985 BlockEventPacket: added a ::create() method 2019-05-30 19:44:29 +01:00
790c2cd4b7 added missing Monster Spawner tile 2019-05-30 19:26:16 +01:00
1bf5c74053 added missing DaylightSensor tile 2019-05-30 19:00:38 +01:00
f18da8d879 Added missing tile for Note Block
this doesn't come with a full impl because that requires some further changes like adding materials, which is out of the scope of this commit. This is here to prevent additional data loss in imported worlds.
2019-05-30 18:53:20 +01:00
ece4d99c1e fix crash on invalid NBT during itemstack decoding 2019-05-30 09:53:20 +01:00
3d8cd54f16 Update composer dependencies 2019-05-30 04:26:06 -04:00
f3daf612ee Merge branch 'stable' 2019-05-27 19:12:29 +01:00
7ff91337ad 3.8.4 is next 2019-05-27 19:01:06 +01:00
63e5867727 Release 3.8.3 2019-05-27 18:59:56 +01:00
c38779f1fd Block: fixed use of full meta as variant in several cases
fixes #2940

now I need to go to the bathroom and wash this off my hands ... I'd forgotten how nasty this code is
2019-05-27 18:04:25 +01:00
bcff124953 BaseRail: move reconnect attempt to post-place hook 2019-05-27 17:55:19 +01:00
28f3322337 Block: add onPostPlace() hook 2019-05-27 17:30:57 +01:00
11d21448fc Utils: remove dead function 2019-05-27 17:12:33 +01:00
7eb8d8e366 Require Closures in more places instead of callable
Non-closure callables have strange context-dependent behaviour and are slower to call than a closure. It's possible to use Closure::fromCallable() in the origin scope, which guarantees that the callable will remain callable no matter where it's used.
2019-05-27 17:11:35 +01:00
2720ff9607 Skin: debloat geometry in constructor directly 2019-05-27 16:45:55 +01:00
89242543b9 Clean up Skin error handling, close #2926
Skin->__construct() now does all the validation.
2019-05-27 16:20:46 +01:00
0a891f5408 Move some things out of LoginPacket and into the handler 2019-05-27 16:06:53 +01:00
3902a3c28c Require opting into receiving cancelled events instead of opting out (#2906)
Warning for plugin developers: This is a silent BC break. It won't raise any errors.

This alters the default behaviour of event handlers to **not** receive cancelled events by default.
It is now required to opt into receiving cancelled events by using the @handleCancelled directive (or the handleCancelled parameter where it's appropriate).

The ambiguous @ignoreCancelled directive is now ignored.

Ramifications:
- The majority of handlers with `if($event->isCancelled()) return;` no longer need such checks.
- Handlers with `@ignoreCancelled true` or `@ignoreCancelled` annotations can have them removed.
- Handlers which want to receive cancelled events need to use `@handleCancelled`.
2019-05-27 15:47:58 +01:00
14bae72dd5 Create FUNDING.yml 2019-05-27 14:14:09 +01:00
2eb498b84c ItemFactory: add getAllRegistered() 2019-05-26 19:45:47 +01:00
c1a7d86670 leveldb: more historical versions 2019-05-26 19:35:18 +01:00
e6048e115e leveldb: add more chunk versions 2019-05-26 18:01:24 +01:00
2c40fbfe11 add some TODOs for tiles 2019-05-26 16:27:20 +01:00
33d1203bfd Player: move sendAllInventories() to network layer 2019-05-26 15:58:03 +01:00
85718e2750 Clean up a bunch of garbage in Furnace 2019-05-26 15:43:46 +01:00
32e03cd92d DoubleChestInventory: remove duplicated code 2019-05-26 15:01:32 +01:00
685f5d562b DoubleChestInventory: fixed use of void result 2019-05-26 14:48:52 +01:00
d23dbc69f1 BlockFactory: Alias some classes to improve readability 2019-05-25 19:59:24 +01:00
a44d47fd3c BlockFactory: Consistently use aliases to refer to tiles 2019-05-25 19:25:42 +01:00
b329cac3d2 Move pocketmine\tile\* to pocketmine\block\tile\* 2019-05-25 19:23:43 +01:00
066eadd687 Move responsibility of copying block-picked item NBT to Block instead of Player 2019-05-25 19:00:11 +01:00
c29523baf4 added a bunch of new blocks 2019-05-24 19:59:03 +01:00
54216c2fee Block: Blow away a bunch of useless classes 2019-05-24 19:38:43 +01:00
d25ecbebd4 Merge branch 'stable' 2019-05-24 17:33:51 +01:00
f35b43613d IronTrapdoor: fixed fuel time, closes #2914
this should be removed during branch merge.
2019-05-24 17:31:36 +01:00
3d0fa10437 Stonecutter: fix hardness, close #2915 2019-05-24 17:30:20 +01:00
3ea8da2dd3 Use EnumTrait->equals() instead of direct comparison
It's not guaranteed that objects provided are the same as those in the enum registry, so they can't be directly compared.

Implementing comparison with === would require some kind of __equals() implementation or an extension to hook into such functionality.
2019-05-24 17:21:44 +01:00
9ce1e29a17 Player: fixed bow shooting, closes #2931 2019-05-24 15:58:00 +01:00
1c99602a3f Player: give some inventory vars clearer names 2019-05-20 19:38:53 +01:00
297ca25123 remove usage of inventory network IDs for marking permanent windows 2019-05-20 16:45:46 +01:00
cd0f0cb66c missed this in previous commit 2019-05-20 16:45:00 +01:00
d6ce3f82b1 Inventory: remove redundant return values 2019-05-20 16:30:00 +01:00
c21a25efb9 move more rollback handling to network handlers, out of Player 2019-05-20 16:13:14 +01:00
04d0b6c054 don't spam listeners with slot-change notifications when doing a content change 2019-05-20 15:45:15 +01:00
c13b352b76 fix armour not being set correctly on entity spawn 2019-05-20 15:31:23 +01:00
d9bc48bb01 CraftingGrid: Remove redundant overrides
the network session knows not to send this stuff because it's not associated with any window ID.
2019-05-20 15:15:20 +01:00
bca0833035 Clean up handling of armour sync 2019-05-19 16:56:10 +01:00
cd103cefcc Redesign inventory listening API
given that inventory listeners are no longer allowed to fiddle with the outcome of changing contents, it's now possible to allow having multiple listeners receiving events.

It's likely that this will be used for network inventory sync in the near future.
2019-05-19 16:36:38 +01:00
dec6c9f49b Removed EntityInventoryChangeEvent and EntityArmorChangeEvent
there is nothing that these events do that can't be fulfilled by transactions. They complicate the internal implementation and produce unexpected behaviour for plugins when cancelled.

TL;DR: Use transactions. That's what they are there for.
2019-05-19 16:02:03 +01:00
67affcea32 move more packet logic to net session
it seems like net session is turning into a giant dumping ground for sending API ... this needs to be cleaned up somehow.
2019-05-19 15:48:01 +01:00
57219abc9d fix test failure 2019-05-18 20:20:33 +01:00
c3c2dd3988 Rename SimpleSessionHandler -> InGameSessionHandler
the "simple" name comes from the early days of this refactor before I started splitting everything up into their own units. This handler is now in good enough condition to have a proper name.
2019-05-18 19:13:41 +01:00
fa9fcea189 SimpleSessionHandler: Do not read blocks from world in onFailedBlockAction()
the world will do this anyway, so we can reduce our code burden here.
2019-05-18 19:11:23 +01:00
d44ec702b0 Added BlockDataValidator::read5MinusHorizontalFacing() 2019-05-18 17:42:03 +01:00
b11d3b0401 CraftingDataPacket: Fixed uncaught exception in decode
this is not exploitable because it's not a serverbound packet, but it should be fixed nonetheless.
2019-05-18 17:19:44 +01:00
cd8645ff20 Removed PalettedBlockArray stub
the SubChunkConverter stub was accidentally removed in dd914e0752, but no great harm done ...
2019-05-18 15:15:20 +01:00
6de0b48c1f PacketBatch: Always encode packets freshly, never reuse buffers
this causes bugs when a packet is modified during events and then re-sent to a player. Since we can't control this, we can't allow this kind of buffer reuse.

The only notable case where this will cause loss of performance is when broadcasting a series of packet(s) which accumulate to less than 256 bytes, which is reasonably cheap to encode anyway.
In addition, removing this caching is one roadblock to moving this serialization to native code, which will make it vastly faster.
2019-05-17 18:04:51 +01:00
64f7f558a4 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/entity/Human.php
2019-05-17 17:43:30 +01:00
76e5ea385b Skin: improved error checking
plugin devs should find this less of a pain in the ass now.
2019-05-17 17:40:27 +01:00
0f398bbe66 LevelDB: Added conversion of legacy extradata -> 4D subchunk block layers 2019-05-17 17:15:45 +01:00
f7a9da4e92 PillarRotationTrait: Allow axis shift to be defined by the includer 2019-05-16 18:02:03 +01:00
dd914e0752 Block: move all legacy metadata constants into a dedicated class
this makes it easier to see what is using metadata (and makes it easier to get rid of later).
2019-05-16 16:55:44 +01:00
1898db840d BlockFactory: more collapsible region things 2019-05-16 14:36:02 +01:00
642c16dfe7 added some //region ... //endregion 2019-05-16 14:35:34 +01:00
ff2600a0d0 Regenerated TODOs for BlockFactory and ItemFactory
also added //region and //endregion for IDE collapsibility
2019-05-16 14:20:51 +01:00
5024de38b8 added more types of stone slab 2019-05-15 18:15:25 +01:00
9ea684581f Merge remote-tracking branch 'origin/stable' 2019-05-13 18:17:42 +01:00
fd413b512e Remove useless Dandelion class
this class is line-for-line identical to the Flower class.
2019-05-12 18:42:49 +01:00
10831821be Anvil: fix wrong visibility for recalculateBoundingBox() 2019-05-12 17:58:45 +01:00
85c6eb5003 Fence: cleanup some BB handling 2019-05-12 16:22:41 +01:00
166d821bcf Stair: some BB handling cleanup 2019-05-12 16:22:20 +01:00
d6b720b55d Wall: minor BB calculation cleanup 2019-05-12 16:21:52 +01:00
a19651a8dc Painting: reduce complexity of getPaintingBB()
this makes it easier to unit-test.
2019-05-12 16:15:31 +01:00
adf4639625 Painting: Clean up painful BB calculation code 2019-05-12 16:10:51 +01:00
db4dac6d45 World: Remove incorrect isSolid() check for placement collision check
isSolid() != can be collided with. That's decided by the collision boxes provided, if any.
2019-05-12 16:00:38 +01:00
90e6073202 Vine: Clean up awful bounding-box calculation
the logic here is deceptively simple, just obscured by a lot of really nasty code.
2019-05-12 15:58:28 +01:00
41d754de5a Vine: fix bug when reading state multiple times 2019-05-12 15:03:44 +01:00
5a351d3caf Fix for Server::hasOfflinePlayerData (#2919) 2019-05-12 12:06:05 +01:00
bb93d4f8de TimeCommand: Fix commands.time.query message (#2917) 2019-05-12 09:21:39 +01:00
66818e178a DefaultPermissions: Fix typos in permission descriptions (#2918) 2019-05-12 09:20:45 +01:00
c99846e069 Unify Item constructor style
this exposed a few more dead classes.
2019-05-11 18:24:21 +01:00
51f96b195e ItemFactory: fix wrong typehint 2019-05-11 18:02:18 +01:00
0bf7fd2c0d Partially revert "Separate block break-info to a separate dynamic unit"
This reverts commit 9e72bc91a2.
2019-05-11 09:46:20 +01:00
650e186481 Removed bad assumption that every Flowable descendent is an instant-breaking block
I'm wondering if there is even a point to Flowable at this point. Half of the blocks inheriting from it do not break instantly, or have some other modification to tool requirements.
2019-05-10 17:00:01 +01:00
01ad568256 Air: use BlockBreakInfo::indestructible() 2019-05-10 16:30:14 +01:00
9e72bc91a2 Separate block break-info to a separate dynamic unit 2019-05-10 16:24:59 +01:00
3be5de4570 Separate WoodenTrapdoor from Trapdoor, fixed iron trapdoors being valid furnace fuel, closes #2914 for bleeding-edge 2019-05-09 19:30:18 +01:00
5eb3c52a37 added PunchBlockParticle, encapsulate more network logic 2019-05-09 15:40:58 +01:00
51a8c2be9d Player: Move rollback responsibility to network for interact/break block
Custom player implementations might not need rollbacks (f.e. Specter).
2019-05-09 14:54:56 +01:00
ca7c23c137 Player: remove dead functions
these functions belong in the network session, and they are currently just proxies for them. In the future we might have players who don't have IPs at all depending on how they connected (for example Specter) so this stuff shouldn't be in here.
2019-05-08 19:47:25 +01:00
4634baeb02 Player: don't repeat yourself 2019-05-08 19:38:57 +01:00
cf73c7f5c1 Cleanup to world provider exception handling 2019-05-08 18:26:41 +01:00
a51c06116a Merge branch 'stable' 2019-05-08 17:04:37 +01:00
f782a478c4 Player: clarify resetTitles() documentation 2019-05-08 17:03:40 +01:00
19ac0811f4 Player: remove deprecated title functions 2019-05-08 16:44:18 +01:00
a331c5e13f Player: reduce SetTitlePacket creation boilerplate
it's better to encapsulate all this logic in one place so that third party developers can more easily understand this, and also to reduce the amount of crap we have in Player.
2019-05-08 16:43:05 +01:00
9fbf41b9a1 Merge branch 'stable' 2019-05-08 15:41:17 +01:00
c06b4830d1 Player: don't spawn entities on out-of-sync chunks on join, closes #2911 2019-05-08 15:36:54 +01:00
fc90cdcc95 fix #2910 WorldManager->getLevel() missed in refactor 2019-05-08 14:05:42 +01:00
cf0c0e72a9 Assume the player is online when they are, uh, assumed to be online
the checks removed here should never be hit under normal circumstances. If they were hit, they'd just conceal bugs which would cause a crash to happen later anyway.
2019-05-07 19:49:06 +01:00
78bb6f4a0c Reduce complexity of chunk sending system 2019-05-07 19:26:01 +01:00
51548d1a27 World: remove useless internal function
this just complicates the logic for no reason. It had a purpose once, but no longer.
2019-05-07 18:51:26 +01:00
c1a483a36d move entity spawning logic back to Player 2019-05-07 18:35:04 +01:00
d7a7ab5102 Move Entity despawn logic back to Player
this is not network-session specific, and different implementations will need to do this.
2019-05-07 18:01:23 +01:00
66481fedeb Entity: Protect internal methods setPosition() and setPositionAndRotation()
teleport() should be used instead (or setRotation() for rotation-only changes).
2019-05-07 17:38:33 +01:00
00944eff72 Removed EntityWorldChangeEvent
there's nothing that can be done with this event that can't be done with EntityTeleportEvent. Having this extra event needlessly increases system complexity.
2019-05-07 17:37:10 +01:00
cb3a225d45 Merge remote-tracking branch 'origin/stable' 2019-05-07 17:28:07 +01:00
3cd6e12e71 Renaming "Level" -> "World" (#2907)
This has been a pain point for a long time due to the misleading nature of the name "level". It's also confusing when trying to do things like getting the XP level of the player or such, and also does not translate well to other languages.

This transition was already executed on the UI some time ago (language strings) and now it's time for the same change to occur on the API.

This will burn a lot of plugins, but they'll acclimatize. Despite the scary size of this PR, there isn't actually so many changes to make. Most of this came from renaming `Position->getLevel()` to `Position->getWorld()`, or cosmetic changes like changing variable names or doc comments.
2019-05-07 14:47:28 +01:00
427e334426 rename PacketStream to PacketBatch 2019-05-06 19:58:02 +01:00
ce61c6e0fd PacketStream: added fromPackets() sugar 2019-05-06 19:54:42 +01:00
3415edf600 PacketStream: add @throws 2019-05-06 17:46:37 +01:00
c2771eba88 use the appropriate API for decoding packet batches 2019-05-06 17:46:17 +01:00
82974e0271 NullSessionHandler: possibly premature optimization 2019-05-06 17:28:56 +01:00
685481b172 NetworkSession: improve GC performance without crashing everything
this is necessary because some handlers have circular references to the session, which causes GC lag collecting them. This change allows them to be collected immediately without nuking internal state.
2019-05-06 16:43:05 +01:00
5250a432d1 NetworkSession: add a dedicated PrefixedLogger, clean up some boilerplate code 2019-05-06 16:32:34 +01:00
6d64ef8d74 Server: fixed crash reporting bug introduced by a6e5b6e158 2019-05-05 20:52:52 +01:00
c5498bb3fa Implement a locking variable to circumvent a infinite regression (#2901)
closes #2876
2019-05-03 14:46:51 +01:00
7ae84944ca protocol: add some missing interfaces for new packets 2019-05-02 17:35:54 +01:00
6b4c11febb Merge branch 'next-minor' 2019-05-02 17:26:02 +01:00
9fd922fe6a Merge branch 'stable' into next-minor 2019-05-02 17:25:29 +01:00
59334d652f 3.8.3 is next 2019-05-02 17:13:50 +01:00
5c81da9b1e Release 3.8.2 2019-05-02 17:13:21 +01:00
b08affc4c6 Updated preprocessor submodule 2019-05-02 17:11:40 +01:00
af07ffb292 Merge branch 'next-minor' 2019-05-02 16:44:50 +01:00
fdaf9dce73 Merge branch 'stable' into next-minor 2019-05-02 16:39:05 +01:00
cb49f1e835 fixed air being breakable by creative players
closes #2851
2019-05-02 16:25:23 +01:00
f6a0f4aa82 Player: fixed immobile interference on PlayerJoinEvent
closes #2894

this should use a cleaner hack that doesn't affect plugins at all, but that's too much work for this one bug fix.
2019-05-02 16:20:28 +01:00
de09c8c082 Player: fix crash handling resource pack requests 2019-05-02 16:17:39 +01:00
0ac87989dc Update RakLib to 0.12.4 2019-05-02 16:08:03 +01:00
0317b0f22d Merge branch 'next-minor' 2019-05-02 15:07:38 +01:00
732e27751c Merge branch 'stable' into next-minor 2019-05-02 15:04:23 +01:00
13ea984b12 Server: setup world things at a more appropriate time
closes #2859

this also fixes reported headaches attempting to override generators before world load.
2019-05-02 15:02:10 +01:00
3878f58847 Level: fixed crash when time overflows
this can be triggered by a plugin setting time to PHP_INT_MAX

fixes CA 2346977
2019-05-02 14:22:01 +01:00
d7a35a5302 Entity: fixed motion not being initialized when Motion NBT tag is missing
fixes CA 2355485
2019-05-02 14:00:28 +01:00
1730415643 Player: remove useless checks from spawnTo(), closes #2897
this was caused by changes on 4.0, but this code is nonetheless useless.
2019-05-01 14:43:11 -04:00
293311569d Merge branch 'next-minor' 2019-05-01 18:55:49 +01:00
932c489de1 Rename addTitle/addSubTitle/addActionBarMessage prefixes to "send", deprecated old variants
closes #2896

these deprecated methods will be removed in 4.0.
2019-05-01 18:54:20 +01:00
67e75d6c0a Moved DataPropertyManager to network namespace
this is _extremely_ network-focused code.
2019-04-26 18:57:44 +01:00
854a2f5135 Move a giant heap of network garbage out of Entity 2019-04-26 18:52:38 +01:00
ea8c723092 EntityFactory: added some documentation 2019-04-26 18:15:31 +01:00
854c3a816c LevelManager::generateLevel(): avoid multiple return points
this could cause unexpected results if additional code is added after background generation in the future.
2019-04-26 18:05:34 +01:00
7c7f42eba6 Added API method to get & set autosave interval 2019-04-26 18:01:40 +01:00
6aa8276532 Revert "Player: removed useless addActionBarMessage()"
This reverts commit 7d22b2a6d7.
2019-04-26 15:41:19 +01:00
6a2d1fbdda Merge branch 'stable' 2019-04-26 15:06:46 +01:00
d850a84d0d Level: clean up and remove checkTime() 2019-04-26 14:15:41 +01:00
22d9260a3b remove unused import 2019-04-26 13:56:32 +01:00
3c90ed13b9 NoteBlock: added //TODO 2019-04-26 12:45:08 +01:00
396efbac7e Human: simplify setFood() 2019-04-26 12:40:15 +01:00
00644dd529 Fixed an edge-case in AvailableCommandsPacket decoding 2019-04-26 12:32:42 +01:00
c2c210e25a Fixed --enable-ansi and --disable-ansi not being respected on threads
this causes some breakage to the behaviour of Terminal, and for that reason this is going on 4.0.

Terminal::hasFormattingCodes() will no longer auto-detect whether colour codes are supported.
2019-04-26 12:30:24 +01:00
86c4e936cb Player now drops the contents of temporary inventories
these inventories are just glorified crafting tables.
2019-04-26 12:27:52 +01:00
3b103dcd62 Level: use isInWorld() where appropriate 2019-04-26 12:26:01 +01:00
48dfc5b232 Level: reduce complexity of populateChunk() 2019-04-26 12:18:00 +01:00
39360f127a Player: Don't use iusername in cases where it's useless
these calls all do strtolower() anyway, so having iusername here just makes it confusing.
2019-04-26 12:07:47 +01:00
25890e76e2 Player: replace redundant usage of Server->broadcast() 2019-04-26 12:04:56 +01:00
810bdeb965 Test one extra case for LevelProviderManager 2019-04-26 12:01:12 +01:00
b6b3dcc1aa Improve documentation of SourceInterface and AdvancedSourceInterface 2019-04-26 11:59:10 +01:00
e0818e7e52 reorganize and optimize start.sh (#2267) 2019-04-26 11:54:50 +01:00
4ca40a21ae Merge remote-tracking branch 'origin/stable' 2019-04-26 06:24:07 -04:00
d0c4463773 3.8.2 is next 2019-04-26 10:08:59 +01:00
7521160f53 Release 3.8.1 2019-04-26 10:08:22 +01:00
7ec926867f Merge branch 'stable' 2019-04-25 20:54:23 +01:00
4f5190e3f8 Updated BedrockData submodule 2019-04-25 20:53:08 +01:00
7d712d68c4 Merge branch 'stable' 2019-04-25 18:31:22 +01:00
3c941dd992 Move more stuff to BedrockData submodule 2019-04-25 18:23:31 +01:00
89f457b397 updated legacy ID table (thanks @MCMrARM) 2019-04-25 17:49:10 +01:00
2bdbb9794c New, more efficient blockstate table format
this reduces the file size by ~90%.
2019-04-25 17:28:22 +01:00
898009a91b Sync crafting data changes
this seems to fix #2881, at least the reproducing case that was given.
2019-04-25 16:22:12 +01:00
c5ca623124 Merge branch 'stable' 2019-04-25 15:27:13 +01:00
a3dea09e2a sync with latest codegen changes 2019-04-25 15:19:15 +01:00
793f93afdb NetworkSession: sync with latest code generation changes 2019-04-25 14:49:20 +01:00
64506ea3ae PacketPool: add @throws 2019-04-25 14:48:55 +01:00
4a35516441 Reduce BatchPacket hacks
we can't get rid of these hacks entirely because BAcKWARdS ComPaTIbilitY, but this at least ensures that things over PID 127 won't burn the house down when 1.12 gets here. This also reduces conflicts with 4.0 line.
2019-04-25 14:48:36 +01:00
74b9922a28 3.8.1 is next 2019-04-24 20:00:58 +01:00
088fbf65b1 Release 3.8.0 2019-04-24 19:54:57 +01:00
fa70127241 1.11.0 protocol changes 2019-04-24 19:54:16 +01:00
fc76d04dcb StartGamePacket: allow specifying a custom runtimeID table
this is not the intended goal, but it's a happy side effect of making it easier to extract structured information from the client.
2019-04-24 18:40:29 +01:00
15ae323bcb doxygen: updated config file 2019-04-23 17:58:24 +01:00
353bae87a7 3.7.4 is next 2019-04-23 17:14:49 +01:00
dc7be3fd52 Release 3.7.3 2019-04-23 17:13:04 +01:00
f28a0740a0 Move version info to its own file for easier third party tooling 2019-04-23 16:07:25 +01:00
df990fb47a disable C preprocessing (this will just cause unwanted bugs) 2019-04-23 15:43:39 +01:00
ffb0ed80a2 resync RakLib dependency 2019-04-22 22:29:54 +01:00
6af84caba6 Merge branch 'stable' 2019-04-21 17:52:57 +01:00
98ca28d96e add a warning when chunkutils is missing 2019-04-21 17:36:38 +01:00
0dac982f16 Merge branch 'stable' 2019-04-21 16:56:53 +01:00
db896b9faf ok i'm done
i am obviously not in any fit state to be doing this today...
2019-04-21 14:22:54 +01:00
76c234e4e6 add some limits on batches 2019-04-21 14:16:38 +01:00
2ef3962028 sync RakLib dependency 2019-04-21 13:24:19 +01:00
86cc151e60 Revert "Network: Each interface now keeps its own statistics"
This reverts commit 7720a0534e.
2019-04-18 15:45:03 -04:00
7720a0534e Network: Each interface now keeps its own statistics
this allows more detailed analysis.
2019-04-18 19:57:40 +01:00
f933ce31dd Merge branch 'stable' 2019-04-18 19:40:22 +01:00
1e5941c98c Level: Properly report world save timings
this wasn't including chunk unloading in the world save timings.
2019-04-18 19:39:23 +01:00
752e398970 AsyncTask: TLS now supports storing multiple values (now requires a key/value pair) 2019-04-18 18:58:31 +01:00
a4c7ec077b Fixed possible crash in ChunkRequestTask 2019-04-18 17:45:14 +01:00
5913d5038b Cleaned up Entity->close() handling 2019-04-18 17:23:48 +01:00
cc01dfe8df Player: protect usedChunks 2019-04-18 16:20:56 +01:00
d68501c748 fixed spawn-radius: 0 2019-04-18 16:12:20 +01:00
939dfd9269 First look at separating chunk sending from Level 2019-04-17 19:33:37 +01:00
0973e39697 Level: Fixed ChunkListeners not receiving some events when no loaders are using a chunk 2019-04-17 16:13:40 +01:00
3468f006a2 Use AsyncTask->onError() for chunk task crash tracking 2019-04-17 16:00:17 +01:00
e62bbd4754 AsyncTask: added onError() main thread hook, closes #2512 2019-04-16 17:44:14 +01:00
b4f6c1e1a6 Merge branch 'stable' 2019-04-15 18:58:53 +01:00
9ca7c0c883 3.7.3 is next 2019-04-15 18:45:53 +01:00
b4a8f8391b Release 3.7.2 2019-04-15 18:45:16 +01:00
142d750b9f TextFormat: clean() now removes private-use area Unicode characters
the console can't print these, and these are being abused to cause mass crashes in the wild.
2019-04-15 18:42:09 +01:00
209ae51a67 Merge branch 'stable' 2019-04-15 16:11:49 +01:00
948b0b4cbc Add an API change request template 2019-04-15 08:49:31 +01:00
d6b596a8ac moar issue templates 2019-04-15 08:49:16 +01:00
eab2d4d704 Add a Support issue template
maybe this will guide people who don't read into shooting themselves in the foot automatically >:)
2019-04-15 08:49:01 +01:00
8114551600 add a Crash issue template
valid crashdumps are usually self explanatory and include all required information like OS/version/etc, so there's no need to force reporters to rewrite a bunch of extra information that should already be in the crashdump.
2019-04-15 08:48:45 +01:00
8e1d1993c5 Update support.yml 2019-04-15 08:48:31 +01:00
82bf5f6193 Add Discord link to issue template 2019-04-15 08:48:16 +01:00
76a86e51f7 Remove legacy issue template 2019-04-15 08:47:58 +01:00
d1e803685a Update issue templates 2019-04-15 08:47:42 +01:00
0a884aa5fb Support bot: Be a little less rude 2019-04-15 08:47:32 +01:00
c410e676b3 Update ISSUE_TEMPLATE.md 2019-04-15 08:47:18 +01:00
8f1f5fde47 Security vulnerability reporting for dummies 2019-04-15 08:46:59 +01:00
0f268df2e0 Add community Discord to Discussion section 2019-04-14 22:57:13 +01:00
86108e7010 Added donation methods 2019-04-14 22:57:00 +01:00
5ea448ef36 Add ExamplePlugin to README 2019-04-14 22:56:49 +01:00
389e7767d1 Sign: apply a very stupid limit on text size
this is necessary because of the epidemic of server attacks going around lately.
2019-04-14 19:30:28 +01:00
4c268acc00 Fixed /whitelist on/off permissions, closes #2849 2019-04-14 17:58:53 +01:00
e506c7f7de Call BlockTeleportEvent when dragon egg teleports (#2840) 2019-04-14 17:46:22 +01:00
cfd4580388 sync NBT network string length cap 2019-04-14 17:14:44 +01:00
9b0b8b9a0c Sync NBT dependency 2019-04-14 17:11:56 +01:00
8a1c362db7 Server: remove dead function getDefaultGamemode()
this was functionally identical to getGamemode() and is now just a red herring.
2019-04-13 14:31:58 +01:00
6428ca2a42 Merge branch '3.7' 2019-04-13 14:27:14 +01:00
e34a4f6b98 Added server.lock into .gitignore
closes #2868
2019-04-13 14:26:47 +01:00
c4b4575c74 Refuse to load plugins with ambiguous minAPI versions
closes #2381
2019-04-12 19:51:43 +01:00
bf2851f324 Move API checking to its own class so it can be unit-tested 2019-04-12 19:45:41 +01:00
5f23fffdda Merge remote-tracking branch 'origin/3.7' 2019-04-12 18:33:13 +01:00
342b48b758 VersionString: Use the correct bitwise operators 2019-04-12 18:32:15 +01:00
3925e598d6 Acquire exclusive lock on <datadir>/server.lock to avoid data corruption (#2858)
this fixes #2855.
2019-04-08 20:31:24 +01:00
383ec8a8e3 TextFormat: Fixed tokenize() not being Unicode-aware 2019-04-08 15:45:26 +01:00
95313e0a90 Updated some entity metadata properties 2019-04-08 14:42:33 +01:00
e9a87978a6 Fixed usages of commands.generic.permission
apparently this doesn't exist in the client anymore
2019-04-07 15:07:24 +01:00
c310a0c50c Merge branch '3.7' 2019-04-06 15:35:58 +01:00
612e9e162c Fixed worlds with unknown generators silently getting wrong generator, closes #2860 2019-04-06 15:17:36 +01:00
c49ead1a4c Merge branch '3.7' 2019-04-05 18:49:02 +01:00
fdc3faadc9 Register two missing default permissions
this fixes the pocketmine.command node not having the expected effect in some cases.
2019-04-05 18:48:37 +01:00
e07b3f534b Merge branch '3.7' 2019-04-05 09:36:57 +01:00
9644e72acf Doxygen: added index page 2019-04-05 09:35:25 +01:00
86a5a50330 Generator: remove more useless functions
these are red herrings for plugin developers since they are not used.
2019-04-04 17:53:25 +01:00
5a989d82bb Generator: remove useless function getName() 2019-04-04 16:43:04 +01:00
e6a1f0eb8d Command: remove duplicated code 2019-04-03 18:06:22 +01:00
0e3e984db9 Player: Disconnects no longer nuke player internals, (mostly) fixes #1239
there are some problems that haven't been accounted for yet, but this fixes all the direct crashes.
2019-04-03 17:44:34 +01:00
a0b8d9a64e Merge branch '3.7' 2019-04-03 17:39:45 +01:00
2c678dcf0d Player: Fixed memory leak when PlayerLoginEvent is cancelled 2019-04-03 17:37:15 +01:00
f901c2a612 Player: move some functions to a more sensible place
let's keep disconnect-related logic grouped together.
2019-04-02 19:57:10 +01:00
f332550e52 Player: move toggle* rollback handling to network session
this allows network sessions to react to it how they want, or (in the case of things like Specter) perhaps ignore it.
2019-04-02 19:49:53 +01:00
80a6fc5dd1 BlockFactory: remove deprecated functions 2019-04-02 19:15:29 +01:00
b6e453a5f4 LegacyAnvilChunkTrait: remove obsolete TODO 2019-04-02 19:13:41 +01:00
7d22b2a6d7 Player: removed useless addActionBarMessage()
this is exactly the same as sendTip().
2019-04-02 18:43:14 +01:00
e5756dbf0b Move a whole bunch of packet crap to NetworkSession 2019-04-02 18:31:16 +01:00
2c4f2810d2 AsyncTask: Remove misleading methods getFromThreadStore(),saveToThreadStore(),removeFromThreadStore()
These methods are commonly mixed up when we talk about thread-local storage. What these things actually do is store persistent data on the worker thread.
2019-04-02 14:57:11 +01:00
6214a9398d Player: remove sendWhisper()
this can be done with a standard translated message, and with more customizability.
2019-03-31 19:25:09 +01:00
f0b85936cf Improved /tell 2019-03-31 19:08:35 +01:00
c59a2d1b93 More hasFiniteResources() usages 2019-03-31 16:51:43 +01:00
f8ce7797db Player: add hasFiniteResources() 2019-03-31 16:40:54 +01:00
42a263a9df GameMode is now an enum 2019-03-31 16:19:36 +01:00
0017c0087a oopsie woopsie 2019-03-31 16:17:01 +01:00
8c19f6cac8 EnumTrait: throw InvalidArgumentException from fromString()
this is more in line with expected behaviour, since this might be used to process arbitrary user input. Only calling an undefined magic static method should throw an Error.
2019-03-31 16:07:42 +01:00
cdeb3ea5a6 Sync NBT dependency 2019-03-30 19:53:24 +00:00
aff2e0c86c Merge branch '3.7' 2019-03-30 19:19:02 +00:00
7bd9a2b2e0 3.7.2 is next 2019-03-30 19:15:17 +00:00
004e81ea35 XpLevelUpSound: fixed crash on non-multiples of 5 2019-03-30 18:44:30 +00:00
3ea5260935 Sync composer dependencies 2019-03-30 18:28:42 +00:00
5c26deb517 Release 3.7.1 2019-03-29 19:56:06 +00:00
8fcb44de7d Merge branch '3.6' into 3.7 2019-03-29 19:55:36 +00:00
bd2e7db3b9 Release 3.6.6 2019-03-29 19:49:30 +00:00
f4480c07ee Updated NBT dependency 2019-03-29 19:47:15 +00:00
1fd4077907 MainLogger: Always use CRITICAL for logException() 2019-03-29 15:28:11 +00:00
f638845ef6 Merge branch '3.7' 2019-03-29 15:16:27 +00:00
c09e2301c8 Merge branch '3.6' into 3.7 2019-03-29 14:35:35 +00:00
8e9f787d33 Implement runtimeID table randomization, closes #2841 2019-03-29 14:35:06 +00:00
260fa50db4 Register Edu compound items 2019-03-28 14:23:42 +00:00
de193d41a0 Server: fixed console not receiving user broadcast channel messages
I'm not entirely clear how this managed to work to begin with really, but it's now fixed properly.
2019-03-27 23:53:39 +00:00
649ce5080b StatusCommand: don't use config for reading global limit 2019-03-27 19:24:06 +00:00
0e806854b9 Server: clean up startup order a little 2019-03-27 19:16:39 +00:00
3de08bf452 Convert PluginLoadOrder into enum 2019-03-27 18:28:40 +00:00
2091354927 UUID: add type docs 2019-03-27 15:39:41 +00:00
d8c81c0a11 UUID: remove useless default values
these are overwritten by the constructor, so they have no use here.
2019-03-27 15:39:06 +00:00
7b2b43c0ca .................... 2019-03-26 19:56:03 +00:00
0aebb3f4fb Clean up LevelSoundEvent handling 2019-03-26 19:53:40 +00:00
e1504c668e LevelSoundEventPacket: more helpers 2019-03-26 18:23:02 +00:00
10db57655e clean up some direct LevelEvent usages for sounds 2019-03-26 18:06:12 +00:00
37b5ad8350 Remove remaining direct protocol usages for particles 2019-03-26 17:00:00 +00:00
1bf0802275 LevelEventPacket: added create() to reduce boilerplate code 2019-03-26 16:49:00 +00:00
7333e7118e Server: remove useless function 2019-03-26 15:52:34 +00:00
c98801402b Network: silence unhandled packet message on bad raw packet 2019-03-26 15:13:36 +00:00
a9c76c2424 NetworkInterface: remove unused function 2019-03-26 15:09:43 +00:00
161d5bd6b8 Merge branch '3.7' 2019-03-26 15:02:17 +00:00
89833b3b68 Merge branch '3.6' into 3.7 2019-03-26 15:01:59 +00:00
a10a656a5d Network: add a README to mcpe namespace 2019-03-26 15:01:00 +00:00
01e048c4d1 Move networkStart message to where we actually start network
i.e. the point at which a normal user can reasonably expect to be able to connect to the server ...
2019-03-26 14:07:32 +00:00
ca22223b62 PlayerDeathEvent: fixed constructor signature, closes #2835
can we ban multi-type parameters already? this is tiresome...
2019-03-25 14:55:25 +00:00
999174b0a7 Server: Delay RakLib start until after world loading
fixes #2816
2019-03-25 14:49:12 +00:00
0811ce81e5 Query: remove useless noise
why do we need 3 log messages for something that does ... basically nothing?
2019-03-24 19:53:20 +00:00
23071d257e Extract process-related functions from Utils into a separate Process class 2019-03-24 18:57:32 +00:00
1ea5316a37 Whose idea was it to make this public... 2019-03-24 18:38:26 +00:00
97ccc6e880 Network: Don't ignore retval of raw handlers 2019-03-24 18:31:32 +00:00
d0940e4be2 Fixed raw packets in the buffer pre-ban still getting processed post-ban 2019-03-24 18:26:52 +00:00
6990d6239e Network: Added RawPacketHandler interface, query handler is now a component 2019-03-24 18:02:19 +00:00
a753c1342d Clean up Query cache handling, remove useless timeouts
the timeout was entirely useless, because:
- when shorter than 25.6 seconds (512 ticks) it would cause caches to be needlessly destroyed and regenerated
- when longer than 25.6 seconds, just made outdated caches persist for longer, even after the query info was regenerated.

This now uses a mark-dirty model to deal with caches, which means that plugin modifications to the query data will be reflected immediately, regardless of when they are made. Previously, modifying the result of Server->getQueryInformation() would have inconsistent results.
2019-03-24 17:43:02 +00:00
9c76fb7d96 Implemented plugin loading whitelist/blacklist by config file (#2783) 2019-03-24 16:18:13 +00:00
aea775c7c6 TallGrass: fixed seeds never being dropped when support is removed 2019-03-23 19:58:35 +00:00
d9134f28e4 Rename CobblestoneWall -> Wall 2019-03-23 19:50:07 +00:00
2a3e6dcf00 Rename BlockIds -> BlockLegacyIds 2019-03-23 19:46:31 +00:00
79ef8e0803 Replace all legacy blockID references with BlockIds:: 2019-03-23 19:44:33 +00:00
f84d7ad70d sync block TODOs 2019-03-23 19:21:11 +00:00
be0436b2a0 fix consistency check (again) 2019-03-23 19:20:52 +00:00
397713247d SeaPickle: fix drops 2019-03-23 19:19:38 +00:00
6efdac63d0 added new Wood block 2019-03-23 19:18:25 +00:00
06a37cc462 Fixed "wood" collision
why the fuck Mojang...
2019-03-23 19:08:17 +00:00
e088da320c ItemEntity: fixed mineWood achievement not working for acacia/dark-oak 2019-03-23 19:06:35 +00:00
d51ca0b655 Leaves: use instanceof Wood instead of legacy ID checks 2019-03-23 19:02:07 +00:00
a2f42a7016 Updated block/item ID constants from 1.10 2019-03-23 18:54:45 +00:00
1e096a408a Cram Nether Portal
again, this is here for the state handling and the implementation is unfinished.
2019-03-23 18:38:14 +00:00
74e134136d Make Infested Stone blocks known
this is not remotely a complete implementation, it's just here to make PM aware of these states so that world conversion can be handled correctly. A full implementation will come later.

Any blocks added in this fashion should be marked with a //TODO so future maintainers can find which blocks need work.
2019-03-23 18:28:29 +00:00
a8fa8572e1 partial sea pickle implementation 2019-03-23 18:11:27 +00:00
3c283aa700 fix consistency check (again) 2019-03-23 15:45:39 +00:00
905cb7544a hack in different wood sign types 2019-03-23 15:44:28 +00:00
765c5963a8 Block: move a function 2019-03-23 15:01:35 +00:00
53bb05a6a7 Fixed different woodtype boats being missing 2019-03-23 14:51:58 +00:00
034bd716c8 Clean up WritableBook hierarchy 2019-03-23 14:36:03 +00:00
a74a4b579d wtf @sandertv 2019-03-23 12:56:02 +00:00
98f56087de make composer happy 2019-03-23 12:53:00 +00:00
15c6554d8a Updated RakLib dependency 2019-03-23 12:52:50 +00:00
d4fe004375 More consistent fluency in Item API 2019-03-23 12:20:35 +00:00
1045088668 Move more packet handling logic out of Player
there is now only (1) packet handler remaining in Player. The reason I haven't targeted this is because it needs improvements of its own.
2019-03-23 12:12:30 +00:00
1bc37a1a8a Player: Clean up movement processing, now API-ified 2019-03-23 11:33:32 +00:00
9cddfdf8ec Revert "Move core permissions to default_permissions.yml"
This reverts commit 5fac5c7281.
2019-03-23 10:41:50 +00:00
1d1a416afe Player: Move construction logic to the top 2019-03-23 10:39:19 +00:00
f3309d3aec Player: remove some field defaults 2019-03-23 10:29:16 +00:00
9ec62643d5 Player construction now happens when we're ready to create the player entity
this fixes a wide range of bugs with the initial spawn sequence, and allows to simplify a whole lot of player setup logic.
2019-03-23 10:13:14 +00:00
433dab078b DataPacket events now use network sessions instead of players 2019-03-23 09:52:03 +00:00
afbd016611 Server: remove useless function 2019-03-22 19:38:33 +00:00
712e077bc1 Server: remove useless debug message
leveldb is now mandatory, so this message will always be emitted.
2019-03-22 19:31:10 +00:00
9904810f24 BaseInventory: Remove getDefaultSize()
it's possible to want to initialize dynamically-sized inventories which don't have a default size.
2019-03-22 19:21:41 +00:00
60225a378f Player: fixed block-picking logic
this now matches vanilla (with some minor intentional differences) and works in survival.
2019-03-22 18:28:36 +00:00
f84a1729c6 Inventory: added swap() function 2019-03-22 18:11:32 +00:00
8e48c61daf Merge branch '3.7' 2019-03-22 15:07:46 +00:00
2659ed8d91 AvailableCommandsPacket: Updated the argument type constants for 1.10. (#2824) 2019-03-22 15:07:15 +00:00
9b11e39efc use ?? 2019-03-22 15:03:46 +00:00
d03f0aab37 Remove /reload (#2823)
For many years, this has been the cause of many users (particularly plugin devs) confusion. The reality is that /reload has little to no practical value. It does not reload plugin source code (contrary to popular belief).
2019-03-22 15:01:11 +00:00
6ec2a69417 Removed .docker/Dockerfile
1. The current Dockerfile is not directly related to the project, but just our very complex highly-coupled full-of-hacks build/release/deploy system.
2. We are no longer using Docker Hub Builder. An internal Dockerfile will be used on our Jenkins server instead, using the correct upstream phar build to prevent race conditions.
2019-03-22 12:51:50 +08:00
3dbed830ef Fixed entities not loading on imported MCPE worlds 2019-03-21 20:03:10 +00:00
b8d1eb20b0 EntityDeathEvent: add XP amount API, closes #2690 2019-03-21 19:53:14 +00:00
89c0836047 Fixed paintings dropping multiple times, closes #2774 2019-03-21 19:46:43 +00:00
9ad7f74501 Merge branch '3.7' 2019-03-21 19:02:55 +00:00
9c01ecbe7e Merge branch '3.6' into 3.7 2019-03-21 19:02:20 +00:00
6a55021779 Flat: Allow asterisk in preset layers
closes #2818
2019-03-21 18:59:50 +00:00
588ebe446f Fixed Chunk->setFullBlock() not creating new subchunks, closes #2821 2019-03-21 18:47:24 +00:00
8c536c248d Updating for latest PocketMine-NBT changes 2019-03-21 15:58:22 +00:00
1ac255f955 fix some formatting issues 2019-03-21 15:46:07 +00:00
2966e87aae BlockFactory: Regenerate TODO list 2019-03-21 14:33:56 +00:00
2e5ef4ba03 Merge remote-tracking branch 'origin/3.7' 2019-03-20 21:35:13 +00:00
6ada261b04 3.7.1 is next 2019-03-20 19:39:36 +00:00
14a6779e08 Release 3.7.0 2019-03-20 19:17:41 +00:00
cce99b07af 1.10.0 updates 2019-03-20 19:17:41 +00:00
c3d80d711d Fixed autosave time report measurement not using correct unit (as per master) 2019-03-20 19:01:10 +00:00
cc78c9ef18 Merge branch '3.6' 2019-03-18 08:58:59 +00:00
1a8b33dafe AvailableCommandsPacket: Updated the ARG_TYPE constants
closes #2817
2019-03-18 08:58:07 +00:00
8de9e61651 Item: Remove get/set/removeNamedTagEntry() 2019-03-17 17:49:09 +00:00
5830ca958b Further out-phasing of legacy ID/meta
this paves the way for making internal IDs fully dynamic.
2019-03-17 16:01:04 +00:00
6f54b53f7a thanks for being useless PhpStorm
these problems didn't show up in any inspections until I opened the fucking files...
2019-03-17 15:53:59 +00:00
87928038e6 sync deps 2019-03-17 15:19:47 +00:00
7d72b8e756 leveldb: use writebatch for chunk saving (faster I/O)
i don't know why this wasn't already using a writebatch, but it should have been.
2019-03-15 16:45:47 +00:00
9205bbaa42 ... why is this not saved on provider close...? 2019-03-15 04:43:19 -04:00
a91f49220c Chunk: Do not mark as changed on lighting updates
Since we don't save light to disk anymore, we don't need to care if a light update took place. This improves I/O performance.
2019-03-14 16:34:14 +00:00
62185d476b RegionLoader: Fixed performance issue converting huge worlds
I was big nub when i wrote this code.
2019-03-14 15:22:44 +00:00
1e0f1e5b1a RegionLoader: Stop unnecessarily writing location header on close
Any time a region is modified, the location header is written anyway, so this is entirely unnecessary.
2019-03-14 15:06:13 +00:00
d080d3bae0 RegionLoader: Write location table changes when deleting chunks 2019-03-14 15:02:15 +00:00
41d13b6f06 Player: remove dead condition
this can't be reached because the only place it's called is from Level->actuallyDoTick(), where it won't appear until long after the player is logged in.
2019-03-14 14:47:20 +00:00
a1ffaffa7f Don't record player on stats until they actually exist 2019-03-14 14:46:19 +00:00
ebfe9caca3 Move too-early-send check to NetworkSession 2019-03-14 14:45:30 +00:00
26a5d97499 Some cleanup to player net session handling for connect/disconnect 2019-03-14 14:32:43 +00:00
fa7a4dc22e Fixed warning of bad default format on new installs 2019-03-13 21:43:07 +00:00
34758e3bc6 RegionLevelProvider: clean up coordinate extraction, fixed a stupid bug 2019-03-13 17:35:09 +00:00
08c399529d RegionLevelProvider: Unload regions when finished scanning them, fixes running out of file descriptors during conversion 2019-03-13 17:32:34 +00:00
ad19696364 Make Effect and Enchantment functions less verbose 2019-03-13 15:26:21 +00:00
01904adf49 Improve enum implementations, move some components to traits
The reason this uses a trait is because `self` refers to the including class in a trait, which offers a small amount of automatic type safety.
If we had templates or generics, this would be a generic class instead.
2019-03-13 15:10:31 +00:00
7f4b76aa86 Implemented blue ice 2019-03-12 19:38:03 +00:00
0e1a88f7e5 Armor: Implement right-click to equip, closes #2641 2019-03-12 19:01:36 +00:00
8b9eeb0b7f Clean up Armor classes 2019-03-12 18:53:51 +00:00
2e4b3d3d46 Sync legacyID map (thanks @MCMrARM) 2019-03-11 17:38:02 +00:00
1d4f44d259 Updated BlockFactory consistency check data 2019-03-10 19:53:55 +00:00
13bea6c787 Updated Travis configuration 2019-03-10 19:53:55 +00:00
48427290c9 Regenerated BlockFactory TODOs 2019-03-10 19:53:55 +00:00
437750785f Implemented barrier block 2019-03-10 19:53:55 +00:00
c2a069afd3 Implemented a bunch of new wood blocks 2019-03-10 19:53:24 +00:00
84bbd14a21 fixed wrong generator being set on converted worlds 2019-03-10 19:53:24 +00:00
85e1b77cae fix crash in getHighestBlockAt() 2019-03-10 19:53:24 +00:00
18e16f8615 Fixed blockID truncation 2019-03-10 19:53:24 +00:00
7aa4c18afa Fixed assert failure in SubChunk 2019-03-10 19:53:24 +00:00
a858103e6b Support paletted subchunks, drop all formats except leveldb 2019-03-10 19:53:24 +00:00
dfc26395e2 Fixed missing logger injection 2019-03-10 19:53:23 +00:00
8cb24547ff Goodbye McRegion o/ 2019-03-10 19:53:23 +00:00
8d83d59cf0 Work around collisions in backup names 2019-03-10 19:53:23 +00:00
a0a8026cba Implemented automatic world format conversion 2019-03-10 19:53:23 +00:00
ae9f57ac28 Revert "Remove hacks for triggering adjacent light refill"
This reverts commit 1dca9074d5.
This change introduced performance issues with transparent blocks.
2019-03-10 19:50:35 +00:00
c266f86b1b ItemEntity: introduce controls for despawn timers (#2769)
This opts _not_ to expose item "age" a la #2753 because "age" is a misleading term for it. In addition, further inspection of the problem led me to realize that exposing control of that AND despawn timeout was more complicated than simply having a despawn delay timer exactly like the pickup delay one. Everyone knows a countdown timer stops at 0, so this way we don't need any method to control the limit.

Closes #2667
Closes #2753
2019-03-10 12:05:21 +00:00
c05bc6a53e Merge branch '3.6' 2019-03-10 12:03:39 +00:00
baa094a2d1 3.6.6 is next 2019-03-10 11:49:31 +00:00
f2ff510597 Release 3.6.5 2019-03-10 11:49:06 +00:00
4c10476b15 Empty merge 2019-03-10 11:43:31 +00:00
562179bdd6 Backport 58cafc853f: s/level/world (strings only)
we should look at doing this for code too, but for now I'm not planning to break everyone's plugins.
2019-03-10 11:35:46 +00:00
5c12bee874 Backport other part of 2bffd5cc1c: Add timer measurements for autosave 2019-03-10 11:20:51 +00:00
99606bbe23 beware possible API break 2019-03-09 19:33:46 +00:00
a1d50de12e OOF 2019-03-09 19:31:13 +00:00
4252c5914b Backport 93cd00ae8f: Remove dead settings from pocketmine.yml 2019-03-09 19:21:39 +00:00
0659d2fbef Backport 6bd43a8215: Firehose auto-tick-rate anti-feature, closes #2665 2019-03-09 19:20:53 +00:00
10612acace Partial backport of 2bffd5cc1c to 3.6 2019-03-09 19:10:09 +00:00
1d810f8aeb Backport c3e66e0adc to 3.6 2019-03-09 19:09:05 +00:00
3079fd0251 Fixed test failures introduced by 6fe366e1ac 2019-03-09 19:05:32 +00:00
b9208eb1fb Merge branch '3.6' 2019-03-09 19:04:37 +00:00
414104851a LevelDB: Mark chunks as changed when upgraded from an older chunk format 2019-03-09 19:02:34 +00:00
2ae09f635b Add more output to consistency check script
this helps catching state mapping bugs.
2019-03-09 17:19:17 +00:00
6fe366e1ac Added some missing block properties 2019-03-09 16:49:37 +00:00
8f1bc5d497 Flatten wall_banner and wall_sign into single blocks (#2798)
This comes with some problems, but the problems are more bearable than the previous code.
2019-03-08 16:37:26 +00:00
bb718faa2e Merge branch '3.6' 2019-03-08 13:57:32 +00:00
c68ee1d9d9 LevelDB: Mark chunks as changed when upgraded from an older chunk format 2019-03-08 13:55:56 +00:00
c0bed03a2a Update PlayerRespawnEvent.php (#2797)
removed obsolete comment
2019-03-05 16:28:58 +00:00
2b6a62be77 Fixed BlockFactory corruption with signs and banners 2019-03-05 15:32:06 +00:00
3f66600271 RegionLoader: Extract location table validation to separate function 2019-03-05 13:28:56 +00:00
f2404804d7 RegionLoader: clean up lastSector handling 2019-03-05 13:18:14 +00:00
07a9c35ee2 RegionLoader: Use objects instead of arrays 2019-03-05 13:10:17 +00:00
4d9b074641 Merge branch '3.6' 2019-03-05 12:10:16 +00:00
d25c84acff Fixed RegionLoader corrupting location table when too-large chunks are discovered
this was making the location table point to an offset that did not yet exist, which caused the region header consistency check to discard the region as corrupted the next time it was loaded.
2019-03-05 12:09:27 +00:00
e31603fc45 Merge branch '3.6' 2019-03-05 11:21:55 +00:00
55994e08db RegionLoader: make some error messages more detailed 2019-03-05 11:18:02 +00:00
6f5d4d6b80 RegionLoader: fixed handling of invalid chunk coordinates 2019-03-05 10:52:36 +00:00
df1ef7fe0c Improve RegionLoader tests 2019-03-05 10:51:44 +00:00
2795ad674b add boilerplate code to check for generator validity
perhaps we should use an enum for this...?
2019-03-05 09:36:22 +00:00
2cad7166b1 GeneratorManager::getGeneratorName() now throws InvalidArgumentException on unregistered generator classes
the old behaviour allowed a bug in the world converter to go unnoticed.
2019-03-05 09:30:22 +00:00
3789f4d643 Merge branch 'master' of https://github.com/pmmp/pocketmine-mp 2019-03-04 12:03:45 +00:00
f87dac7bb2 Merge branch '3.6' 2019-03-04 12:02:36 +00:00
20a25a69df Force emission of output buffer contents on crash 2019-03-04 12:01:30 +00:00
5017e61cb2 ItemFrame: fixed cloning null 2019-03-03 21:12:52 +00:00
f83e5c195c fixed tiles and entities not getting saved on fast-deserialized chunks 2019-03-03 18:26:05 +00:00
54ef965b2a Added warnings when unknown entities and tiles are removed 2019-03-03 18:02:34 +00:00
f5dbbea5f5 Utils: added recursiveUnlink() 2019-03-03 17:39:23 +00:00
3509b26751 LevelProvider: added calculateChunkCount()
this will be used to provide progress information to the user during world conversion.
2019-03-03 17:32:57 +00:00
1bb9b3d3ab Discard light information from disk storage
this makes world conversion faster and offers the opportunity to correct age-old lighting bugs.
2019-03-03 16:22:44 +00:00
6e00ab2069 Chunk: add getNBTentities() and getNBTtiles()
this shit is horrible, but it's needed for now...
2019-03-03 14:00:46 +00:00
93cd00ae8f Remove dead settings from pocketmine.yml 2019-03-03 13:28:18 +00:00
c3e66e0adc LevelManager: add debug message when a level takes too long to tick 2019-03-03 13:26:16 +00:00
6bd43a8215 Firehose auto-tick-rate anti-feature, closes #2665 2019-03-03 13:24:53 +00:00
d9880de2ef LevelManager: improve debug message for autosave 2019-03-03 12:43:02 +00:00
743d91a670 Merge branch '3.6' 2019-03-03 12:38:19 +00:00
faca610594 NetworkBinaryStream: remove dead field 2019-03-03 12:38:03 +00:00
fc9a61859a Item: remove misleading methods & premature optimization 2019-03-03 12:36:46 +00:00
abbdd7efdd Item: make __toString() use base64 for displaying NBT 2019-03-03 12:33:28 +00:00
1c79d43d88 Merge branch '3.6' 2019-03-03 11:59:53 +00:00
91603dc2d6 3.6.5 is next 2019-03-03 11:50:10 +00:00
af90e18b18 Release 3.6.4 2019-03-03 11:49:07 +00:00
0573838be3 rename submodules 2019-03-03 11:47:00 +00:00
158f81b427 Merge branch '3.6' 2019-03-03 11:15:40 +00:00
ab5b4d112b BaseInventory: fixed items with userdata stacking with items without userdata 2019-03-03 11:12:36 +00:00
a30b1fb6d5 Inventory: Add failing test case for itemstack NBT duplication 2019-03-03 11:11:33 +00:00
2bffd5cc1c Add timer measurements for autosave 2019-03-02 18:20:25 +00:00
382488dd07 sync locale submodule 2019-03-02 17:20:37 +00:00
808259dccd Introduce CancellableClosureTask
before anyone picks a fight about the naming, take it up with shoghi... let's be consistently wrong at least
2019-03-02 10:45:01 +00:00
6c8fa8ae28 More nullable and void typehints 2019-03-02 10:29:11 +00:00
1f5c901f29 ext-ds is now required 2019-03-01 20:03:16 +00:00
418d0f12fb Slab: placement logic clean up
past me was full of shit, because blockReplace is the same as blockClicked when we click a single slab top/bottom to make a double slab, and the logic is identical to the below block with that in mind.
2019-03-01 19:15:24 +00:00
d961b272c7 Remove Tool <-> Block circular dependency in efficiency calculation 2019-03-01 18:18:56 +00:00
72233a509d preprocessor fix 2019-03-01 18:08:03 +00:00
e9125af51d Revamp Banner API (still rather ghetto)
this needs more work, like signs do.
2019-03-01 17:57:07 +00:00
80ac0180b3 Remove redundant isAffectedBySilkTouch() overrides
this was needed previously to prevent dropping blockitems when these blocks were destroyed. Now the item form is always yielded instead.
2019-03-01 13:34:32 +00:00
12dfcc9eb6 Banner: Sort lines lexicographically ascending 2019-03-01 11:06:42 +00:00
1e9e179ec0 Fixed Block consistency check failure since 943906cc6b 2019-03-01 08:24:25 +00:00
741d061415 NoteBlock: added //TODO 2019-02-28 19:59:33 +00:00
943906cc6b Partial comparator implementation
this supports placement, toggling compare/subtract mode, simple stuff. No redstone functionality yet.
This is needed for blockstate mapping in blockfactory.
2019-02-28 19:26:47 +00:00
7b23baa020 FlowerPot: yield contained plant when block-picking 2019-02-28 17:49:48 +00:00
97a1d997e8 ItemFrame: yield framed item when block-picking, fixes [1] in #2706 2019-02-28 17:47:32 +00:00
d679fb7546 Block: Rename onActivate() -> onInteract() 2019-02-28 17:35:30 +00:00
c9eb642afd PacketPool: missing @throws 2019-02-28 17:15:06 +00:00
08e799c35a Once again... add a missing file... 2019-02-28 17:14:04 +00:00
5cca4b5e31 Revamp Sign API, flatten API into blocks 2019-02-28 17:10:37 +00:00
f680a239f7 NetworkSession: some exception handling cleanup 2019-02-28 16:36:03 +00:00
13b9fd7b66 RakLibInterface: Add error ID to make logs searchable when players report legitimate issues 2019-02-28 16:31:14 +00:00
d528fdddfa DataPacket: Remove useless abstract function
this is declared in the Packet interface, so it doesn't need to be here anymore.
2019-02-28 16:20:58 +00:00
fb02071a9d Traits suck. Fixed missed getDamage() from 9ad0ea85c7 2019-02-27 16:50:51 +00:00
08673172c7 Grass: Avoid usage of meta 2019-02-27 13:03:23 +00:00
9ad0ea85c7 Rename two misleadingly-named functions 2019-02-27 12:59:12 +00:00
ba616ed8a7 Player: Don't rely on magic numbers for gamemodes 2019-02-27 11:01:26 +00:00
31336a0d09 missed one 2019-02-27 10:37:13 +00:00
2d8480d801 Inventory: remove a bunch of crap from interface
some of these (notably the on* methods) are internal and shouldn't be exposed via interface (same crap as Plugin->onEnable() onDisable() etc) and the rest of the stuff is entirely unused.
2019-02-27 10:36:05 +00:00
9b3230aa9c Merge branch '3.6' 2019-02-27 10:19:58 +00:00
20b4723728 Player: fixed held slot being out of sync after dying, closes #2788
it appears this premature optimization dates back to the days when PlayerHotbarPacket was not useless.
2019-02-27 09:26:56 +00:00
d1ced0ffc6 Player: fixed XP not dropping on death 2019-02-27 09:22:52 +00:00
440dd21550 Merge branch '3.6' 2019-02-26 19:59:24 +00:00
2164dbae67 Fixed reloaded arrows not despawning, closes #2781 2019-02-26 19:58:21 +00:00
6c92a2e88b Ladder: be more strict about resetting fall distance
closes #2790
2019-02-26 19:54:57 +00:00
97deadc59f PackedIce: fixed dropping without silk touch, closes #2789 2019-02-26 19:48:18 +00:00
ceaf969203 EnderChest: fix hierarchy 2019-02-26 19:41:56 +00:00
cb91afcc00 Added SkullType enum, some cleanup to skull handling
this is still more ugly than I'd like it to be because of the way the blockfactory currently works.
2019-02-26 18:27:30 +00:00
edf4a719d5 DyeColor: add RGB colour values 2019-02-26 17:16:35 +00:00
202aef9846 fix failing tests 2019-02-26 16:35:33 +00:00
d7e73705c2 consistency check regen script now emits which states were added/removed 2019-02-26 16:35:14 +00:00
9afcd72fb6 Flatten FlowerPot tile into its block (mostly) 2019-02-26 16:31:38 +00:00
53af7f5da8 Implemented dragon egg 2019-02-26 15:35:37 +00:00
2d51622b12 Implemented frosted ice 2019-02-26 15:34:48 +00:00
6124f93cb4 Player: Clean up item frame drop-item hack
This is now re-routed through a newly-created attack-block handler.
Closes #339
2019-02-25 18:40:04 +00:00
fb378d9091 BlockFactory: fixed auto complete 2019-02-24 18:41:12 +00:00
0f7f5362b8 Revert "Block: Get rid of state bitmasks"
This reverts commit b7b05e729e.

Apparently this was premature, because we still need these things to deal with default state remapping.
2019-02-24 18:30:18 +00:00
6cb263fcca BlockFactory: enforce stricter checks
this can help catch out variant-related bugs.
2019-02-24 17:59:09 +00:00
b7b05e729e Block: Get rid of state bitmasks
This story dates back to the days when getVariantBitmask() was introduced. The purpose of this function was to allow the variant info to be extracted from the metadata, for use with item drops. This was later changed to state bitmask for reasons I don't clearly recall.
In the great 4.0 refactor, we now store variant magic numbers separately, so we don't need any generic bitmask to split up variant and state information anymore. Variant is now only ever serialized and never deserialized. The same thing goes for blockIDs. States are read from the world by matching the full stateID against a table of prefilled known blocks, so the variant doesn't need to be deserialized - only the state does, and the state metadata readers already do bit fuckery by themselves and don't need this mask - notice how little actual changes were required to get rid of this?
2019-02-24 14:42:53 +00:00
023fecabac Added an annoying consistency check for BlockFactory
This test is intended to enforce that the BlockFactory always has the same blocks in it from one commit to the next. Since there are a lot of changes going on right now around this, it's important that this is checked because bugs can go under the radar when large changes are happening.

The consistency check will need to be regenerated whenever a new block is registered, new states are found or when things are removed.
2019-02-24 13:56:55 +00:00
6edd4fd9c7 BlockFactory: added getAllKnownStates() 2019-02-24 13:40:59 +00:00
73305a7425 oops, formatting issue 2019-02-24 13:22:11 +00:00
899081e1b9 Level: fixed randomTickBlocks, also delete some useless code
the randomTickBlocks thing is populated with state IDs anyway, not variants...
2019-02-24 13:10:45 +00:00
369a1e1472 Tripwire: fixed block picking 2019-02-24 12:41:44 +00:00
832ad0501a Tripwire: added missing flag
it's unclear what the purpose of this flag is. It appears to always be set on placement and is never changed at any other time. The result is that the hitbox becomes larger when it is set.
2019-02-24 12:19:15 +00:00
a3907377f5 Merge branch '3.6' 2019-02-24 12:14:40 +00:00
0c3b136a8d Player: fixed removeWindow() sometimes removing GUI / crashing clients 2019-02-24 12:14:19 +00:00
97687f2236 Dye, banner and bed items now store DyeColor objects instead of using magic meta values 2019-02-24 10:48:40 +00:00
0bd1c1529e Block: Rename getItem() to asItem()
this has clearer meaning and is less likely to collide with other things.
2019-02-24 10:23:40 +00:00
ff35736bf9 ItemFrame: added ROTATIONS constant 2019-02-23 18:27:47 +00:00
998dcb421e Flatten Item Frame implementation into its block (mostly)
This exposes nice API on the ItemFrame class, while keeping the tile bullshit out of sight so that we can remove it later on.
2019-02-23 18:19:31 +00:00
878c704597 Remove another dead function 2019-02-23 17:15:50 +00:00
49f9605620 Level: Allow tiles to be sent with regular block updates 2019-02-23 17:01:59 +00:00
eadb1d310e Level->sendBlocks() now syncs tiles 2019-02-23 16:53:29 +00:00
e1ef52c7c3 TileFactory: remove dead function 2019-02-23 15:57:53 +00:00
991483938c SubChunk: remove legacy crap 2019-02-23 13:18:37 +00:00
66a1b35767 Merge branch '3.6' 2019-02-23 11:05:23 +00:00
79b7e08e60 Silence NetworkStackLatencyPacket spam from dev builds 2019-02-23 11:03:50 +00:00
0daf695825 Merge branch '3.6' 2019-02-23 10:51:28 +00:00
2540dacdd7 PluginManager: fixed suffix split handling 2019-02-23 10:51:06 +00:00
f669677d17 BlockTest: fixed failing test
this is a bad fix, but it doesn't matter a whole lot. The problem stems from furnace not having a valid 0 variant, so things go haywire when the default mapped 0 variant is registered to LIT_FURNACE because the default state is of course unlit.
2019-02-22 18:56:14 +00:00
707faef0f7 BlockTest: remove redundant name test
name is mandatory in the constructor now, so this isn't necessary anymore.
2019-02-22 18:54:21 +00:00
0f2f05fbb9 Merge branch '3.6' 2019-02-22 18:14:17 +00:00
f1078e3909 3.6.4 is next 2019-02-22 18:07:48 +00:00
2f43b054de Release 3.6.3 2019-02-22 18:07:00 +00:00
23b5d64535 Merge branch '3.5' into 3.6 2019-02-22 18:03:51 +00:00
9afa0e5483 Release 3.5.13 2019-02-22 17:56:44 +00:00
4eaea54b0e TaskScheduler: fixed wrong typehints
These methods never return null.
2019-02-22 17:47:28 +00:00
9c085799e6 Removed leftover import from 3d1502c9ad 2019-02-22 12:56:14 +00:00
c26544475e More PHP 7.1 nullables 2019-02-22 12:55:34 +00:00
73a565355b Make some forced-optional nullable parameters non-optional, PHP 7.1 style
these parameters did not make any sense to be optional, but were forced to be this way because of the way nullable types worked before 7.1.
2019-02-22 12:54:00 +00:00
a5c260352d Infect remaining places with PHP 7.1 nullable typehints 2019-02-22 12:16:45 +00:00
461233db09 ItemFactory: Sort items lexicographically ascending 2019-02-22 11:52:22 +00:00
3037f45a0c Implement new dye types, split bonemeal and cocoa beans into their own classes 2019-02-22 11:43:48 +00:00
2bfcd25848 Fixed typo in Repeater name 2019-02-21 18:41:04 -05:00
fd4a441f3a Level: add unregisterChunkListenerFromAll()
it's not expected for chunk listeners to have to track all the chunks they are listening to under normal circumstances.
2019-02-21 14:51:16 +00:00
f9da0f3ece Sapling: remove dead TODO 2019-02-21 13:09:05 +00:00
eabd8ce026 Fixup pressure plate hierarchy 2019-02-21 13:06:08 +00:00
28d01025b0 Improve consistency of handling coloured and wooden blocks
this is ugly, but less ugly than the earlier version.
2019-02-21 12:13:21 +00:00
0120585aee Block: name is no longer nullable 2019-02-21 11:37:21 +00:00
e063c567be Merge remote-tracking branch 'origin/master' into block-id-object 2019-02-21 10:41:25 +00:00
6ab171d629 Fixed unit tests 2019-02-21 10:41:06 +00:00
635fb5dde4 Clean up ID flattening hacks 2019-02-21 10:38:29 +00:00
3d1502c9ad Apparently yaml_parse_file() doesn't respect access protocol 2019-02-20 17:11:26 -05:00
89fce7712a Block: Clean up internal constructor inconsistencies
I don't dare look how big this commit is or how many bugs it introduced...
2019-02-20 19:21:51 +00:00
e93464f318 SnowLayer: fixed 8x layers being replaceable
this also fixes some placement bugs.
2019-02-20 16:29:34 +00:00
5fac5c7281 Move core permissions to default_permissions.yml
this is one of the few things that is actually better suited to a YAML file than code
closes #2594
2019-02-20 16:22:45 +00:00
7aa263d320 PermissionParser: add emitPermissions() 2019-02-20 16:21:25 +00:00
efc2d72d5f Move permission parsing to dedicated PermissionParser class 2019-02-20 16:20:48 +00:00
58cafc853f s/level/world (strings only)
we should look at doing this for code too, but for now I'm not planning to break everyone's plugins.
2019-02-20 15:33:46 +00:00
9354929cad added a whole bunch of tests for enchantment handling 2019-02-20 14:43:57 +00:00
7170d9009d Enchantment: more static getters, firehose magic numbers
This is similar in nature to 646fea5a4e.

On a side note: Migrating this way is a pain in the ass due to lack of types. What the heck is int supposed to mean?!?!?!?! At least if we wanted to go _back_ to magic numbers, it would be easy to locate everything with an Enchantment typehint...
2019-02-20 13:45:50 +00:00
646fea5a4e Effect: Introduce a bunch of static getters, change a bunch of API to use objects
This introduces static getters for every currently-known effect type. At some point in the near future, the magic number constants (which are really network IDs, by the way) will disappear.

Migrating:
- If you used constants (like any sensible person would): for the most part it's just a case of adding a () anywhere you used an Effect constant.
- If you hardcoded magic numbers: ... well, have fun fixing your code, and I reserve the right to say "I told you so" :)

This achieves multiple goals:
1) creating an EffectInstance for application is much less verbose (see diff for examples, especially the Potion class)
2) plugin devs cannot use magic numbers to apply effects anymore and are forced to use type-safe objects. :)

This is a warning shot for plugin devs who use magic numbers. More changes like this are coming in the not-too-distant future.
2019-02-20 12:05:17 +00:00
15d4201c3a Fixed tests broken by 88c4b836f0 2019-02-20 11:16:08 +00:00
2c8a065b94 Standardise SNAKE_CASE for surrogate enums 2019-02-20 11:14:07 +00:00
36e9db4c07 Generate methods for surrogate enums, nip stupidity in the bud
this also allows changing the internal implementation later without breaking plugins.
2019-02-20 11:09:22 +00:00
88c4b836f0 Make factory register methods less verbose 2019-02-20 10:24:44 +00:00
f351a86653 Flatten double slabs into Slab pseudo-variant 2019-02-19 11:14:06 +00:00
18f765338c Slab: fixed replacing $blockReplace not creating double slab when not clicking on the replaced block itself 2019-02-19 11:09:11 +00:00
bf71ddb0b5 Snow layers now fall as expected 2019-02-19 10:01:57 +00:00
a4c3ee20b2 Extract Fallable into trait + interface
Traits are inferior to components in pretty much every aspect imaginable :(
2019-02-19 09:58:10 +00:00
6174f1e0ae Pumpkin: fix BC issue, fix lit pumpkin rotation 2019-02-18 20:02:23 +00:00
6f4cec6465 add some blocks introduced in 1.9 2019-02-18 20:01:50 +00:00
a95ecb3ff9 FenceGate: implement in-wall checks 2019-02-18 19:00:58 +00:00
6f7c63e2a8 ItemFrame: add has-map bit
this makes the frame appear to cover the full block instead of the usual size.
2019-02-18 17:41:15 +00:00
8f26c3a2d4 Fix bonemeal count not reduced by CocoaBlock (#2773) 2019-02-18 16:31:07 +00:00
12dd6adfcc Block: Derive light filter level based on isTransparent() return
this might be dynamic.
2019-02-18 13:27:22 +00:00
6cdd716c34 Merge branch '3.6' 2019-02-18 13:12:29 +00:00
6b51bf4a80 Merge branch '3.5' into 3.6 2019-02-18 13:11:16 +00:00
cba8d86c4f Fixed Fire Aspect not working on TNT 2019-02-18 13:11:08 +00:00
b8adfd6948 edu: implement coloured and underwater torches 2019-02-18 11:37:57 +00:00
cd733c658b Implement hard glass & hard glass pane 2019-02-18 10:50:29 +00:00
ab58d46a7f Merge branch '3.6' 2019-02-17 16:12:21 -05:00
2e834c8f5c Merge branch '3.5' into 3.6 2019-02-17 16:10:47 -05:00
f9873e9108 ItemFrame: fixed hardness 2019-02-17 16:10:21 -05:00
00b92eaa40 BlockFactory: Sort entries lexicographically ascending 2019-02-17 19:44:48 +00:00
1bc6483608 Fixed Dockerfile permission issues 2019-02-17 18:10:40 +00:00
9b372f8435 Merge branch 'master' of https://github.com/pmmp/pocketmine-mp 2019-02-17 17:09:13 +00:00
3bbc0b5d5f Merge branch '3.6' 2019-02-17 17:08:44 +00:00
074baf7e1c Merge branch '3.5' into 3.6 2019-02-17 17:08:15 +00:00
2e0dd574e0 Set default health attribute value when changing max health, closes #2771 2019-02-17 17:06:32 +00:00
9137eb0757 Added Dockerfile 2019-02-18 00:52:52 +08:00
c2735286ab Merge branch '3.6' 2019-02-17 11:35:07 +00:00
e16d8e31af Merge branch '3.5' into 3.6 2019-02-17 11:33:46 +00:00
3c93a57397 Entity: add a hack to prevent client-side movement when entity is not moving
this fixes #2227.
2019-02-17 11:33:34 +00:00
7ea1f4fc91 Sign: fixed merge leftovers from 6424dc9c82 2019-02-17 11:10:17 +00:00
84cf7c11e6 Fixed some overlooked returns from dce08b4e88 2019-02-17 06:01:08 -05:00
22a21ecfd6 BlockTransaction: Take world in constructor 2019-02-16 19:57:55 +00:00
0794c94b4b Rename BlockWriteBatch -> BlockTransaction 2019-02-16 19:53:15 +00:00
b252be1c7a Added ItemFactory::air() sugar
This makes it easier to create air stacks without accidents, and also reduces the amount of throwaway air objects which get created.
2019-02-16 12:19:54 +00:00
0ac7164b16 Inventory: remove dropContents(), remove circular dependency 2019-02-16 12:19:46 +00:00
f49d590794 Level: remove getTiles(), more removal of tiles from user interface 2019-02-15 16:27:00 +00:00
65ce1a7581 Block: fixed correct-type tiles getting overwritten
this manifested by crashing the server whenever someone used a furnace.
2019-02-15 13:37:57 +00:00
01255c5368 Updated RakLib to get ITC efficiency enhancements 2019-02-15 12:29:16 +00:00
19f0d7f336 NetworkSession: Don't apply handlers to a disconnected session
closes #2756
2019-02-15 10:11:31 +00:00
dce08b4e88 Introduce Item use results - can be success, fail or none
closes #2693, closes #2705, closes #2734
2019-02-14 19:21:29 +00:00
d9bbe99b83 Merge branch '3.6' 2019-02-14 17:25:21 +00:00
e2e927b328 3.6.3 is next 2019-02-14 17:17:18 +00:00
a8dab25201 Release 3.6.2 2019-02-14 17:15:19 +00:00
3de2b7969e Merge branch '3.5' into 3.6 2019-02-14 17:14:59 +00:00
8f486ea65d 3.5.13 is next 2019-02-14 17:14:34 +00:00
6b971b1761 Release 3.5.12 2019-02-14 16:55:44 +00:00
6f36fa504b TextFormat: make clean() less confusing, deduplicate some regex 2019-02-14 16:52:39 +00:00
d8a25020f1 Merge branch '3.6' 2019-02-14 16:17:39 +00:00
8e73842a93 Player: work around 1.9 command casing crash bug, closes #2761 2019-02-14 16:17:17 +00:00
6424dc9c82 Merge branch '3.6' 2019-02-14 16:04:32 +00:00
e71e18fc88 Merge branch '3.5' into 3.6 2019-02-14 16:02:30 +00:00
e1bacb5c6d Human: fixed hunger underflow when value is a fraction, closes #2761 2019-02-14 16:01:25 +00:00
44697e784a Sign: add validity checks on text encoding, scrub invalid UTF-8 on load
this works around a bug where corrupted text on preexisting signs can mess up the client. This also prevents corrupted text getting onto signs in the future by having them scrubbed and validated before applying them.
2019-02-14 15:16:51 +00:00
65529ff2ce Command: add @throws CommandException 2019-02-14 15:09:41 +00:00
c346c45d42 Use regex for command argument parsing, fixes #2266
moral of the story: don't abuse functions for things they weren't designed for... lol
2019-02-14 15:07:58 +00:00
c433fad0a7 another /u modifier 2019-02-14 13:50:56 +00:00
205e13d880 Config: add getPath() (#2758)
Config->getPath() returns the path of the config i.e. the place where the config file is located.
2019-02-14 10:58:19 +00:00
8fad5a6e30 TextFormat: use mb_scrub() in clean()
this redacts invalid characters to prevent them appearing in places that might break the client.
2019-02-13 20:01:36 +00:00
7a6f279825 TextFormat: fixed clean() not being unicode-aware 2019-02-13 17:06:44 +00:00
470879c9bf Merge branch '3.6' 2019-02-13 14:53:20 +00:00
10b72c895d Merge branch '3.5' into 3.6 2019-02-13 14:53:00 +00:00
d520928888 Fixed startup time measurement, closes #2713, closes #2750 2019-02-13 14:50:52 +00:00
27767e7ddb Verify player name command input, closes #2729, closes #2749 2019-02-13 14:50:43 +00:00
243c12de7c EffectCommand: fix bounds check, closes #2055 2019-02-13 14:37:40 +00:00
7b6d76871c Block: add face and clickVector to onActivate() parameters, closes #267
this is an old old old issue, i don't know why it wasn't addressed sooner.
2019-02-13 14:29:59 +00:00
55be0716d8 Use DyeColor instead of ints for banners 2019-02-13 13:49:44 +00:00
01e7ebeb5c Automate creation and deletion of Tiles for appropriate blocks
closes #880
2019-02-13 12:27:13 +00:00
260c5dcf00 Clean up tile destruction 2019-02-13 12:02:04 +00:00
1496eefb8b Regenerated TODOs for item and b,locks
this sucks because it doesn't tell us anything about things that are meta values of other things (like dyes), but it's enough to start with.
2019-02-12 19:15:19 +00:00
59b62eaeba Merge branch '3.6' 2019-02-12 16:59:06 +00:00
372545e47e Merge branch '3.5' into 3.6 2019-02-12 16:56:53 +00:00
8913b48700 "Implement" info-update and reserved6 2019-02-12 16:56:12 +00:00
6ee4a0e090 Implement invisible bedrock to fix placement issues
I don't know why this wasn't done a long time ago, but here it is.
2019-02-12 16:41:23 +00:00
d30316101a Of course, there was a bug in the script... 2019-02-12 16:30:31 +00:00
5227679602 sync item/block magic numbers with 1.9.0.15 2019-02-12 16:01:25 +00:00
7b3993730a Block: Replace Color and WoodType magic numbers with type-safe objects
this provides automatic type safety without the need for magic number value checking everywhere.
2019-02-12 13:52:59 +00:00
18440f612f Merge branch '3.6' 2019-02-10 17:40:09 +00:00
8bd8da4bc6 Merge branch '3.5' into 3.6 2019-02-10 17:15:48 +00:00
9ba4144a71 Server: remove useless gc_collect_cycles()
the server is shutting down at this point so who cares if there are cycles...
2019-02-10 17:15:41 +00:00
b6bcb47deb Network->unregisterInterface() is now less useless
Interfaces are now automatically shut down when unregistered.
2019-02-10 17:07:58 +00:00
9ebd559907 Merge branch '3.6' 2019-02-10 13:59:44 +00:00
9da7c6af27 new metadata properties 2019-02-10 13:59:21 +00:00
0c89159cf2 Merge branch '3.6' 2019-02-09 19:22:00 +00:00
109312284c 3.6.2 is next 2019-02-08 16:41:10 +00:00
51934614bc Release 3.6.1 2019-02-08 16:40:38 +00:00
9e89f65094 Fixed handling for some new blocks which slipped through the frontline 2019-02-08 16:38:17 +00:00
9562711b84 Updated BedrockData submodule to 1.9.0 2019-02-08 15:32:57 +00:00
30b49e0d22 Merge branch '3.5' into 3.6 2019-02-08 15:32:20 +00:00
a975868fc3 3.5.12 is next 2019-02-08 13:52:31 +00:00
b38b932845 Release 3.5.11 2019-02-08 13:52:09 +00:00
43cb19ebca Updated bedrockData submodule to 1.8.0 2019-02-08 13:51:41 +00:00
769cc91543 ItemFactory: fix crash when getting negative item IDs
these are now treated the same as any unknown item, and are now not possible to place.
2019-02-08 13:51:41 +00:00
278f37d3e0 3.6.1 is next 2019-02-07 22:07:31 +00:00
02a6ca84a9 Releass 3.6.0 2019-02-07 22:06:33 +00:00
b8703d5dff Protocol changes for 1.9.0 2019-02-07 21:56:42 +00:00
37c2d78731 3.5.11 is next 2019-02-07 20:47:05 +00:00
b7663e5815 Release 3.5.10 2019-02-07 20:46:27 +00:00
1a8a04eab8 Merge branch '3.5' 2019-02-07 17:12:49 +00:00
1d0ffa06f8 TallGrass: fixed placement on dirt, closes #2552 2019-02-07 16:55:25 +00:00
768cfe3953 Updated composer dependencies 2019-02-07 16:47:16 +00:00
2822465f33 Updated submodules 2019-02-07 16:20:45 +00:00
b7973ef782 Merge branch '3.5' 2019-02-05 16:58:34 +00:00
5da48f429f Fixed some remaining one-line field declarations, added type docs 2019-02-05 14:03:27 +00:00
dbd0d04549 fix wrong doc comments in Thread & Worker 2019-02-05 13:58:18 +00:00
d23e32622e Clean up internal inconsistency in Color 2019-02-05 13:52:34 +00:00
c6a5829a92 Entity: remove dead function 2019-02-04 19:54:18 +00:00
c872b120d0 Entity->entityBaseTick() is now protected 2019-02-04 19:54:06 +00:00
acd0a8f2d4 fix possible crash in Projectile 2019-02-04 19:53:55 +00:00
537afbc23b EffectInstance: Require positive amplifiers, closes #2723 2019-02-04 19:53:28 +00:00
55cd1f263d SnowLayer: implement layers, closes #2657 2019-02-04 19:53:17 +00:00
923b1ad9a6 Split up ChunkLoader and ChunkListener 2019-02-04 19:53:03 +00:00
2c0f91ce50 Player: clean up chunk selection code 2019-02-04 19:52:36 +00:00
ce8d9fa9f4 Player: load chunks when registering as a loader, closes #2726
populateChunk() _sometimes_ does this, but not if the chunk is locked. This means that the empty chunk needed to prevent the shit hitting the fan isn't created when chunks are locked. This change resolves the problem because registerChunkLoader() calls loadChunk() with the create parameter as true when autoload is used. This is a shitty fix but it's the simplest one we have right now, and it works well.
2019-02-04 19:52:03 +00:00
002f030970 EnderPearl: make a hack less messy 2019-02-04 19:51:49 +00:00
dbae667dec Silence more InteractPacket noise 2019-02-04 19:51:38 +00:00
ad6ae20d6b Server: fixed getOfflinePlayerData() trying to load terrain (?!?!?!?), closes #2725
getOfflinePlayerData() will now return NULL if there is no stored data for a given player. The responsibility of checking the spawn point is now delegated to the Player, after it registers a chunk loader on its spawn chunk.
2019-02-04 19:51:11 +00:00
3e58708130 Add some missing @throws annotations 2019-02-04 19:50:43 +00:00
8387c08db2 Level: remove unused variable 2019-02-04 19:50:24 +00:00
c9f9f551f4 Merge branch '3.5' into master-rollback 2019-02-04 19:47:21 +00:00
0f92ec6d2a Level: Record a debug message when chunks are loaded without loaders 2019-02-03 16:24:10 +00:00
791b4d8ef3 SplashPotion: measure distance from eye height instead of base
this fixes effect durations being off (mostly), closes #2650
there are still some minor differences, but this is closer matching than the previous version.
2019-02-03 11:32:47 +00:00
0b7ff6f2e7 Level: properly mark some functions as @internal
this ensures these functions won't appear in the documentation.
2019-02-01 14:33:06 +00:00
af092b01e1 3.5.10 is next 2019-01-31 18:47:57 +00:00
d811217755 Release 3.5.9 2019-01-31 18:47:32 +00:00
d7f86f0240 Hack for client side regeneration (disable natural regeneration gamerule) (#2722) 2019-01-31 18:45:25 +00:00
5fe1d2e396 Level: fixed setChunk() bug introduced by eebd90ec42
Anyone who is using getChunkPlayers() should probably check that their code is actually doing what they think it's doing.
2019-01-31 18:28:42 +00:00
ddbb5363ef Block->getBreakTime() now throws InvalidArgumentException on items with bad efficiency values 2019-01-30 19:10:24 +00:00
c124aae219 Merge branch '3.5' 2019-01-30 13:09:43 +00:00
d3704bfae4 3.5.9 is next 2019-01-30 12:49:46 +00:00
07f034d2da Release 3.5.8 2019-01-30 12:49:16 +00:00
331ae5498f Crash the generator when encountering invalid presets
this is a partial fix for #2717, but still not ideal because it'll spam whenever a chunk is attempted to be generated. However, fixing this properly requires potentially breaking API changes.
2019-01-30 12:29:04 +00:00
5c24ac604a Merge branch '3.5' 2019-01-30 11:14:47 +00:00
eebd90ec42 Level: fixed setChunk() leaking memory when not copying tiles/entities
closes #2719
2019-01-30 10:58:35 +00:00
8e47a40b4c Level: rename poorly-named parameter of setChunk()
this now has a mouthful of a name. I'd like to invert it, but I can't do that without silently breaking backwards compatibility, which is unacceptable.
2019-01-30 10:26:18 +00:00
90f3cb95d8 Merge branch '3.5' 2019-01-29 17:34:12 +00:00
0f9fdf6442 Fixed Cactus and Sugarcane growing through bad blocks
closes #2714
2019-01-29 17:32:48 +00:00
c5f0665853 Merge branch '3.5' 2019-01-29 14:05:00 +00:00
5364e4de68 Explosion: fix chest unpairing (root cause of #2701)
not ready to call this "fixed" yet because any chests that were already affected by the bug will still be affected. This change will prevent the creation of more broken chests like this.
2019-01-29 13:58:47 +00:00
1099e2044b SetupWizard: fixed user being able to avoid agreeing to license, closes #2703 2019-01-29 13:43:13 +00:00
80d48161d3 Crops: fixed consuming bonemeal on fully-grown crop, closes #2704 2019-01-29 13:41:02 +00:00
fbe8485696 Player: fixed falling causing starvation, closes #2708 2019-01-29 13:36:24 +00:00
a150f39b02 Fixed fall handling when flying, closes #2709 2019-01-29 13:28:43 +00:00
b6ecab1d49 Merge remote-tracking branch 'origin/3.5' 2019-01-29 12:53:38 +00:00
71d17c50d6 Fixed internal IP detection (#2711), closes #2702 2019-01-29 12:51:53 +00:00
ceddf6f5d8 Merge branch '3.5' 2019-01-28 17:52:11 +00:00
3a18bdd6a0 Prevent block-picking unknown blocks 2019-01-28 17:45:48 +00:00
c3bbb8905c Human: simplify setFood() 2019-01-28 17:33:58 +00:00
78dfcc5f2d Move Effect and EffectInstance to entity\effect namespace 2019-01-28 15:41:07 +00:00
a6237958e8 Level: fix another crashy edge case in chunk ticking
this also removes a bias towards the chunk that the player is on, because this makes such chunks tick faster than adjacent chunks.
2019-01-27 20:41:47 +00:00
9ec40c421f Split up Effects into a bunch of classes
Server-side levitation now works too.
2019-01-27 19:45:15 +00:00
729ae8bab7 Level: fixed adjacent chunk loading check 2019-01-27 16:20:38 +00:00
ac551cf248 Entity: add addMotion() to allow updating motion vector
this allows updating motion without needing to create new objects for the task.
2019-01-27 15:43:57 +00:00
bccc07633c Entity: Allow disabling gravity for a mob 2019-01-27 15:42:46 +00:00
6f9c4eb8e8 Merge branch '3.5' 2019-01-27 15:08:26 +00:00
96857c65b6 Player: Fixed subscribing to broadcast permissions too early
Plugins would indirectly trigger permissible recalculation too early in the login sequence, which then caused their permissions to be recalculated and subscribing them to the broadcast permission far too early.
2019-01-27 15:08:08 +00:00
0b1bdec3ac GameMode::fromString() now throws InvalidArgumentException 2019-01-26 17:09:54 +00:00
e86ff7d988 Merge branch '3.5' 2019-01-26 17:00:04 +00:00
9826abd83e Stair: fixed crash if player is null 2019-01-26 16:59:03 +00:00
48c8c2a8c3 ItemFrame: address crashdump 2113950
thanks Mojang for designing this lovely system where so much undefined behaviour is able to take place :(
2019-01-26 16:58:25 +00:00
d378371cc8 Transition to spl_object_id() 2019-01-26 15:06:38 +00:00
1e708db26c Server: fixed wrong doc type on broadcastMessage() 2019-01-26 15:03:15 +00:00
d052b1a45f Server: reduce code duplication in broadcast handling 2019-01-26 15:02:07 +00:00
d6e44c7475 Sync composer dependencies 2019-01-26 14:11:45 +00:00
eac8f639a7 Level: Simplify internal chunk ticking handling 2019-01-26 13:48:43 +00:00
519f6e2668 Merge branch '3.5' 2019-01-26 12:08:21 +00:00
c83b7d9b69 Utils: fixed getNiceClosureName() not processing namespaced closures properly 2019-01-26 12:08:07 +00:00
939f3efa3b Merge branch '3.5' 2019-01-25 19:44:08 +00:00
c66dc7b273 Level: Optimize blockticking coordinate selection
generating 1 large bounded random costs the same as generating 4 small ones, so it makes more sense to do it like this instead.

Note that prior to 7.1 this code would not work due to it not handling 64-bit appropriately.
2019-01-25 19:43:16 +00:00
6ee484e401 ChunkLoader: remove getLoaderId() (take 2) 2019-01-25 18:58:01 +00:00
bb27c76d13 Merge branch '3.5' 2019-01-25 17:12:00 +00:00
5bf7350ee5 Level: change some stupid var names 2019-01-25 17:10:44 +00:00
8a0f5cd7c9 Merge branch '3.5' 2019-01-25 13:19:40 +00:00
636cc1c199 Level: some mitigations for #2675
this reduces the performance impact by using smaller keys, which reduces the key distance for nearby blocks.
2019-01-25 13:17:33 +00:00
9d69154da5 Merge branch '3.5' 2019-01-24 18:45:06 +00:00
62b6405371 Use 2 space indents in YAML files
this is (mostly) a backport of #2593 to 3.5. Closes #2593.
2019-01-24 18:44:06 +00:00
469b24b0a5 Remove built-in spawn protection
Users should use the new BasicSpawnProtection plugin instead.
2019-01-24 16:56:15 +00:00
df09b0101a Merge branch '3.5' 2019-01-24 11:50:19 +00:00
9ecf23d3ee Fix some bugs in doxygen config 2019-01-24 11:26:48 +00:00
738e310798 Strip out RCON, closes #2686
Users should move to the new RconServer plugin instead.
2019-01-23 20:39:16 +00:00
61e04d5284 Merge branch '3.5' 2019-01-23 16:48:12 +00:00
187f36fe38 ExperienceOrb: clean up some confusing code 2019-01-23 16:46:18 +00:00
dc89b48354 Human: Fixed XP drop amount to match vanilla
In vanilla it doesn't drop the exact number of points you collected. Rather, you lose a little for every level above 1 you had (1 level requires 7 points, later levels require +2 per level), and can recover at most 100 points. Hence, if you had 10 levels, you get back enough points to fill 5 levels and most of a 6th. 14-15 levels gets you the upper bound of about 7.5 levels.
2019-01-23 12:39:25 +00:00
e6d1c1dfbc Living: Get rid of delayed XP spawning, closes #2644
This is not identical to vanilla, but I don't care because it gets rid of edge cases and also makes it easier to integrate with EntityDeathEvent in the future.
2019-01-23 12:31:05 +00:00
6277787e0a Convert Particle to interface 2019-01-23 12:18:24 +00:00
d2284d5c47 Move Particle IDs to protocol namespace 2019-01-23 12:16:01 +00:00
23a18a8eb6 Convert Sound into interface 2019-01-23 12:10:24 +00:00
2356991022 Merge branch '3.5' 2019-01-22 22:27:07 +00:00
5a8812b1dc 3.5.8 is next 2019-01-22 22:14:19 +00:00
4b8e4123af Release 3.5.7 2019-01-22 22:13:35 +00:00
45a4252c26 RCON: Explicitly specify connection backlog size, fixes #2685
I believe this is caused by a bug in the linux kernel, since it only impacts certain machines I tested (one, to be specific). Whatever the case, setting a max backlog size is prudent anyway, and fixes the problem.
2019-01-22 22:11:32 +00:00
feaaa925a7 Fixed a series of denial-of-service bugs in RCON
Packets with a too-short payload would either cause the RCON thread to hang until the client disconnected, or crash the RCON thread entirely.

commit 90bb1894d7f87645b806f5fc67d1b877bb963180
Author: Dylan K. Taylor <odigiman@gmail.com>
Date:   Tue Jan 22 18:15:46 2019 +0000

    fix some bugs in RCON
2019-01-22 22:05:15 +00:00
5221db1178 Updated BinaryUtils dependency 2019-01-22 17:22:11 +00:00
17fee801e6 RCON: remove unnecessary function 2019-01-22 13:43:55 +00:00
1ebc101ded fixed crash on dev build self-shutdown 2019-01-22 13:38:50 +00:00
48a99937b9 more exception handling cleanup 2019-01-22 13:37:46 +00:00
053defb7dc Updated RakLib dependency 2019-01-21 14:19:15 +00:00
4ae6428641 Level: rename getCollisionCubes() -> getCollisionBoxes()
these aren't cubes! shoghi, please read the dictionary.
2019-01-20 18:11:20 +00:00
425ad6101f Block: rename onEntityCollide() -> onEntityInside()
this better describes what the hook is for.
2019-01-20 18:09:47 +00:00
d586a18a16 Updated BedrockData submodule 2019-01-20 16:57:25 +00:00
ae7d6cc4a2 Merge branch '3.5' 2019-01-20 15:53:47 +00:00
47321114eb login: allow 60 seconds clock drift on login JWT
can everyone please just use NTP already?
2019-01-20 15:51:29 +00:00
a27c9409f1 ExperienceOrb: fixed wrong condition 2019-01-20 12:30:24 +00:00
854f851525 ExperienceOrb: don't follow players in other worlds 2019-01-20 12:30:09 +00:00
467caf347d NetworkSession: Consistently don't use 0x prefix 2019-01-20 11:06:47 +00:00
5d8568b1a4 Add NetworkSession->getDisplayName(), clean up ip/port ad-hoc usages 2019-01-20 11:05:12 +00:00
842eb0200e Merge branch '3.5' 2019-01-19 19:14:39 +00:00
9003b38be3 Fixed a wtf in Player->removeWindow() 2019-01-19 19:14:21 +00:00
f9c067db50 Merge branch '3.5' 2019-01-19 17:48:57 +00:00
a6a93f822f 3.5.7 is next 2019-01-19 17:48:16 +00:00
6df983da3e Merge branch '3.5' 2019-01-19 16:24:41 +00:00
9d8a70d5cf Level: use appropriate exceptions 2019-01-19 14:55:09 +00:00
65927e6965 Minor cleanup to Player NBT creation garbage 2019-01-19 14:32:20 +00:00
d3f9d1f3e7 Merge branch '3.5' 2019-01-19 13:57:42 +00:00
179fb9c7cb Fixed tree trunk generation bug introduced by ac87319aed
Blocks were being overwritten in the writebatch which hadn't yet been set, so reading them from the world yielded air blocks instead of trunk, allowing the generation to overwrite blocks which should have been logs.
2019-01-19 13:41:28 +00:00
6b7710e62b Introduce dedicated NBT data exceptions, fix up some corrupted chunk handling 2019-01-19 12:43:47 +00:00
c5998a92a8 PluginManager: clean up some Throwable abuse 2019-01-17 23:34:59 +00:00
c5df2f6f0d Remove another Throwable abuse 2019-01-17 22:43:52 +00:00
2dee7e9e0f Properly handle Query packet errors 2019-01-17 22:22:53 +00:00
38cf8d157d Max players check now works properly
This now includes all connected sessions, whether they are considered online or not.
2019-01-17 21:40:10 +00:00
41676cb4d4 Server: remove some useless methods 2019-01-17 21:01:31 +00:00
bbc8bc4df5 Move some error handling stuff to SPL 2019-01-17 19:16:03 +00:00
e341f3dce2 Level: rename getName() to getDisplayName() 2019-01-17 16:46:56 +00:00
76f1ee1827 Add restrictions on packet send directions with interfaces
This prevents plugins sending wrong packets at the compiler level (or would, if we had a compiler). It's more robust than a getter for client/server and throwing an exception since a static analysis tool can detect faults created by sending wrong packets from the server. This is also used to deny service to dodgy clients which send wrong packets to the server to attack it.
2019-01-17 12:51:24 +00:00
b82e00ffdf Extract a Packet interface from DataPacket
this is in preparation for clientbound/serverbound packet separation. I did this already on another branch, but the changeset was dependent on a massive refactor to split apart packets and binarystream which i'm still not fully happy with.
2019-01-17 12:21:56 +00:00
9c0ebb6350 Minor formatting fixes 2019-01-16 22:14:40 +00:00
38afe22b79 Move Event cancellable parts to trait 2019-01-16 22:14:25 +00:00
2e7e56de1e Merge branch '3.5' 2019-01-16 21:52:03 +00:00
2656993223 AAAAAAAAAAAAAAAAAAAAAAAAAAAAA 2019-01-16 21:31:17 +00:00
fc98f4c42b Address more error cases, some minor cleanup 2019-01-16 21:30:31 +00:00
44ef9fc577 LoginPacket: account for some missed error cases 2019-01-16 21:00:28 +00:00
c9c6a5dc94 Fixed some doc comments 2019-01-16 20:48:26 +00:00
23269da1a6 Fixed the disaster of packet receive error handling 2019-01-16 19:53:48 +00:00
ddc2bed63f Add an API change request template 2019-01-16 19:21:37 +00:00
8bc33a849a Remove built-in pcntl support
This is a bolt-on feature that can't be disabled and causes serious grief for Unix server users, because it prevents ctrl+c aborting the server the normal way.
Instead, we prefer introducing a plugin to implement this functionality, so that users can opt-in or opt-out.
2019-01-16 14:13:08 -05:00
390501ec35 Merge branch '3.5' 2019-01-16 18:57:17 +00:00
728bc95d73 NetworkSession: remove premature GC optimization
The only cyclic references here are both destroyed during normal collection directly (net interface removes from sessions array, player destroys its session reference), so there's no need to destroy them again here. This just causes a giant swathe of potential crashes for no real benefit.

close #2669
2019-01-16 16:50:16 +00:00
acdd0fec5f NetworkSession: player may be null 2019-01-16 16:19:39 +00:00
f647b1b7a5 Some cleanup to internal sounds handling 2019-01-15 21:32:41 +00:00
c34a4f45d4 Merge branch '3.5' 2019-01-15 14:46:03 +00:00
f882f557fb Merge branch '3.5' 2019-01-15 10:33:58 +00:00
242c7e3777 Grass: remove premature optimization
this is reading full-block from the chunk every access, which is slower than accessing the level block-cache.
2019-01-14 23:14:31 +00:00
797aabdf15 Entity: Protect move() to avoid stupidity 2019-01-14 19:57:46 +00:00
ff5cb84b81 Server: fixed an oops 2019-01-13 21:00:16 +00:00
3e1aa3e2b4 Network: remove Server dependency 2019-01-13 20:41:17 +00:00
9c53b41851 Added PlayerInfo, Player is no longer accessible during PlayerPreLoginEvent 2019-01-13 19:32:30 +00:00
d2082c0383 Explosion: Recalculate light on destroyed blocks
this has been a bug for a long long time. I think the reason it was never addressed is because of the performance impact associated with it. However, that performance impact is now gone thanks to light update batching.
2019-01-13 14:22:35 +00:00
1dca9074d5 Remove hacks for triggering adjacent light refill 2019-01-13 14:17:56 +00:00
82788774b0 Level: Queue all block updates until the end of tick
this allows deduplicating block updates when lots of adjacent blocks are set on a tick, which has beneficial effects on performance. It also fixes #2659.

Future scope:
- Use this mechanism to deal with explosions properly.
- Don't execute block updates for air blocks.
2019-01-13 13:24:02 +00:00
d2768188e8 LevelManager: remove unnecessary message 2019-01-12 19:52:28 +00:00
5052b75565 Separate Level management functionality from Server, clean up a bunch of mess 2019-01-12 19:11:05 +00:00
27761ac26e Fixed casing: Gamemode -> GameMode
it's two words, not one.
2019-01-12 16:19:31 +00:00
a756519e6b Move gamemode constants & functions to their own class
future enhancements:
- make gamemode an object containing information about abilities that players have in this gamemode (gamemodes are just predefined ability sets)
- get the magic numbers out of the API
2019-01-12 16:10:14 +00:00
49bdd92faa LoginPacket: Assert that extradata must exist 2019-01-11 17:56:18 +00:00
e9f023fe69 LoginPacket: fix corruption false-positives in offline mode 2019-01-11 17:55:58 +00:00
19614ed25e Entity: move some NBT usages out of constructor, fix missing property defaults 2019-01-10 21:01:19 +00:00
f4d07f0c1e Merge branch '3.5' 2019-01-10 19:31:01 +00:00
1f54760dae Config: Make load() private 2019-01-10 18:03:15 +00:00
5d8fa2e126 Crash main server thread when RakLib dies
this way we get crashdumps and find out what's actually wrong with RakLib in the wild.
2019-01-09 19:04:12 +00:00
cc230034f9 Fixed TransactionData->actions default value, closes #2652 2019-01-09 14:15:06 +00:00
b9ce6537a8 Sync composer dependencies (master) 2019-01-09 00:22:42 +00:00
8452c7bdbd Sync composer dependencies 2019-01-09 00:18:55 +00:00
2924303169 Sync NBT dependency 2019-01-07 22:38:04 +00:00
9c16caf27b Fixed an edge-case in AvailableCommandsPacket decoding 2019-01-07 22:23:51 +00:00
4f50119b74 LoginPacket: Cater for more error cases
This now doesn't crash unexpectedly at the first sign of broken data.
2019-01-07 14:45:44 +00:00
8663be8504 moar issue templates 2019-01-07 00:59:16 +00:00
78cb6445a5 Introduce TileFactory 2019-01-07 00:20:24 +00:00
7d827a1c65 Introduce EntityFactory
This contains all of the static stuff that was previously embedded in the Entity static root. This solves a bunch of problems like circular dependencies between parent and child classes, encapsulating logic and reducing the size of the enormous Entity.php.
2019-01-06 23:54:29 +00:00
b1cef8509a Revamp Entity construction
This is a similar refactor to the one I recently did for tiles.

- Entity::createEntity() is removed. In its place are Entity::create() (runtime creation, use where you'd use a constructor, accepts a ::class parameter, throws exceptions on unknown entities) and Entity::createFromData() (internal, used to restore entities from chunks, swallows unknown entities and returns null).
- Entity::registerEntity() is renamed to Entity::register().
- Added Entity::override() to allow overriding factory classes without touching save IDs. This allows more cleanly extending & overriding entities. This method only allows overriding registered Entity classes with children of that class, which makes code using the factory much more sane and allows to provide safety guarantees which make the code less nasty.
- Entity::getKnownEntityTypes() is renamed to Entity::getKnownTypes().
- ProjectileItem::getProjectileEntityType() now returns a ::class constant instead of a stringy ID.
- Cleaned up a bunch of nasty code, particularly in Bow.
2019-01-06 23:33:36 +00:00
3ae722867c Merge branch '3.5' 2019-01-06 20:19:18 +00:00
f0733f6ab6 Merge branch '3.5' 2019-01-06 01:09:34 +00:00
f80eeee20f Merge branch '3.5' 2019-01-05 18:59:13 +00:00
cdf2f98e26 Merge branch '3.5' 2019-01-05 17:41:26 +00:00
532def67ab Merge branch '3.5' 2019-01-05 11:12:34 +00:00
d83f024a1f Merge branch '3.5' 2019-01-05 09:27:16 +00:00
226db35cf9 Merge branch '3.5' 2019-01-04 23:56:53 +00:00
d8d04aeb53 fixup some imports 2019-01-04 23:49:32 +00:00
adc1069ed2 Merge branch '3.5' 2019-01-04 23:28:44 +00:00
febf1b1801 Merge branch '3.5' 2019-01-04 11:46:12 +00:00
7a4e2371e6 master-specific PHPStan nits 2019-01-04 00:40:09 +00:00
e1064a9e36 Merge branch '3.5' 2019-01-04 00:37:48 +00:00
8ef15d728a HandshakeSessionHandler: fix a doc comment bug
thank you PHPStan ❤️
2019-01-03 22:36:31 +00:00
c559dfccfe DataPacket: encode() and decode() are now final, encodePayload() and decodePayload() are now abstract 2019-01-03 21:14:54 +00:00
60687d8d6c Merge branch '3.5' 2019-01-03 18:02:33 +00:00
9840a3c980 Merge branch '3.5' 2019-01-03 17:29:53 +00:00
4d15eb3327 Cleaned up the InventoryTransactionPacket decoding clusterfuck
@shoghicp, y u do dis... I almost created a sub-packet architecture to deal with this shit :(

This mess really ought to be split into multiple packets. Perhaps the PacketPool can be extended to do that in the future.
2019-01-03 17:24:30 +00:00
134956ac58 Add a Support issue template
maybe this will guide people who don't read into shooting themselves in the foot automatically >:)
2019-01-03 16:37:48 +00:00
5806ce9205 add a Crash issue template
valid crashdumps are usually self explanatory and include all required information like OS/version/etc, so there's no need to force reporters to rewrite a bunch of extra information that should already be in the crashdump.
2019-01-03 16:32:21 +00:00
7853076d80 Merge branch 'master' of https://github.com/pmmp/pocketmine-mp 2019-01-03 15:45:33 +00:00
19fa6f5e8f Merge branch '3.5' 2019-01-03 15:44:48 +00:00
6ad405950a Update support.yml 2019-01-03 00:01:20 +00:00
71f123c616 Merge branch '3.5'
# Conflicts:
#	resources/locale
2019-01-02 21:25:57 +00:00
5bb414620c Merge branch '3.5' 2019-01-02 15:05:19 +00:00
171be946c6 Network: burn some deprecated stuff 2019-01-01 20:53:33 +00:00
f81bbd60e8 Avoid use of internal fields in BinaryStream 2019-01-01 16:42:14 +00:00
4a629e1a26 DataPacket: remove dead function clean() 2019-01-01 15:43:05 +00:00
c6a32ccf2a Merge branch 'release/3.5' 2019-01-01 14:08:20 +00:00
ff3d2ba19e Fixed no-NBT banner items always placing black banners, closes #2624 2018-12-31 22:04:08 +00:00
3b183447b0 Merge branch 'release/3.5' 2018-12-31 21:52:48 +00:00
8415e49a7f Merge branch 'release/3.5' 2018-12-30 19:06:37 +00:00
c6036fb012 Merge branch 'master' of https://github.com/pmmp/pocketmine-mp 2018-12-30 17:33:54 +00:00
ae497a828f Merge branch 'release/3.5' 2018-12-30 17:33:31 +00:00
1e58144a38 Add Discord link to issue template 2018-12-30 17:19:25 +00:00
39c0fa6103 Merge branch 'release/3.5' 2018-12-29 20:58:12 +00:00
2e5465e328 Updated RakLib dependency 2018-12-29 20:13:28 +00:00
7b3115c00c Moved network NBT serializer into network namespace 2018-12-29 20:12:00 +00:00
ac87319aed Introduce a "block write-batch" concept (#2555)
Make use of writebatch to generate trees, doors and double plants safely

- Fixes #2441 
- Fixes #2548 
- Closes #2498
2018-12-29 12:00:14 +00:00
aaaddd1fd6 Terminal: stick a RESET on the end when writing a newline 2018-12-29 11:54:44 +00:00
d86107e22a Terminal: Added write() and writeLine() to allow easily emitting Minecraft-formatted text to the console 2018-12-29 11:28:25 +00:00
498bffb34f Fixed --enable-ansi and --disable-ansi not being respected on threads
this causes some breakage to the behaviour of Terminal, and for that reason this is going on 4.0.

Terminal::hasFormattingCodes() will no longer auto-detect whether colour codes are supported.
2018-12-29 11:23:32 +00:00
10ac322b8f Merge branch 'release/3.5' 2018-12-29 00:04:33 +00:00
23954c4cda RegionLoader: Remove dead/broken code
garbage collection does need to be implemented, but I was looking at this code and found so many fucking bugs I decided it wasn't worth the effort of fixing.
2018-12-28 23:03:24 +00:00
baf278831e Merge branch 'release/3.5' 2018-12-28 19:32:48 +00:00
e6381297c7 NetworkCipher: fix some missing typehints 2018-12-28 17:35:37 +00:00
3ebd7e8ba6 Add network-wide API to filter raw packets by regex, stricter validation for Query 2018-12-28 16:30:52 +00:00
f06e67a792 Allow plugins to disable background generation (#2613) 2018-12-28 14:34:54 +00:00
78a80a6958 Tighten validity checks for block metadata
This filters out over 200 invalid states which were previously considered just fine, including zero-width cakes, buttons with broken facing values, furnace/chest with crazy values, and more.
2018-12-28 14:33:09 +00:00
333773bf14 Merge branch 'release/3.5' 2018-12-28 13:04:17 +00:00
045868783c Merge branch 'master' of https://github.com/pmmp/pocketmine-mp 2018-12-28 12:56:01 +00:00
e9d43aa44f Fixed MainLogger not being assigned as global on async workers 2018-12-28 12:55:49 +00:00
f64cef7eb6 ItemFactory: Get rid of $multiple crap
this is required in a specialized format, which doesn't make any sense. Plugins with multiple packed item formats should parse them themselves.
2018-12-28 11:55:52 +00:00
ab75e89d95 Fixed generation changes in recent builds compared to 3.x
this was caused by improper RNG sanitization and a recent cleanup refactor.
2018-12-27 17:36:41 -05:00
cf20f0e23a Merge branch 'release/3.5' 2018-12-27 15:53:12 +00:00
8564efc011 Sync item and block legacy IDs 2018-12-27 15:02:14 +00:00
b8f8a81704 Merge branch 'release/3.5' 2018-12-26 23:18:33 +00:00
ba33d8340a Merge branch 'release/3.5' 2018-12-26 22:26:44 +00:00
a6cd9ae029 Implemented #2556: don't send tile NBT updates until the end of tick
this eliminates spam when tile spawn NBT changes a lot during a tick, for example the lines of a sign being updated.

closes #2556
2018-12-26 22:18:52 +00:00
2c6381632c Allow Tiles to decide how to copy data from an item 2018-12-26 20:01:14 +00:00
f6983efec1 Revamp Tile creation (again)
This breaks down the handling of tile creation even further.
- Introduced a static Tile::override() method to allow overriding the construction class for a specific type of chest. This applies to classes as opposed to save IDs, so you can override Chest::class with MyCustomChest::class and it will take effect for any Chest save ID.
- Removed MCPE stringy save ID constants from public Tile interface. These are now only used for creating saved tiles from a stored chunk, and saving them.
- Renamed Tile::registerTile() to register()
- Tile::create() and Tile::createFromItem() now accept a class parameter instead of a stringy save ID.
- Tile::create() and Tile::createFromItem() were changed to throw \InvalidArgumentException on unknown/unregistered tile types. They also now never return null, but always (except in exception cases) return an object which is an instanceof the base class specified.
2018-12-26 19:21:37 +00:00
9f4bb440bd Move server-full/banned/whitelisted controls into PlayerPreLoginEvent
This allows plugins to more easily control the behaviour of server-full, whitelisting and banning. A message can be assigned for each, with a plugin custom reason taking the final priority if set.

This system solves several edge case problems in the Bukkit version by allowing kick reasons to be combined, so that removing one kick reason will roll back the final reason to the next highest, instead of just allowing the player through completely.
Only one message will be shown at point of disconnection, for consistency with the old behaviour.
The message priority is as follows (for all cases, only if set):
- Plugin reason
- Server full
- Whitelist enabled
- Player is banned

This also brings us one step closer to separating Player and NetworkSession.
2018-12-26 13:46:44 +00:00
02efa93e3a PlayerPreLoginEvent: New, more elegant way to control authentication requirement
Previously the only way to deal with this was to cancel the PlayerKickEvent generated by lack of authentication. Now, plugins can decide whether auth should be required for a specific player. The default is whatever xbox-auth is set to in server.properties.

cc @Johnmacrocraft
2018-12-23 18:24:33 +00:00
f313d06070 Merge branch 'release/3.5' 2018-12-23 14:04:29 +00:00
0e108341d7 Merge branch 'release/3.5' 2018-12-22 17:37:32 +00:00
1520bccf7d Merge branch 'master' of https://github.com/pmmp/pocketmine-mp 2018-12-22 13:31:40 +00:00
e5cb48bec2 Merge branch 'release/3.5' 2018-12-22 13:31:18 +00:00
17e5f60410 Add community Discord to Discussion section 2018-12-22 11:24:04 +00:00
16ffd99005 Merge branch 'release/3.5' 2018-12-21 18:40:04 +00:00
b709e21622 Merge branch 'release/3.5' 2018-12-21 17:27:02 +00:00
a2e4fdc8a2 Merge branch 'release/3.5' 2018-12-20 20:02:16 +00:00
2506947641 Merge branch 'release/3.5' 2018-12-20 20:01:02 +00:00
20aaa8373a Sound no longer extends Vector3 2018-12-16 14:26:42 +00:00
3c520aa786 Particle no longer extends Vector3 2018-12-16 14:15:41 +00:00
ebf9cb3e62 Merge branch 'release/3.5' 2018-12-16 14:13:35 +00:00
19edacbea9 BanIpCommand: fix crash when banning by playername, closes #2578 2018-12-15 13:59:10 +00:00
c5262fdf61 Merge branch 'release/3.5' 2018-12-14 17:32:58 +00:00
e0558d2551 Merge branch 'release/3.5' 2018-12-14 10:03:36 +00:00
125cc28aa0 Merge branch 'release/3.5' 2018-12-13 10:54:30 +00:00
e92aac847c Merge branch 'release/3.5' 2018-12-13 09:56:54 +00:00
ffa733fe0c Merge branch 'release/3.5' 2018-12-12 19:51:41 +00:00
a9dc447f8f Tile: make createFromData() retrieve the ID by itself 2018-12-11 14:56:25 +00:00
d72e4cb9a1 Tile: remove createNBT(), add create(), createFromData(), createFromItem() 2018-12-10 19:40:37 +00:00
6dbceda3e8 Tile: Fill defaults and move code to constructors where appropriate
this is leftovers from when NBT was required to construct a tile.
2018-12-10 18:35:26 +00:00
7d594ac6d8 Merge branch 'release/3.4' 2018-12-09 19:28:52 +00:00
7f0667a1f0 Merge branch 'release/3.4' 2018-12-09 15:36:23 +00:00
9fed25d3a5 Merge branch 'release/3.4' 2018-12-08 17:08:25 +00:00
8dbeda69a7 Make use of Facing::rotateY() to reduce boilerplate 2018-12-07 10:49:12 +00:00
1cac2b098e Merge branch 'release/3.4' 2018-12-06 21:08:47 +00:00
39e383a175 Entity: add getHorizontalFacing(), clean up some boilerplate code 2018-12-05 20:27:43 +00:00
f60d13548e Fix another stupid recursion bug 2018-12-05 20:10:00 +00:00
c53d3c28fb Register a couple of simple missing redstone blocks 2018-12-05 19:11:54 +00:00
281d8fd813 Redstone torch is lit by default 2018-12-05 15:07:18 +00:00
2014ebccd8 Make state setters fluent, clean up some BlockFactory noise 2018-12-05 15:03:59 +00:00
ceef3110d7 Remove dead function 2018-12-05 14:09:19 +00:00
cd5b81bdb9 ChunkManager: Remove getBlockIdAt()/setBlockIdAt()/getBlockDataAt()/setBlockDataAt(), add getBlockAt() and setBlockAt() 2018-12-04 22:27:00 +00:00
8dd2ea22b8 Level: make use of fromFullState() in getBlockAt() 2018-12-04 22:05:00 +00:00
47e62b1b38 Level: Add setBlockAt() which accepts integers instead of Vector3 2018-12-04 21:59:58 +00:00
b50e29085e Remove InventoryEventProcessor, use closures instead 2018-12-04 19:02:26 +00:00
05e968d9fd Merge branch 'release/3.4' 2018-12-04 18:40:54 +00:00
bfe766e626 oops, a merge error 2018-12-04 13:22:29 +00:00
8fc11c6ce0 Merge remote-tracking branch 'origin/release/3.4' 2018-12-04 13:18:56 +00:00
8051fa4f6d Remove some direct Position->level accesses 2018-12-03 21:39:17 +00:00
9fb365306a Make Block->position() accept Level,x,y,z instead of Position
since this is an internal method, it doesn't make sense to force a single parameter that requires potentially constructing a separate object just for the parameters, so we pass primitives instead, which are also easier to typehint against.
2018-12-03 21:18:22 +00:00
c3623478c1 Merge branch 'release/3.4' 2018-12-03 18:33:44 +00:00
302c509b9f Merge branch 'release/3.4' 2018-12-03 16:17:26 +00:00
df9534e220 Merge branch 'release/3.4' 2018-12-02 16:44:03 +00:00
5936205760 Merge branch 'release/3.4' 2018-12-01 16:51:32 +00:00
206f913d2b Merge branch 'release/3.4' 2018-12-01 10:10:52 +00:00
c46475ac4a Merge branch 'release/3.4' 2018-11-30 19:28:06 +00:00
16006f9175 Make Tile constructors non-dependent on NBT 2018-11-30 17:05:36 +00:00
a2253e9e7d Flatten still liquid blocks into a liquid block property 2018-11-30 16:06:35 +00:00
ed531c0009 Merge branch 'release/3.4' 2018-11-29 19:57:35 +00:00
790ef0325c Merge branch 'release/3.4' 2018-11-29 18:47:25 +00:00
c3063ccc44 Remove useless CustomInventory class 2018-11-29 14:40:15 +00:00
650a2eee4b Tile: remove unused import 2018-11-27 20:04:47 +00:00
5024713291 Fixed population artifacts always generating in the bottom subchunk, closes #2538 2018-11-26 14:29:06 +00:00
20f0e344d6 Merge branch 'release/3.4' 2018-11-26 14:02:59 +00:00
328ee40d5d Bring back support for all-sided logs, properly this time 2018-11-25 19:52:45 +00:00
c809365c39 Make RedstoneRail class abstract 2018-11-25 19:22:00 +00:00
8fe3f6ef1b Player now drops the contents of temporary inventories
these inventories are just glorified crafting tables.
2018-11-25 17:13:35 +00:00
a9a647855b Remove useless Recipe interface 2018-11-25 17:08:09 +00:00
2ef91f6e2e Merge branch 'release/3.4' 2018-11-25 16:36:46 +00:00
d0e2cdb54c Tile: remove server field
it would be nice to get rid of the server dependency entirely... perhaps craftingmanager should be a singleton? it's contextless after all...
2018-11-25 15:58:24 +00:00
d8ea8fa0f0 Use Block objects more instead of legacy ID/meta crap 2018-11-25 14:55:12 +00:00
7399e9036a Block: add method isSameState() to allow black-box comparison of blockstates 2018-11-25 14:53:57 +00:00
4698c723bd Merge branch 'release/3.4' 2018-11-25 14:36:20 +00:00
7ddcd2941b More AxisAlignedBB::one() usages 2018-11-24 19:49:15 +00:00
fcd81ada04 Make Thin use dynamic state properties 2018-11-24 19:44:32 +00:00
0fec58730b Level: fixed recursion bug when reading dynamic states
calculating dynamic states in some cases requires getting properties from neighbouring blocks, but getting these blocks also causes their dynamic states to be calculated, leading to a bouncing recursion.
This change allows retrieving blocks without calculating dynamic state information, if the call was generated by calculating dynamic state information.
Since these blocks are incomplete, they should not be cached and are only used to allow another adjacent block to complete its state. It is therefore not possible for a block's dynamic states to depend on another block's dynamic states.

This recursion bug was observable by running /gc and walking into a door, which would cause the server to freeze and crash.
2018-11-24 19:44:31 +00:00
d426d18b77 Add dynamic shape property for stairs 2018-11-24 19:44:31 +00:00
1170b66fd5 Automate creation of tiles when they are used to store block properties 2018-11-24 19:44:31 +00:00
3f3bdaeba5 Use dynamic state detection to localize stateinfo stored in tiles (hack) 2018-11-24 19:43:02 +00:00
3af293f024 Added a mechanism for blocks to detect dynamic state properties from surroundings 2018-11-24 19:43:02 +00:00
b2201c8c59 Further cleanup to general AABB handling 2018-11-24 19:17:03 +00:00
d5ae4ad141 Sync Math dependency 2018-11-24 18:34:49 +00:00
101de7adda Update Math dependency, obliterate some nasty code from Block 2018-11-23 19:41:52 +00:00
4c848bb4c1 docs fixes 2018-11-22 17:07:36 +00:00
8b350808ef Fixed merge error 2018-11-22 16:56:44 +00:00
98efd27543 Remove ability to set blockID and blockdata independently
This was the cause of many inconsistency and broken world bugs. In the future (once we switch to paletted chunks) this won't be possible anyway. For now, some temporary API is provided to allow modifying chunkdata directly, but it is required that **both** must be provided.
2018-11-22 16:53:22 +00:00
507d47a6f5 Merge branch 'release/3.4' 2018-11-22 16:49:30 +00:00
a4e81674c3 Merge branch 'release/3.4' 2018-11-17 18:13:03 +00:00
f7ba4f553c Merge branch 'release/3.4' 2018-11-17 16:30:19 +00:00
e67b1a20de Merge remote-tracking branch 'origin/release/3.4' 2018-11-17 14:47:35 +00:00
20dad95755 Liquid: don't try to flow out of the world, close #2510
this fix is only required for master, although it could be backported.
2018-11-14 17:48:14 +00:00
5d7feaaf21 Remove EventExecutor, event handlers now use closures (#2525)
This cleans up some cargo-cult code poorly copied from Bukkit, which has negative performance effects and also makes internal event handling more complex than necessary.

## API changes
- Removed `EventExecutor` and `MethodEventExecutor`.
- A listener is no longer required for an event handler to be registered. Closure objects can now be used directly provided that they meet the conditions for registration.
- `PluginManager->registerEvent()` signature has changed: the `Listener` and `EventExecutor` parameters have been removed and a `\Closure $handler` has been added in its place.
- `RegisteredListener` now requires a `Closure` parameter instead of `Listener, EventExecutor`.

## Behavioural changes
These changes reduce the execution complexity involved with calling an event handler. Since event calls can happen in hot paths, this may have visible positive effects on performance.

Initial testing reveals a performance improvement of ~15% per event handler call compared to the old method.
2018-11-13 21:04:47 +00:00
ddef7bb09b Merge branch 'master' of https://github.com/pmmp/pocketmine-mp 2018-11-13 18:31:34 +00:00
3fb8029dff Merge branch 'release/3.4' 2018-11-13 18:25:03 +00:00
3c86944a7c Item: make addEnchantment(), removeEnchantment() and removeEnchantments() fluent (#2523) 2018-11-13 16:48:13 +00:00
45caec874e Merge branch 'release/3.4' 2018-11-12 22:18:28 +00:00
3031128520 Merge branch 'release/3.4' 2018-11-11 19:52:05 +00:00
e16171e37e Merge branch 'release/3.4' 2018-11-11 12:39:01 +00:00
95bf3ab7a8 Merge branch 'release/3.4' 2018-11-11 11:15:54 +00:00
2965109484 Merge branch 'release/3.4' 2018-11-10 22:37:17 +00:00
3a6af3327f Encapsulate plugin.yml commands handling inside PluginBase, removed CommandExecutor requirement from Plugin interface
This removes the need for custom Plugin implementations to implement onCommand().

In the future it's planned to remove plugin.yml commands completely and have them registered similarly to how events are handled.
2018-11-09 19:50:52 +00:00
8b9ec5dde3 Merge branch 'release/3.4' 2018-11-07 22:11:27 +00:00
0b03e3c95b Update dependencies, fix travis failure 2018-11-05 21:20:42 +00:00
67a5f3f557 Register MainLogger as SPL global, remove hard MainLogger dependency from many areas, break a bunch of cyclic dependencies 2018-11-05 19:01:59 +00:00
ed8569a3f4 Remove Collectable class, fix memory leak on AsyncTask fatal error 2018-11-05 17:26:22 +00:00
c201a0e909 Move language submodule to resources/
again, this isn't source code.
2018-11-05 09:49:21 +00:00
ce7718f0d1 Move resources/ directory out of src/
this isn't source code and as such doesn't belong in here.
2018-11-05 09:46:43 +00:00
2a5ab1f397 Merge branch 'release/3.4' 2018-11-04 23:33:10 +00:00
6437078c8b TaskScheduler: remove deprecated constructor parameter 2018-11-04 23:30:04 +00:00
0028ce0ed2 Merge branch 'release/3.4' 2018-11-04 23:25:05 +00:00
2a43d9ecb6 Merge remote-tracking branch 'origin/release/3.4' 2018-11-04 22:56:03 +00:00
1c9137aa94 Merge branch 'release/3.4' 2018-11-04 22:18:15 +00:00
38d419fb29 Level: use isInWorld() where appropriate 2018-11-04 12:59:34 +00:00
6e05b5cc4b Merge branch 'release/3.4' 2018-11-04 11:57:40 +00:00
0e87cf801e Merge branch 'release/3.4' 2018-11-03 19:44:00 +00:00
652256a109 Merge branch 'release/3.4' 2018-11-03 16:58:19 +00:00
e94dd367ef Merge branch 'release/3.4' 2018-11-03 15:46:31 +00:00
1b4c65e74d Merge branch 'release/3.4' 2018-11-03 12:12:59 +00:00
acd3116591 Merge branch 'release/3.4' 2018-11-01 15:51:50 +00:00
4879eac946 Merge branch 'release/3.4' 2018-10-30 15:43:27 +00:00
d011fc518e Fixed wooden doors not dropping when removing supporting block, closes #2436 (#2496) 2018-10-29 16:16:57 +00:00
95be571481 Fixed Item->equals() not working for no-NBT items since 9bb3c93285 2018-10-29 12:45:39 +00:00
3760307a88 Merge branch 'release/3.4' 2018-10-29 12:42:29 +00:00
a6c31b72ae Level: throw exceptions on bad positions in setBlock() 2018-10-28 16:42:16 +00:00
7607e484dd Expose chunk locking to the API 2018-10-28 16:32:56 +00:00
1e8b153662 Further cleanup to Simplex/Noise hierarchy 2018-10-28 16:30:18 +00:00
e1795dfd49 Fixed wtf in Durable->setDamage() exception throw 2018-10-27 21:50:14 +01:00
f4105fd91a Noise: remove a ton of dead code 2018-10-27 17:04:53 +01:00
ff28c982ac Kick out unnecessary Perlin class
the code in here isn't used anywhere except as a base for Simplex, so it makes more sense to flatten it and get rid of the crap.
2018-10-27 16:33:58 +01:00
9bb3c93285 Remove network-serialized item NBT from API layer, item NBT is now retained for the lifetime of the stack 2018-10-27 15:26:01 +01:00
d2513ff908 Merge branch 'release/3.4' 2018-10-26 20:09:11 +01:00
0ef81e701a ItemFactory: Use a simple hashmap for item types
this is slower but yields less complicated code. Since this isn't in a hot path it's acceptable for this to slow down a little for the sake of sanity.
2018-10-26 18:38:24 +01:00
93131b4d92 Rename some meta usages to variant 2018-10-26 18:20:37 +01:00
7dd3b5b996 Durable: fixed leftover wtf from damage refactor 2018-10-26 18:17:34 +01:00
327c8361bd Remove variant parameters from TieredTool 2018-10-26 18:16:31 +01:00
f438736af5 Make some item constructor variant parameters mandatory 2018-10-26 16:51:02 +01:00
51e13104dc oops, missed one 2018-10-26 16:49:25 +01:00
712cafa0cc Item: remove redundant meta constructor params
these ctor params should only be used for variants in the ItemFactory registration, but all of these items have no non-zero variants anyway.
2018-10-26 16:29:14 +01:00
88b3df76eb Merge branch 'release/3.4' 2018-10-25 19:36:56 +01:00
c6a160d362 Merge branch 'release/3.4' 2018-10-25 18:42:19 +01:00
212d72657a AsyncPool: Switch to a more efficient collection algorithm, revamp internals (#2493)
This greatly improves GC performance by being more intelligent about how it collects garbage tasks. It knows that if X task in the queue is not finished, none of the tasks behind it can be finished either, so there's no point checking them.

This also presents the opportunity to cleanup a lot of async pool internals, so I've taken it and torched a lot of garbage.
2018-10-25 15:36:38 +01:00
a7eaec13b9 Merge branch 'release/3.4' 2018-10-24 15:53:13 +01:00
2aaac5a425 Merge branch 'release/3.4' 2018-10-24 12:18:04 +01:00
011b9ae159 Update to latest NBT lib version 2018-10-23 16:47:00 +01:00
a49abff099 Merge remote-tracking branch 'origin/release/3.4' 2018-10-22 17:46:37 +01:00
90482e79bc Merge branch 'release/3.4' 2018-10-21 18:23:54 +01:00
00b567e397 Merge branch 'master' of https://github.com/pmmp/pocketmine-mp 2018-10-21 15:33:42 +01:00
e9a4acda1d Merge branch 'release/3.4' 2018-10-21 15:32:57 +01:00
62db7727c0 Remove legacy issue template 2018-10-21 15:23:46 +01:00
08cf7e489f Update issue templates 2018-10-21 15:23:06 +01:00
742fbc25c3 BlockFactory: fixed 0 being assumed to be default if used
this defeated the whole point of adding this code ...
2018-10-20 21:42:34 +01:00
159c3a1a91 Merge branch 'release/3.4' 2018-10-20 19:20:22 +01:00
bae140dc02 Entity: remove dead code 2018-10-20 19:05:39 +01:00
fb128d0276 Merge branch 'release/3.4' 2018-10-20 16:43:25 +01:00
605e7e08ed Remove some deprecated methods 2018-10-20 15:29:43 +01:00
e035be8498 Remove some master-only usages of addGlobalPacket() 2018-10-20 15:27:08 +01:00
831a35ec69 Merge branch 'release/3.4' 2018-10-20 15:26:17 +01:00
517a21c418 RegionLoader: remove unused constant 2018-10-20 14:19:27 +01:00
d60c19551b Merge branch 'release/3.4' 2018-10-19 18:53:24 +01:00
93b8a6c44a Level: fix light removal bugs caused by 48a5eeb3a4 and 19e68f98a7
BlockFactory::\$lightFilter and Block->getLightFilter() are not equivalent.
2018-10-19 18:52:42 +01:00
7642298b4f Merge branch 'release/3.4' 2018-10-19 15:56:07 +01:00
39808dd94f Actually merge branch 'release/3.4' this time 2018-10-19 15:35:23 +01:00
d88b32da91 Drop useless numeric IDs for attributes, use strings instead 2018-10-19 15:29:01 +01:00
20b87b7875 Level: reduce complexity of populateChunk() 2018-10-19 15:29:01 +01:00
a2a6286e1c ItemFactory: clean up some unnecessary code
this try/catch isn't needed because the list offset derivation function will deal with invalid IDs anyway.
2018-10-19 15:29:01 +01:00
e7494fff96 - the fix didn't fix
this is a mess

it would be nice not to have to start the server to find these kinds of bugs >.<
2018-10-19 15:29:01 +01:00
f81849e550 ItemFactory: fix special case handling for durable items, close #2483 2018-10-19 15:29:01 +01:00
9284e53f9e Added failing test case for #2483 2018-10-19 15:29:00 +01:00
ec5af0398e VersionString: use appropriate regex for number matching 2018-10-19 15:29:00 +01:00
7d74ebbebc Merge branch 'release/3.3' 2018-10-16 09:51:30 +01:00
70054de575 Clean up garbage in Tree populators 2018-10-15 19:42:16 +01:00
cfee0a4e0b Merge branch 'release/3.3' 2018-10-14 11:08:50 +01:00
1b572d3e40 Level: rename unload to onUnload()
again, this is an intentional rug-jerk, along with a clearer naming.
2018-10-13 15:43:43 +01:00
bb286dea91 Server: more elegant isLevelGenerated() check 2018-10-13 15:37:26 +01:00
39d1196e4c Leaves: fix performance issue introduced by block meta nuke 2018-10-13 12:28:33 +01:00
f671da99a6 BlockFactory: fix failing test 2018-10-12 21:40:45 +01:00
7af7783cc8 BlockFactory: Register block to id|variant without setting state to allow non-zero default states
This will be needed to deal with things like chest/furnace which don't use 0 as a valid state (these both use facing horizontal for rotation, and vertical is invalid, so 0 would mean downwards facing which is invalid.
2018-10-12 20:05:44 +01:00
0520598584 BlockFactory: skip blockstates which corrupt the metadata
if the metadata doesn't match what was inputted when reading back, it's an invalid state and should not be registered.
2018-10-12 19:49:26 +01:00
873b64259d Torch: remove trailing comma 2018-10-12 19:07:43 +01:00
d151a89037 Vine: don't break when a supported vine is above, closes #2452 2018-10-12 18:38:52 +01:00
c96203b528 Set immobile flag on player pre-spawn
The client likes to fall involuntarily as soon as PLAYER_SPAWN PlayStatus is sent, which causes debug spam on the PM side and then movement reversions if falling far enough. This now prevents the client moving until the server knows the client has spawned.
2018-10-12 17:08:22 +01:00
acb794e728 Remove garbage from Entity(De)SpawnEvent
These methods:
a) add concrete dependencies
b) are pointless (event->getEntity() instanceof Creature, anyone? an IDE can better understand this as well...)
c) encourage bad code (they don't enforce type contracts the same way an instanceof check does - oh, and why not let's add an is*() for every new mob that gets added ever?
2018-10-12 16:35:51 +01:00
97c836f199 Remove nasty network crap from API 2018-10-12 16:31:17 +01:00
a944641509 Torch: Fix placement issues when clicking the bottom of a block, closes #2453 (#2474) 2018-10-12 12:26:44 +01:00
9901e61d65 Merge branch 'release/3.3' 2018-10-12 09:32:17 +01:00
9ac7c75e5b Merge branch 'release/3.3' 2018-10-11 19:44:06 +01:00
d583dc25c3 Merge branch 'release/3.3' 2018-10-10 13:45:31 +01:00
2e265423c7 Fixed NBT leveldata fixer never getting called 2018-10-10 04:44:45 -04:00
e2af394c81 Revert "Level: Identify chunk loaders by their object ID"
This reverts commit 3bb450244f.

PhpStorm you lying piece of shit... you only showed me the usages in Level!

This change should be revised and redone later.
2018-10-10 03:59:07 -04:00
9b31484655 Merge branch 'release/3.3' 2018-10-09 22:53:44 +01:00
3bb450244f Level: Identify chunk loaders by their object ID
chunkloader ID is completely unnecessary extra complication. spl_object_hash() would be fine for this as well, but a number is better. Since it's unique for the object lifetime (and the Level keeps a ref to loaders) this system should work just fine.
2018-10-09 16:32:34 +01:00
a653289c40 Rename Plugin->setEnabled() with a more clear name
This is intended to break API in order to jerk the rug out from underneath plugin developers who have been misusing this without noticing the side effects.
2018-10-08 13:06:51 +01:00
24677e1d79 Prevent undefined behaviour when accessing async worker thread-store from outside the worker itself 2018-10-08 13:01:12 +01:00
a0f3c03b50 oopsie woopsie
I made a fucky wucky! a wittle fucko boingo!
2018-10-08 12:59:47 +01:00
6ac0c517f5 Improve and simplify AsyncTask thread-local storage
This is now self-maintaining and doesn't rely on the async pool to wipe its ass on task completion. Instead, the garbage collector will cause thread-local data to be automatically released when the async task is garbage-collected on the main thread.
2018-10-08 12:48:44 +01:00
2bc663968e Merge branch 'release/3.3' 2018-10-07 19:45:38 +01:00
db9b235aa5 Merge branch 'release/3.3' 2018-10-07 17:48:32 +01:00
cc876b0e03 Merge branch 'release/3.3' 2018-10-07 16:36:43 +01:00
8d1400115e fixed unsupported leveldb format versions crashing the server 2018-10-07 15:42:59 +01:00
e13764832d Merge branch 'release/3.3' 2018-10-07 15:34:14 +01:00
7c1432526f Remove pointless ID maths from Level 2018-10-07 15:28:10 +01:00
139aaa5577 Protect Item->count 2018-10-07 14:34:04 +01:00
82c718cff0 Split Bucket into multiple classes 2018-10-07 14:03:13 +01:00
706082deb1 Fixed Flat generator using item ID/damage to build block layers 2018-10-07 12:01:43 +01:00
36548a335c Fixed some items disappeared after 5fb7825485 2018-10-06 21:30:21 +01:00
5fb7825485 Flatten Item variants, remove Item->setDamage() 2018-10-06 20:09:11 +01:00
14ef4558c2 Allow BlockFactory to handle position setting of newly created blocks 2018-10-06 19:06:49 +01:00
cdb17b1cee Fixed broken test 2018-10-06 17:39:11 +01:00
a430f7f4f7 Allow static properties and state masks to vary based on variant 2018-10-06 17:33:28 +01:00
9338061390 Update composer lock dependencies 2018-10-06 15:10:43 +01:00
785df3789d Remove now-unused internal function 2018-10-06 14:46:38 +01:00
7ee4fd55d3 Merge branch 'release/3.3' 2018-10-06 14:45:19 +01:00
78bb0145aa Remove unused imports from Block namespace 2018-10-05 18:31:06 +01:00
4608ecde9b Merge branch 'release/3.3' 2018-10-05 18:29:37 +01:00
495a0b1dc2 Merge branch 'release/3.3' 2018-10-05 18:11:33 +01:00
47f43c5e6b Remove some internal constants from public API 2018-10-04 20:03:11 +01:00
b407eba1a3 Apply typehints to level\format\io namespace 2018-10-04 19:59:26 +01:00
b214601a82 Silence PhpStorm complaining about hardcoded classpaths 2018-10-04 19:58:39 +01:00
a273a0c8a9 Fixed remaining cases of undefined behaviour on ambiguous world format
It was still possible to produce undefined behaviour by creating a db folder in a region-based world, or adding regions to a leveldb world. This now solves the problem completely by refusing to load the world if multiple formats match the world.
2018-10-04 19:43:31 +01:00
0cc4bc48cc Move generator classpath hack out of BaseLevelProvider 2018-10-04 18:55:20 +01:00
49e47edcf5 Separate level data handling from the main LevelProvider 2018-10-04 18:45:02 +01:00
f23bba053b Merge branch 'release/3.3' 2018-10-04 16:41:11 +01:00
b0f1863c4f Region loaders don't need to know their own coordinates 2018-10-04 16:37:19 +01:00
41f335e7d9 Level: Remove setSeed()
Seed is immutable information about the world, like its generator type, generator options, name, etc. We don't allow changing any of those things, so why the fuck would we allow changing the seed? This makes no sense at all.

I'm removing this because a) its existence makes no sense, and b) it will not produce the behaviour expected from such a function (what even is the expected behaviour???)
2018-10-04 16:24:07 +01:00
4d9d4d7c60 More cleanups to level provider hierarchy, move more garbage out of BaseLevelProvider 2018-10-04 16:02:55 +01:00
4f421d561c BaseLevelProvider: clean up not-exists error handling disaster
It checks for the existence of (and creates) the world directory if it doesn't exist. But what sense does this make when the world obviously doesn't exist in this case and must be generated first?
2018-10-04 15:41:18 +01:00
f787552e97 Remove LevelProvider::getProviderName()
This is problematic because child level providers can forget to override the provider name of their parents, and then override them by error. Instead, they should be used in a mapping fashion to make sure they are unique and not inherited.
Also, the old method did not permit registering multiple aliases for the same provider. This now makes that possible.
2018-10-04 14:56:42 +01:00
65b49dec71 Refactor hierarchy of Region-based world formats
In the future, McRegion and PMAnvil will become deprecated legacy formats which we won't support for writing anymore. However, this brings complications because Anvil (which would not be deprecated) would be sandwiched between its deprecated base (McRegion) and its deprecated child (PMAnvil), complicating the implementation (particularly for PMAnvil).

This abstracts away the generic Region-based world functionality into a separate class, making McRegion, Anvil and PMAnvil all inherit from it directly. Since only the chunk formats are different, they are more accurately siblings rather than parent-child (although Anvil and PMAnvil are cousins, ish).
2018-10-04 14:19:19 +01:00
eaf6b316c7 I always commit this submodule when I don't want it, and not when I do 2018-10-04 12:52:09 +01:00
050e972add Clean up default level provider management 2018-10-04 12:49:46 +01:00
23132b899c Added LevelProvider->getAllChunks() method
this returns a generator which yields known chunks. This will be used in the future for world format conversions.
2018-10-03 19:43:16 +01:00
8a062f440d Chunk: remove column methods
these were (mostly) unused, and the places they were used breaks the interface definitions. It also exposes internals that are sensitive to change.
2018-10-03 18:35:39 +01:00
77fd57e11a Removed wtf from Liquid 2018-10-01 16:20:35 -04:00
94936d0f6b Fixed CPU leak in falling water block updating
The cause of this was the flow decay of falling water changing, but the flow decay is ignored for falling water. This caused the block to be repeatedly set to itself, triggering local block updates, causing the disease to spread in large falling water bodies and cause immense amounts of lag.
2018-10-01 16:15:49 -04:00
74486d6880 Remove some state meta constants from API visibility 2018-09-30 14:43:55 +01:00
274a4d892f Rail: detect state and then place, not vice versa 2018-09-30 14:35:57 +01:00
1a2312418b Fixed assert failure when placing northeast/northwest powered rails 2018-09-30 14:17:30 +01:00
5344c0a627 Merge branch 'release/3.3' 2018-09-29 15:39:40 +01:00
8e6a5813ea Don't auto-create tiles on activate
this complicates the code unnecessarily and doesn't produce the desired effect in most cases anyway.
2018-09-28 20:12:41 +01:00
594a2041b6 Trapdoor: fix bad meth in comment 2018-09-28 16:44:30 +01:00
2600cf5977 Split some block variants into their own classes where behaviour differs 2018-09-28 16:21:03 +01:00
e038c4295d Clean up abhorrent mess of Slab placement code 2018-09-27 18:46:01 +01:00
35d51570be Add and make use of Block->isSameType() 2018-09-27 17:59:06 +01:00
8910c93de1 Slab: slight reduction of code repetition 2018-09-27 16:45:06 +01:00
73f1480e10 Merge branch 'release/3.3' 2018-09-27 16:36:57 +01:00
0b49ec46c6 Deduplicate Pumpkin/Melon stem code 2018-09-27 16:24:35 +01:00
75f364fcf2 Level: Remove obsolete \$direct parameter from setBlock()
this parameter was previously used to send blocks with a different set of flags, immediately, to players. However, the flags have been demonstrated useless and the direct sending is pointless now since packets are buffered now per session, so we might as well take advantage of the batched block update sending.
2018-09-27 16:15:07 +01:00
16f2ac14b3 Clean up block update sending, remove UpdateBlockPacket flag constants
These flags are not intended for network use, instead they are supposed to be used internally by the game. For network, we only need to care about the 0x02 flag (send to players) because that's necessary for the client to render the block.
2018-09-27 15:56:08 +01:00
8a8f1d84ff EnchantingTable: fix BB 2018-09-27 11:29:23 +01:00
e6a1398992 EndRod: fix BB rotation on X/Z axes
this was very apparent with the new code, less so with the magic meta values...
2018-09-27 02:36:39 -04:00
ac3509aa3d Updated BedrockData submodule
this change won't be backported to other branches due to technical limitations that can't be easily solved without API breaks.
2018-09-26 19:58:03 +01:00
f2c960cfd8 Added on/off handling for buttons and levers 2018-09-26 19:19:35 +01:00
ebf5ccea8a Merge branch 'release/3.3' 2018-09-26 13:12:54 +01:00
896ecb52f4 Merge branch 'release/3.3' 2018-09-24 18:27:26 -04:00
9651b3f470 Crops: micro optimization - check age before generating random number (faster)
I don't have any idea how much benefit this will provide in real terms, but it may be significant.
2018-09-24 16:48:19 +01:00
a195e940db Fixed BB and right-click action for daylight sensor 2018-09-24 16:37:18 +01:00
a77e05f875 Implement corner stair BB handling 2018-09-24 16:25:17 +01:00
0b989925d7 whitespace 2018-09-23 18:41:57 +01:00
c501c740a1 Get rid of Block->canPassThrough()
This is only implemented in 1 place where the collision box should just be zero anyway, so there's no point this existing.

There's a lot of other blocks which should have bounding boxes without collision boxes as well, but that's outside the scope of this commit.
2018-09-23 17:05:03 +01:00
3eca64e893 Merge branch 'release/3.3' 2018-09-23 16:45:22 +01:00
4f200c5183 Merge branch 'release/3.3' 2018-09-23 16:35:53 +01:00
8873efc303 Duplicate block IDs into ItemIds to allow for split
this will be necessary to deal with negative IDs (if I choose to do that), and it'll also be necessary if I decide to do any shift hacks to merge ID/variant for block IDs, because we don't want such things to affect items before we're ready to deal with that.
2018-09-23 15:53:16 +01:00
1427da0aeb Clean up item handling of blocks 2018-09-23 14:21:37 +01:00
ed1c511c3c Hacks for dealing with negative item IDs... 2018-09-23 14:14:58 +01:00
9d2e9e1663 Fixed torch facing bug with wrong metadata
torches cannot face down
2018-09-21 19:45:52 +01:00
3edf3a3a80 Entity: remove unused import 2018-09-21 19:34:18 +01:00
02d5f4da85 fix merge error 2018-09-21 19:32:59 +01:00
a093ba3ed9 thanks git 2018-09-21 19:30:04 +01:00
4a7f8fd9d9 Implemented behaviour for cocoa pods 2018-09-21 19:28:31 +01:00
56d9943b0d Nuke Block->meta, split into variant and state properties, lots of cleanup
This is a major change to the way block metadata is handled within the PM core. This separates variant metadata (which really ought to be part of the ID) from state metadata, and in a couple of cases flattens separate states of blocks together.

The result of this is that invalid variants can be much more easily detected, and additionally state handling is much cleaner since meta is only needed at the serialize layer instead of throughout the code.
2018-09-21 19:28:10 +01:00
a55ab54ddb Merge branch 'release/3.3' 2018-09-20 19:02:48 +01:00
eab7424955 Merge branch 'release/3.3' 2018-09-20 17:05:01 +01:00
960fdb433e Merge branch 'release/3.3' 2018-09-20 16:50:11 +01:00
9b4d82630b BlockFactory: remove $solid
this is premature optimization and will run into problems once we enter the flattening.
2018-09-20 16:26:15 +01:00
19e68f98a7 Level: Remove unnecessary BlockFactory::$lightFilter usage 2018-09-20 16:16:28 +01:00
668da0772a WaterLily: fixed broken placement logic 2018-09-20 12:49:36 +01:00
058bd07319 Merge branch 'release/3.3' 2018-09-20 10:04:42 +01:00
7da51ae97e Fixed ItemBlocks passing the wrong block name to their constructors 2018-09-19 17:51:28 +01:00
d92e79ba54 Level: fix crashdump #754691 2018-09-19 17:39:31 +01:00
0f33459632 missed this because it was too far to the right of the screen... 2018-09-19 16:20:54 +01:00
d291345ed7 Clean up some unused imports 2018-09-19 16:20:16 +01:00
caca097300 Merge branch 'release/3.3' 2018-09-19 16:18:53 +01:00
dbe0ee2d44 BlockFactory: don't pre-populate gaps with UnknownBlock objects
this produces a minor reduction in memory usage.
2018-09-19 15:17:39 +01:00
ef038d9625 Level: use block directly in updateBlockSkyLight() 2018-09-19 15:07:24 +01:00
48a5eeb3a4 BlockFactory: remove some useless static arrays 2018-09-19 15:06:58 +01:00
a80d5bb6a8 Leaf log search is type agnostic
any wood type will do
2018-09-19 08:47:40 +01:00
01f12d6147 Merge branch 'release/3.3' 2018-09-18 12:32:12 +01:00
c721503b7a Merge branch 'release/3.3' 2018-09-18 12:22:32 +01:00
31e4093882 Remove some remaining hardcoded meta maps 2018-09-16 18:00:16 +01:00
8aab51c532 Merge branch 'release/3.3' 2018-09-16 17:47:41 +01:00
1bb4daa7d1 Fixed mess of rotations being inverted 2018-09-16 17:37:36 +01:00
f7f06c993d Make block constructors not write to this->meta directly 2018-09-16 14:10:40 +01:00
ed8b8a13a3 Vine: cleanup BB calculation 2018-09-16 12:20:10 +01:00
54e19a6d2f Vine: fixed north check being missing 2018-09-15 17:10:57 +01:00
932705e114 Merge branch 'release/3.3' 2018-09-14 17:10:39 +01:00
0e5cbca983 PlayerInteractEvent: cleanup constructor now that block isn't optional anymore 2018-09-14 16:30:22 +01:00
db2567f965 Separate use-item action from PlayerInteractEvent
This solves the age-old issue of PlayerInteractEvent firing twice when a player clicks a block with an item in the hand.

API changes:
- Removed PlayerInteractEvent constants LEFT_CLICK_AIR, RIGHT_CLICK_AIR and PHYSICAL.
- PlayerInteractEvent no longer fires when the player right-clicks the air.
- Added new event PlayerItemUseEvent.
2018-09-14 16:24:29 +01:00
b660bcdb65 Merge branch 'release/3.3' 2018-09-14 16:20:22 +01:00
1f3c0524d9 Merge branch 'release/3.3' 2018-09-14 11:06:31 +01:00
d4580fa683 Cleanup Sugarcane placement code 2018-09-13 19:49:55 +01:00
8ad57f7ca0 Painting: use Facing::rotate() 2018-09-13 19:36:03 +01:00
2b8405e6ee Make use of Bearing::opposite() 2018-09-13 19:35:47 +01:00
f488e594f6 Remove hardcoded facing literals in for loops 2018-09-13 19:34:27 +01:00
65684eec99 Door: fixed bad rotation when no player is specified 2018-09-13 18:36:50 +01:00
0406c49ba9 Leaves: improve log search algorithm to fix vanilla inconsistencies 2018-09-13 17:30:23 +01:00
3b772f54e9 Leaves: make more findLog() params optional 2018-09-13 16:49:22 +01:00
fee42e9f34 Leaves: Replace a big mess of code with something nice and simple (#2432) 2018-09-13 16:36:10 +01:00
c0962a47be Block: Use parent::place() instead of setBlock() directly 2018-09-13 12:54:03 +01:00
54342ab0ce Remove ridiculous code in Ladder 2018-09-12 19:56:17 +01:00
778eb5fb33 Block: Make getId(), getDamage(), setDamage() non-final
In the future, these methods will be used to derive ID/meta on the fly from properties instead of using them internally.
2018-09-12 19:40:19 +01:00
e0574008b4 AsyncPool: Move removeTasks() functionality inside shutdown()
there's no need for a loop if we just have the workers shutdown directly, because they'll block until all tasks are done anyway.
2018-09-12 18:08:42 +01:00
653fa1213e Added an event for handling duplicate logins (#2430) 2018-09-12 11:23:48 +01:00
535d4e2c9b Added NetworkSession->getPlayer() 2018-09-12 10:51:37 +01:00
ebc1524f9a Merge remote-tracking branch 'origin/release/3.3' 2018-09-12 10:39:49 +01:00
dd2861dd1a Merge branch 'release/3.3' 2018-09-11 19:49:51 +01:00
e50ba18bbd Merge branch 'release/3.3' 2018-09-11 12:28:18 +01:00
b3902ed76f Merge branch 'release/3.3' 2018-09-11 11:40:54 +01:00
f03ab76c83 Remove imports left over from 5ce2d5e072 2018-09-10 17:51:13 +01:00
37190c9a65 Apply typehints to all AsyncTask methods
Since we're breaking API here anyway, no point in holding back on this.
2018-09-10 15:54:01 +01:00
d62e00cc74 AsyncPool: Remove Server dependency (API breaks included)
This brings two plugin-breaking changes: AsyncTask->onCompletion() and AsyncTask->onProgressUpdate() no longer accept Server parameters.

This now allows for the functionality of AsyncPool and AsyncTask to be tested outside of a Server.
2018-09-10 15:48:59 +01:00
5ce2d5e072 Clean up to Generator creation, remove getSeed() from ChunkManager interface
it's the generator's responsibility to know about the seed, not the chunkmanager's. This now reduces the complexity of implementing and using a chunkmanager.
2018-09-10 13:28:15 +01:00
0d152a2139 Merge branch 'release/3.3' 2018-09-08 14:30:16 +01:00
3bd224ae1a Merge branch 'release/3.3' 2018-09-06 19:31:11 +01:00
bd091eb744 Merge branch 'release/3.3' 2018-09-06 19:15:53 +01:00
f218868338 Separate facing/bearing handling from Vector3, deobfusticate a ton of @shoghicp old code 2018-09-05 19:56:14 +01:00
99fb267333 Merge branch 'release/3.3' 2018-09-04 15:58:24 +01:00
034472bfe7 Merge branch 'release/3.3' 2018-09-04 11:58:19 +01:00
bc7cefff77 Merge branch 'release/3.3' 2018-08-31 16:20:06 +01:00
71ece194e4 Merge branch 'release/3.3' 2018-08-30 15:47:12 +01:00
9553df0f03 Sync master and 3.3 branches 2018-08-30 11:07:02 +01:00
5b75c5953f Merge branch 'mcpe-1.6-master' 2018-08-29 17:27:59 +01:00
b2c0bba86e Merge branch 'release/3.2' into mcpe-1.6-master 2018-08-29 17:27:48 +01:00
cf7071de3d 3.2.1 is next 2018-08-29 17:25:31 +01:00
9b49d09714 LevelProvider: Added methods to get and set rain/lightning level and times 2018-08-28 15:02:45 +01:00
91064b3209 Merge branch 'release/3.2' 2018-08-26 19:15:23 +01:00
66e46e1c07 Level: use chunk records for tile reading in getTileAt()
the previous revision caused a crash when clicking on the bottom of the world due to a block hash being out of bounds.
2018-08-26 18:57:08 +01:00
b99decc585 Merge branch 'mcpe-1.6' into mcpe-1.6-master 2018-08-26 18:06:22 +01:00
fa77a4fa58 Merge branch 'master' into mcpe-1.6-master 2018-08-26 18:06:18 +01:00
5d1ec1ad49 Server: remove deprecated parameter from findEntity() 2018-08-25 18:38:10 +01:00
3b62926721 Merge branch 'release/3.2' 2018-08-25 18:37:27 +01:00
4fb1f8dd76 Merge branch 'release/3.2' 2018-08-25 17:49:28 +01:00
d6376a236d Player: assign allowFlight directly instead of using setter
fixes #2397

This was changed by a4939b6bf1 without apparent reason. It causes AdventureSettings to be sent too early.
2018-08-22 19:20:21 +01:00
286e062086 Merge branch 'release/3.2' 2018-08-22 15:42:00 +01:00
b5aa80b375 Merge branch 'release/3.2' 2018-08-21 19:54:40 +01:00
f830eddd59 Merge branch 'mcpe-1.6' into mcpe-1.6-master 2018-08-21 17:55:48 +01:00
ac8565fc2e Merge remote-tracking branch 'origin/release/3.2' 2018-08-19 19:54:34 +01:00
358d8b7af7 Merge branch 'release/3.2' 2018-08-19 19:52:51 +01:00
848bce193c Chunk: change tile storage hash function to unbind Y coordinate
this isn't strictly needed but it is more scalable in the case of future build height limit lifts.
2018-08-19 16:56:50 +01:00
7c41bfcdf3 Removed Tile numeric runtime IDs, use block hashes instead
Tiles are level-local and are not indexed globally like entities. There is pretty much zero point to them having numeric runtime IDs.
2018-08-19 16:37:04 +01:00
92aeab0d00 Merge branch 'release/3.2' 2018-08-19 16:03:04 +01:00
475ec413e5 Removed deprecated ServerCommandEvent and RemoteServerCommandEvent
if you get rekt by these changes... USE A RELEASE like we've been telling you for so long!
2018-08-19 14:23:41 +01:00
b629738312 Merge branch 'release/3.2' 2018-08-19 14:06:34 +01:00
aa55cd9acf Merge branch 'release/3.2' 2018-08-19 13:01:54 +01:00
1177a381c8 Merge branch 'release/3.2' 2018-08-19 11:45:16 +01:00
3a1f0eca7c Merge branch 'release/3.2' 2018-08-19 11:23:04 +01:00
9ad30e239a Merge branch 'release/3.2' 2018-08-19 10:37:20 +01:00
06d7ee283d Player: Don't use iusername in cases where it's useless
these calls all do strtolower() anyway, so having iusername here just makes it confusing.
2018-08-18 13:42:00 +01:00
a306421737 Entity: remove lastX lastY lastZ lastYaw lastPitch, replace with lastLocation object field 2018-08-18 13:38:19 +01:00
f8e3b0b16b Support bot: Be a little less rude 2018-08-18 13:22:53 +01:00
bbd878986d Merge branch 'master' of https://github.com/pmmp/pocketmine-mp 2018-08-17 19:48:44 +01:00
44daf57fbb Merge branch 'release/3.2' 2018-08-17 19:48:18 +01:00
2438d20971 Fixed zero-compression being ignored for small packets 2018-08-16 22:23:09 +01:00
24d0102ffb Merge branch 'release/3.2' 2018-08-16 18:34:13 +01:00
718ca40379 Merge branch 'release/3.2' 2018-08-16 15:52:25 +01:00
d32b9ec5dc Player: remove useless write to NBT
the parent constructor doesn't care about this tag, and the tag is discarded afterwards.
2018-08-15 14:56:02 +01:00
2ee0436f46 Continued cleanup of runtime entity NBT removal
it's no longer necessary to force-write these, since the NBT is now ephemeral. Any tag type mismatches should be dealt with on read, after which the original tag will be discarded anyway.
2018-08-15 14:50:58 +01:00
30fcfac8cf Merge branch 'release/3.2' 2018-08-15 13:48:52 +01:00
728142b113 Level: remove useless check for RIGHT_CLICK_AIR
it's impossible for this to fire because of the condition immediately above, and makes no sense anyway...
2018-08-14 19:39:06 +01:00
b3d8d10bec Player: move flight toggling to its own method 2018-08-14 19:21:13 +01:00
d8198d8130 Fixed setItemInHand() regressions when placing or breaking blocks
this was causing any items set into the hand during these events _at all_ to get overwritten, rather than just tools. That's a bit of a problem for buckets because buckets rely on a bad hack to handle the modified items.

This doesn't fix the tools bug, but that's a job for another time.
2018-08-14 16:44:14 +01:00
cef1fe9524 Merge branch 'release/3.2' 2018-08-14 16:11:42 +01:00
0ae9b41062 Merge branch 'release/3.2' 2018-08-14 15:03:37 +01:00
ce58294305 ProcessLoginTask: check connected status instead of closed status
connected is what we're looking for here, as opposed to an entity being marked as garbage.
2018-08-14 14:39:01 +01:00
0273e2484e Kill entity runtime NBT (#2361) 2018-08-14 13:33:02 +01:00
4b7300de8d Use openssl_digest() instead of hash() in network hot code
openssl_digest() is TWICE as fast as hash() on my machine for the same data and same algorithm. I can only guess that OpenSSL is more optimized than PHP ext/standard :)
2018-08-13 19:56:20 +01:00
59a51a6c75 ArmorInventory: use broadcast for sending armour updates 2018-08-13 16:12:25 +01:00
f2fd505bae ArmorInventory: fixed missed usages of dataPacket()
these were missed because PhpStorm couldn't infer the variable types in foreach, and there were no type docs to help it out.
2018-08-13 15:57:59 +01:00
78671bafe3 Remove unnecessary DataPacket->encode() calls 2018-08-13 15:52:55 +01:00
15bac8c58a Implement send buffering and queuing for network sessions (#2358)
Async compression and broadcasts are now reliable and don't have race condition bugs.
This features improved performance and significantly reduced bandwidth wastage.

Reduce Level broadcast latency by ticking network after levels. This ensures that session buffers get flushed as soon as possible after level tick, if level broadcasts were done.
2018-08-13 14:37:18 +01:00
22c8077bdf Merge branch 'release/3.2' 2018-08-13 13:22:47 +01:00
078a2486b5 Merge branch 'release/3.2' 2018-08-11 20:00:01 +01:00
dbf5d9e985 Merge branch 'release/3.2' 2018-08-11 19:37:55 +01:00
10f14beb4b Fixed intermittent crash on player disconnect when async compression is enabled 2018-08-11 19:12:23 +01:00
0d9968f305 Added donation methods 2018-08-11 15:22:58 +01:00
9c94ebcf82 Updated DevTools submodule to get bloat fixes 2018-08-08 16:58:13 +01:00
82bd6c5b34 Merge branch 'release/3.2' 2018-08-07 19:06:46 +01:00
d3fa8e0a0a Merge branch 'release/3.2' 2018-08-07 18:49:21 +01:00
ec9ef891ee Player: clean up some runtime usages of NBT
the goal is to get rid of this completely, but that's slightly complicated by the mess that is player creation right now.
2018-08-07 18:27:22 +01:00
16b789a528 Player: remove useless checks from save()
this should never be called for a player with an empty username (because data isn't saved unless the player was spawned) and the instanceof is laughable.
2018-08-07 17:37:55 +01:00
55ac1c80c9 Player: replace redundant usage of Server->broadcast() 2018-08-07 17:33:57 +01:00
12a7436aea Merge branch 'release/3.2' 2018-08-07 14:43:34 +01:00
202fb08792 Merge branch 'release/3.2' 2018-08-07 14:39:56 +01:00
3fa9712a1e Merge branch 'release/3.2' 2018-08-07 14:32:47 +01:00
bd993b2342 Merge remote-tracking branch 'origin/release/3.2' 2018-08-07 12:34:07 +01:00
4597899ac3 Merge branch 'release/3.2' 2018-08-06 21:34:07 +01:00
e5b69deccf Merge branch 'release/3.2' 2018-08-06 20:53:16 +01:00
4142666df8 Level: clean up and remove checkTime() 2018-08-06 19:00:00 +01:00
fb0cc0804c Merge branch 'release/3.2' 2018-08-06 18:45:53 +01:00
ff6d590d0c PlayerInventory: Send updates to viewers automatically on setItemInHand() 2018-08-05 19:31:21 +01:00
c90e3e351d PlayerBlockPickEvent: remove setResultItem()
the same behaviour can be achieved by cancelling the event and setting the held item manually. Allowing this to be changed increases the complexity of dealing with survival block picking.
2018-08-05 19:07:23 +01:00
6fcb221453 Remove useless crap from ChunkLoader interface
these methods are not used anywhere and are unnecessary extra baggage for any implementation.
2018-08-05 18:38:51 +01:00
90f80782d4 Player: remove useless return value from dropItem() 2018-08-05 12:55:12 +01:00
ea9415961b Player: remove useless check from dropItem()
the transaction system will deal with this now, and if a plugin wants to make a player drop a null item, they are free to do so.
2018-08-05 12:53:31 +01:00
5df56a1bac Clean up some AnimatePacket boilerplate code 2018-08-05 12:39:36 +01:00
d81388f62c Merge branch 'release/3.2' 2018-08-05 12:21:06 +01:00
ac832f94a8 Merge branch 'release/3.2' 2018-08-05 11:33:20 +01:00
a5383b4a82 Use SetLocalPlayerAsInitializedPacket for spawning, fixed a bunch of bugs
this should fix forms not working during PlayerJoinEvent, and also removes the spurious PlayerItemHeldEvent firing on spawn bug.

The player MUST now send this packet. Bots take note.
2018-08-05 10:45:41 +01:00
25660843c5 Player: Obliterate InventoryTransactionPacket handler, add some new methods 2018-08-04 20:01:32 +01:00
905c0c825c Merge branch 'release/3.2' 2018-08-04 16:47:35 +01:00
83077309ef Merge branch 'release/3.2' 2018-08-04 16:03:46 +01:00
20f3b82d52 Be less dependent on AsyncTask->onCompletion() Server parameter
this is going to get removed soon.
2018-08-04 15:56:14 +01:00
779d92c656 BulkCurlTask: Remove complexData parameter (BC break)
This is a leftover from when it was necessary to pass complex data to the AsyncTask constructor in order to have it locally-stored. Since this has now been superseded by storeLocal(), it doesn't make sense for this parameter to exist anymore.
2018-08-04 14:44:20 +01:00
2cb6307e5b Merge branch 'release/3.2' 2018-08-03 20:08:01 +01:00
2170411cf8 Merge branch 'release/3.2' 2018-08-03 18:50:37 +01:00
425b1aa6f5 Merge branch 'master' of https://github.com/pmmp/pocketmine-mp 2018-08-03 18:25:21 +01:00
588d6c4b26 Merge branch 'release/3.2' 2018-08-03 18:24:50 +01:00
0e44e5b681 Update ISSUE_TEMPLATE.md 2018-08-03 09:02:53 +01:00
10ba3d6359 Network: add ability to tick sessions
moved responsibility for login timeout checks to NetworkSession instead of Server
2018-08-02 17:39:09 +01:00
e43496e7e4 Network: clean up ticking handling, RakLib only processes on Snooze notification 2018-08-02 17:14:21 +01:00
7560880168 Added DataPacketBroadcastEvent, refactor broadcast handling, close #1521
batchPackets() is now considered internal and shouldn't be used by plugins.

Added Server->broadcastPackets(Player[], DataPacket[]) : bool
2018-08-02 15:54:30 +01:00
c345e6f22c Merge branch 'release/3.2' 2018-08-02 14:43:59 +01:00
af6b279e54 Player: Ensure we always get flagged as closed when parent constructor was never called
This was causing unexpected bugs when players got disconnected during the login sequence.
2018-08-01 17:28:30 +01:00
809b33033e Player: Use connected status instead of Entity->closed flag 2018-08-01 17:27:32 +01:00
1ef538b69e LoginSessionHandler: fix crash when disconnected during login handling 2018-07-31 19:40:24 +01:00
47cf6e4833 Fixed not being able to disable encryption 2018-07-31 18:51:57 +01:00
32a78e679a Fixed JWT padding 2018-07-31 18:36:36 +01:00
488c03c200 Make timings for player network more detailed 2018-07-31 16:34:15 +01:00
2bf6764112 Implemented network encryption (#2343)
For those who fuss about performance, you can disable the `network.enable-encryption` option to use sessions without encryption.
2018-07-31 15:54:18 +01:00
62cb7963dc Remove deprecated functions for 4.0.0
If any moron starts complaining that their plugins broke, tell them to use 3.x... thanks
2018-07-31 14:37:54 +01:00
4e8a256a53 Language: use null coalesce for get() and internalGet() 2018-07-30 17:29:13 +01:00
58b46179f9 Language: make internal function not public
this is only used within the Language class anyway.
2018-07-30 17:27:48 +01:00
0d9952d53e Rename BaseLang -> Language 2018-07-30 17:07:19 +01:00
d26631d8e0 Clean up BaseLang error handling, throw exceptions instead 2018-07-30 17:00:52 +01:00
cab2d52ff8 Merge branch 'release/3.2' 2018-07-30 15:21:50 +01:00
fd3456e831 Merge branch 'release/3.2' 2018-07-30 14:54:15 +01:00
14f144b6f6 Merge branch 'release/3.2' 2018-07-30 09:36:53 +01:00
bdd42d6a78 Added NetworkSession->sendEncoded(), clean up some code 2018-07-27 18:39:14 +01:00
2647b3f404 VerifyLoginTask: remove unnecessary wordwrap()
I don't recall why this was needed, but it's not.
2018-07-27 18:33:10 +01:00
7541a6070f Player: clean up handling of authentication 2018-07-27 18:04:13 +01:00
f3cf64c2cf Security vulnerability reporting for dummies 2018-07-27 12:27:29 +01:00
df45e8a2cc Merge branch 'release/3.2' 2018-07-27 11:47:43 +01:00
eb738d1d72 Apply more typehints to generator namespace 2018-07-26 19:31:18 +01:00
edb03e8a9b Remove more dead code from the generator
this stuff is useless broken crap that just makes noise in inspections for no good reason... bye
2018-07-26 19:21:38 +01:00
20a5b75622 PluginBase: fixed error always being emitted on saveConfig()
This now throws exceptions... let's let the caller deal with this instead, it makes more sense anyway
2018-07-26 19:14:16 +01:00
c3bc751b04 Merge branch 'release/3.2' 2018-07-26 16:00:46 +01:00
be37236c76 Deduplicate code for general classpath registries 2018-07-26 15:21:03 +01:00
e016693779 Test one extra case for LevelProviderManager 2018-07-26 15:17:16 +01:00
d305a1342f Make Tile::registerTile() and Entity::registerEntity() throw exceptions instead of returning false 2018-07-26 14:55:55 +01:00
b9769c407b Merge branch 'release/3.2' 2018-07-26 14:40:39 +01:00
522f0f5c25 Config: remove dead field 2018-07-26 14:05:38 +01:00
7e81a09409 Merge branch 'release/3.2' 2018-07-26 14:03:39 +01:00
e6cbdd090e Merge branch 'release/3.2' 2018-07-26 10:25:25 +01:00
203d7e23f4 Merge branch 'release/3.2' 2018-07-25 20:57:57 +01:00
057d4fc62f Merge branch 'release/3.2' 2018-07-25 18:52:26 +01:00
98b34aaac8 Merge remote-tracking branch 'origin/release/3.2' 2018-07-25 15:51:39 +01:00
7f87714dae Merge branch 'release/3.2' 2018-07-25 15:30:50 +01:00
c09a774da7 Merge branch 'release/3.2' 2018-07-24 17:19:24 +01:00
4059e1f84c Merge branch 'release/3.2' 2018-07-24 16:33:37 +01:00
622fe99982 NetworkSession: Don't crash on failure to decode compressed batches
this could be an outdated version (pre-1.1 for example).
2018-07-23 14:38:46 +01:00
cc84ec8629 Fixed Player/NetworkSession/SessionHandler cycle memory leak
NetworkSession and some SessionHandlers hold cyclic refs to each other, stopping them getting destroyed. Unfortunately, these also reference the player, stopping that getting destroyed too.

The cycle garbage collector will deal with this, but it's best to get rid of the cyclic refs for immediate collection.
2018-07-22 13:41:06 +01:00
fe1df70923 Player: be less horrible and leave a deprecated proxy for dataPacket() 2018-07-22 12:20:13 +01:00
c1843ac2d4 Player: remove dataPacket() and directDataPacket()
I considered renaming sendDataPacket() to dataPacket() to reduce the BC breaks, but the parameter set has changed, which might cause astonishing behaviour, so it's better to break it in a loud way. Also, this has a clearer name.
2018-07-22 12:04:53 +01:00
85105ed066 Inseparable set of network changes - these all need each other to work
- Separated player handling and creation from network interfaces
- Rewire disconnects to make them not be recursive
- Batching now uses sessions instead of players
- Fixed DisconnectPacket getting sent to players who disconnect of their own accord
2018-07-21 20:03:05 +01:00
a86d3fe071 PlayerCreationEvent: Remove useless crap from constructor 2018-07-21 18:42:18 +01:00
b93318b2cf RakLibInterface: Use NetworkSession API for getting IP instead of Player
soon the network interfaces won't be dealing with Players at all.
2018-07-21 18:41:15 +01:00
ca1a0c8643 Move responsibility for ping handling to NetworkSession 2018-07-21 16:33:12 +01:00
57e5b1309d NetworkSession: Stop processing batch if player gets disconnected during handling 2018-07-21 16:27:30 +01:00
34d64be427 CompressBatchedTask: players aren't strings 2018-07-21 16:10:25 +01:00
dc29b4dc3f Merge branch 'release/3.2' 2018-07-21 15:57:56 +01:00
01a9e53394 Config: Clean up error handling, throw exceptions instead of returning false (#2314)
This also has the happy side effect of removing a cyclic dependency between Config and Server. There's only the dependency on MainLogger left to get rid of now.
2018-07-21 15:50:58 +01:00
c5bf746e4c typo 2018-07-21 14:45:22 +01:00
7d8624b12f ResourcePacksSessionHandler: clean up error reporting 2018-07-21 14:44:54 +01:00
da876cc8f3 ResourcePacksSessionHandler: Prevent clients requesting the same chunk more than once
Currently this can be used to attack the server by spamming requests for the same chunks forever. This commit prevents that by disconnecting the client if a chunk is requested more than 1 time. It is not necessary to allow more than 1 request per chunk, since RakNet should ensure that these are always delivered correctly.
2018-07-21 14:31:34 +01:00
d6e61e3e00 ResourcePacksSessionHandler: Account for out-of-bounds chunk requests 2018-07-21 14:19:24 +01:00
b9cd96f6e0 ResourcePacksSessionHandler: remove useless brackets 2018-07-21 13:36:20 +01:00
25a5394152 Merge phase 1 of network refactor - session handler rewrite
There are further changes that need to be done yet, but this section is now ready for showtime.
2018-07-21 10:03:17 +01:00
bfc372c6fb Merge branch 'release/3.2' 2018-07-21 09:53:50 +01:00
c257a791e1 ResourcePacksSessionHandler: move max pack chunk size to const 2018-07-21 09:37:15 +01:00
59f6821c29 Allow parameterizing ResourcePackManager to session handler
this will open the way (in the future) for custom managers to be used, instead of a global thing.
2018-07-20 20:08:12 +01:00
30c044f028 Unwrap more code from packet handlers 2018-07-20 18:48:46 +01:00
015ee90571 Split PlayerActionPacket handling into two classes, death is now a session state 2018-07-20 18:11:29 +01:00
f626b9e8a0 Initial mass migration to session handlers
This introduces several new session handlers, splitting up session handling into several new states:

- Login: Only allows handling the LoginPacket. This is the only time LoginPacket can be sent, and it'll be discarded when sent at any other time.
- Resource packs: Handles only the resource packs sequence (downloading packs and such). This is the only time ResourcePackClientResponse and ResourcePackChunkRequest will be handled.
- Pre-spawn: Only chunk radius requests are accepted during this state.

SimpleNetworkHandler handles all the "rest" of the logic that hasn't yet been separated out into their own dedicated handlers. There's also a NullNetworkHandler which discards all packets while it's active.

This solves a large number of issues with the security of the login sequence. It solves a range of possible DoS attacks and crashes, while also allowing great code simplification and cleanup.
2018-07-20 17:09:04 +01:00
97a1483f75 Player: remove useless crap from "constructor"
1. this isn't really the player constructor
2. this shit isn't needed until we start using the player as an actual player
2018-07-20 15:38:53 +01:00
a4939b6bf1 Player: re-structure a whole bunch of construction mess
This consolidates the Player entity construction and makes it more organized and consistent. There is of course a lot more work to do apart from this on player construction.
2018-07-20 15:34:47 +01:00
7633136a86 Player: move max players check to somewhere that makes sense 2018-07-20 13:22:08 +01:00
3cd105ff33 Remove remnants of needACK functionality
this has been broken for a long time and hasn't been used for even longer.
2018-07-20 13:07:06 +01:00
0fecb79add Player: separate some PlayerActionPacket handling logic out into their own functions
these are public, because later on the session handler will be calling these instead of the player itself.
2018-07-20 13:02:36 +01:00
aae19d45b7 Player: remove useless handleDataPacket() leftover 2018-07-20 12:41:16 +01:00
57a86d9ed7 Player: remove useless InteractPacket handler
all the things we cared about in here don't exist anymore, so there's no sense in the handler still existing. It can be restored when we want to use the things it still does.
2018-07-20 12:39:48 +01:00
25cfcada26 Player: clean up container close handling 2018-07-20 12:36:44 +01:00
e16f20affa NetworkSession: added getHandler() and setHandler(), SessionHandler->setUp() now not useless 2018-07-20 12:36:44 +01:00
08621604cd PacketPool: remove redundant comment
this was added to signify that these were normal, while BatchPacket was a hack. Since this has now been corrected, there's no need for the comment.
2018-07-20 12:36:44 +01:00
cdcafb1e75 PacketPool: Properly deal with varint packet IDs now that BatchPacket is gone 2018-07-20 12:36:44 +01:00
64ecc373be Split up session base logic and packet handling
this will allow for mutable packet handlers which can be used to cleanly implement multi-stage game sessions.
2018-07-20 12:36:44 +01:00
bdd9a7eb52 Kill BatchPacket, clean up batching related things
DataPacketSendEvent and DataPacketReceiveEvent will no longer capture BatchPackets
In most places strings are now used instead of DataPackets, to remove limitations on what data can be sent to a network interface
Removed CraftingManager's cyclic dependency on Server

There is a lot more work to do aside from this, but this commit is intended to clean up what is necessary to fix the handling of BatchPacket.
2018-07-20 12:36:44 +01:00
85647c03bf Move IP/port to NetworkSession 2018-07-20 12:36:43 +01:00
f969f3b77f Flatten NetworkSession hierarchy in preparation for refactor 2018-07-20 12:36:43 +01:00
bf4c6e4c2b Merge branch 'release/3.2' 2018-07-20 12:21:56 +01:00
f77ab468e3 Merge branch 'release/3.2' 2018-07-20 11:57:21 +01:00
424e9f4a49 Merge branch 'release/3.2' 2018-07-20 11:30:46 +01:00
1144620f2b Level: minor de-spaghettification of chunk requesting
Now the Level tells the player to request chunks on tick, instead of the server doing it.
2018-07-18 16:49:58 +01:00
e57dd3e8ba Merge branch 'release/3.2' 2018-07-18 15:14:41 +01:00
36e197e2a9 Move more session logic out of Player 2018-07-18 12:48:58 +01:00
4d1e2d1b3a Rename SourceInterface -> NetworkInterface
SourceInterface doesn't make sense really...
2018-07-18 11:03:21 +01:00
965f0d670d Improve documentation of SourceInterface and AdvancedSourceInterface 2018-07-18 11:01:16 +01:00
bc9a387b0b Fixed merge error 2018-07-17 18:46:27 +01:00
df3870a112 Merge branch 'release/3.2' 2018-07-17 18:35:43 +01:00
f47d6ee683 Merge branch 'release/3.1' 2018-07-17 16:57:08 +01:00
73afa22f50 Merge branch 'release/3.1' 2018-07-17 14:53:03 +01:00
ddc118a562 Merge branch 'release/3.1' 2018-07-17 12:02:33 +01:00
1f023bdcef Merge branch 'release/3.1' 2018-07-17 10:13:00 +01:00
70f874a559 Merge branch 'release/3.1' 2018-07-16 12:08:29 +01:00
e502280b20 Merge branch 'release/3.1' 2018-07-14 19:28:47 +01:00
4962d9df97 Merge branch 'release/3.1' 2018-07-14 16:06:08 +01:00
340de1c478 Merge branch 'release/3.1' 2018-07-14 11:57:32 +01:00
fbbb6f3beb Merge branch 'release/3.1' 2018-07-14 10:39:34 +01:00
25022b3144 Merge branch 'release/3.1' 2018-07-13 12:38:41 +01:00
599a64c80c Merge branch 'release/3.1' 2018-07-12 19:32:14 +01:00
ee5165b040 Merge branch 'release/3.1' 2018-07-12 18:04:26 +01:00
83065024f7 Merge branch 'release/3.1' 2018-07-11 10:21:24 +01:00
33ad4de981 Merge branch 'release/3.1' 2018-07-11 09:16:55 +01:00
eb8eac42b8 Merge branch 'release/3.1' 2018-07-10 12:48:14 +01:00
80ebc0bc5f Merge branch 'release/3.1' 2018-07-09 18:44:55 +01:00
46ea0186e4 Merge branch 'release/3.1' 2018-07-09 10:06:44 +01:00
9c80e349ce Merge branch 'release/3.1' 2018-07-08 12:17:18 +01:00
258b4f9dde ChunkRequestTask: add docs and typehints 2018-07-07 19:35:40 +01:00
78d27dc3e4 Move ChunkRequestTask to pocketmine\network\mcpe namespace
it has a lot to do with network and little to do with world I/O (load/save).
2018-07-07 19:34:11 +01:00
7e7cd6c995 Merge branch 'release/3.1' 2018-07-07 19:22:51 +01:00
b23c947060 Merge branch 'release/3.1' 2018-07-06 13:12:22 +01:00
4ccbb8b21a Merge branch 'release/3.1' 2018-07-05 17:43:19 +01:00
120eb8e362 CompressBatchedTask: move to pocketmine\network\mcpe namespace 2018-07-05 13:38:33 +01:00
2907de81ad Apply typehints to more general pocketmine\network namespace 2018-07-05 13:36:23 +01:00
950465d283 as always, missed one - I blame PhpStorm 2018-07-05 13:35:04 +01:00
2bba3a0805 Apply typehints to pocketmine\network\mcpe\protocol namespace
this is pulled from network-nuke in order to reduce the size of the diff.
2018-07-05 13:19:15 +01:00
fbd4f4a849 Merge branch 'release/3.1' 2018-07-05 12:11:26 +01:00
399870bf31 Merge branch 'release/3.1' 2018-07-02 16:58:22 +01:00
2252f7498d Merge branch 'release/3.1' 2018-07-02 16:57:01 +01:00
5dc4e17a96 Updated TesterPlugin submodule 2018-06-29 20:11:32 +01:00
49bca0d5a1 Remove a whole bunch of crap from the Plugin public interface (#2268)
- remove onLoad(), onEnable(), onDisable()
- remove Config related methods
- remove getResource(), saveResource(), getResources()

did I troll any readers so far?

On a more serious note, these methods do not need to be declared in this interface because they are either hooks (`onLoad()`, `onEnable()`, `onDisable()`) or methods only used from within `PluginBase` and its children. They are not intended to be public API, and for this reason they don't need to be exposed in the interface.
2018-06-29 20:04:10 +01:00
3846ee3d1d reorganize and optimize start.sh (#2267) 2018-06-29 14:48:29 +01:00
d49a41f788 Merge branch 'release/3.1' 2018-06-29 12:31:04 +01:00
4a11ded185 Merge branch 'release/3.1' 2018-06-29 12:19:32 +01:00
fc8dc8a497 Merge branch 'release/3.1' 2018-06-24 17:34:57 +01:00
cfee9aa117 Merge branch 'release/3.1' 2018-06-24 12:07:57 +01:00
884ebe632d Merge branch 'release/3.1' 2018-06-23 13:04:20 +01:00
d67149376d Merge branch 'release/3.1' 2018-06-22 17:48:09 +01:00
78aa1ee22e Merge branch 'release/3.1' 2018-06-22 13:42:29 +01:00
f60b0e5cc7 Server: more dev build warnings 2018-06-22 09:40:33 +01:00
9a6a5e2088 submodule updates 2018-06-22 09:36:07 +01:00
23085bf9b3 Merge branch 'master' of https://github.com/pmmp/pocketmine-mp 2018-06-22 09:14:03 +01:00
0948c65276 Merge branch 'release/3.x' 2018-06-22 09:13:49 +01:00
2308eadf53 Add ExamplePlugin to README 2018-06-21 22:15:50 +01:00
eddd626461 Trapdoor: fixed condition for side checking 2018-06-21 20:13:26 +01:00
8a65941489 reeeeee 2018-06-21 20:01:27 +01:00
99a0c2a188 Block: Make recalculation of BB non-dependent on block position
This now computes BBs relative to 0,0,0 and then offsets them as appropriate. This requires less boilerplate code and also furthers the goal of separating block types from instances.
2018-06-21 19:58:28 +01:00
1669 changed files with 98450 additions and 71845 deletions

View File

@ -4,3 +4,7 @@ root = yes
[*]
indent_size = 4
indent_style = tab
[*.yml]
indent_size = 2
indent_style = space

1
.gitattributes vendored
View File

@ -4,6 +4,7 @@
*.sh text eol=lf
*.txt text eol=lf
*.properties text eol=lf
*.neon text eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf

8
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,8 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: pocketminemp
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: https://github.com/pmmp/PocketMine-MP#donate

View File

@ -1,48 +0,0 @@
### Issue description
<!---
THIS ISSUE TRACKER IS FOR BUG REPORTING, NOT FOR HELP & SUPPORT. If you need help, use the links below.
- http://pmmp.readthedocs.io/en/rtfd/ - Documentation
- https://forums.pmmp.io - PMMP Forums
Any issues requesting updates to new versions of MCPE will be treated as spam.
Please do not create issues for missing/un-implemented gameplay features - they will be closed.
-->
<!--- Write a short description about the issue -->
<!--- If you are reporting a regression or unexpected behaviour, please include the below information: -->
- Expected result: What were you expecting to happen?
- Actual result: What actually happened?
### Steps to reproduce the issue
<!--- help us find the problem by adding steps to reproduce the issue -->
1. ...
2. ...
### OS and versions
<!--- use the 'version' command in PocketMine-MP
NOTE: LATEST is not a valid version. PocketMine-MP version should include Jenkins build number and/or git commit hash.
NO support whatsoever will be provided for third-party modified variants of PocketMine-MP. Issues relating to third-party modifications will be closed as spam.
Note that 32-bit platforms are no longer supported by PocketMine-MP and issues concerning 32-bit platforms will be closed.
-->
* PocketMine-MP: <!-- LATEST IS NOT A VALID VERSION -->
* PHP:
* Server OS:
* Game version: PE/Win10 (delete as appropriate)
### Plugins
- Test on a clean server without plugins: is the issue reproducible without any plugins loaded?
If the issue is **not** reproducible without plugins:
- Have you asked for help on our forums before creating an issue?
- Can you provide sample, *minimal* reproducing code for the issue? If so, paste it in the bottom section
- Paste your list of plugins here (use the 'plugins' command in PocketMine-MP)
### Crashdump, backtrace or other files
- Do not paste crashdumps into an issue - please use our Crash Archive at https://crash.pmmp.io for submitting crash reports to not spam the issue tracker. Add links to your reports in the Crash Archive here.
- Please use gist or anything else to add other files and add links here
* ...

View File

@ -0,0 +1,19 @@
---
name: API change request
about: Suggest a change, addition or removal to the plugin API
title: ''
labels: ''
assignees: ''
---
<!--- tell us what you want -->
## Description
<!--- explain why you want this and why it's a good idea -->
## Justification
<!--- (optional) describe alternative methods you've explored to achieve your goal -->
## Alternative methods

37
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,37 @@
---
name: Bug report
about: Unexpected non-crash behaviour (except missing gameplay features)
title: ''
labels: ''
assignees: ''
---
### Issue description
- Expected result: What were you expecting to happen?
- Actual result: What actually happened?
### Steps to reproduce the issue
1. ...
2. ...
### OS and versions
<!-- try the `version` command | LATEST IS NOT A VALID VERSION -->
* PocketMine-MP:
* PHP:
* Using JIT: yes/no (delete as appropriate) <!-- look for the giant yellow warning in the log that says you're using JIT -->
* Server OS:
* Game version: Android/iOS/Win10/Xbox/PS4/Switch (delete as appropriate)
### Plugins
<!--- use the `plugins` command and paste the output below -->
- If you remove all plugins, does the issue still occur?
- If the issue is **not** reproducible without plugins:
- Have you asked for help on our forums before creating an issue?
- Can you provide sample, *minimal* reproducing code for the issue? If so, paste it in the bottom section
### Crashdump, backtrace or other files
<!--- Submit crashdumps at https://crash.pmmp.io and paste a link -->
<!--- Use gist or anything else to add other files and add links here -->

11
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Help & support on Discord
url: https://discord.gg/bmSAZBG
about: We don't accept support requests on the issue tracker. Please try asking on Discord instead.
- name: Help & support on forums
url: https://forums.pmmp.io
about: We don't accept support requests on the issue tracker. Please try asking on forums instead.
- name: Documentation
url: https://pmmp.rtfd.io
about: PocketMine-MP documentation

16
.github/ISSUE_TEMPLATE/crash.md vendored Normal file
View File

@ -0,0 +1,16 @@
---
name: Crash
about: Report a crash in PocketMine-MP (not plugins)
title: Server crashed
labels: ''
assignees: ''
---
<!--- submit crashdump files to https://crash.pmmp.io -->
<!--- or, copy the data between ===BEGIN CRASH DUMP=== and ===END CRASH DUMP and paste it on a site like https://pastebin.com -->
<!--- DON'T JUST PASTE the crashdump into an issue -->
Link to crashdump:
<!--- write additional information about the crash to help us find the problem -->
### Additional comments (optional)

8
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 10

12
.github/support.yml vendored
View File

@ -1,12 +0,0 @@
# Configuration for support-requests - https://github.com/dessant/support-requests
# Label used to mark issues as support requests
supportLabel: "Support request"
# Comment to post on issues marked as support requests. Add a link
# to a support page, or set to `false` to disable
supportComment: >
This issue tracker is not a support forum. Please use the [forums](https://forums.pmmp.io) for support.
# Whether to close issues marked as support requests
close: true
# Whether to lock issues marked as support requests
lock: false

83
.github/workflows/draft-release.yml vendored Normal file
View File

@ -0,0 +1,83 @@
name: Draft release
on:
push:
tags: "*"
jobs:
draft:
name: Create GitHub draft release
if: "startsWith(github.event.head_commit.message, 'Release ')"
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup PHP
uses: shivammathur/setup-php@2.12.0
with:
php-version: 8.0
- name: Restore Composer package cache
uses: actions/cache@v2
with:
path: |
~/.cache/composer/files
~/.cache/composer/vcs
key: "composer-v2-cache-${{ hashFiles('./composer.lock') }}"
restore-keys: |
composer-v2-cache-
- name: Install Composer dependencies
run: composer install --no-dev --prefer-dist --no-interaction --ignore-platform-reqs
- name: Calculate build number
id: build-number
run: |
BUILD_NUMBER=$((2000+$GITHUB_RUN_NUMBER)) #to stay above jenkins
echo "Build number: $BUILD_NUMBER"
echo ::set-output name=BUILD_NUMBER::$BUILD_NUMBER
- name: Minify BedrockData JSON files
run: php vendor/pocketmine/bedrock-data/.minify_json.php
- name: Build PocketMine-MP.phar
run: php -dphar.readonly=0 build/server-phar.php --git ${{ github.sha }} --build ${{ steps.build-number.outputs.BUILD_NUMBER }}
- name: Get PocketMine-MP release version
id: get-pm-version
run: |
echo ::set-output name=PM_VERSION::$(php -r 'require "vendor/autoload.php"; echo \pocketmine\VersionInfo::BASE_VERSION;')
echo ::set-output name=MCPE_VERSION::$(php -r 'require "vendor/autoload.php"; echo \pocketmine\network\mcpe\protocol\ProtocolInfo::MINECRAFT_VERSION_NETWORK;')
echo ::set-output name=PM_VERSION_SHORT::$(php -r 'require "vendor/autoload.php"; $v = explode(".", \pocketmine\VersionInfo::BASE_VERSION); array_pop($v); echo implode(".", $v);')
echo ::set-output name=PM_VERSION_MD::$(php -r 'require "vendor/autoload.php"; echo str_replace(".", "", \pocketmine\VersionInfo::BASE_VERSION);')
- name: Generate build info
run: php build/generate-build-info-json.php ${{ github.sha }} ${{ steps.get-pm-version.outputs.PM_VERSION }} ${{ github.repository }} ${{ steps.build-number.outputs.BUILD_NUMBER }} > build_info.json
- name: Upload release artifacts
uses: actions/upload-artifact@v2
with:
name: release_artifacts
path: |
${{ github.workspace }}/PocketMine-MP.phar
${{ github.workspace }}/start.*
${{ github.workspace }}/build_info.json
- name: Create draft release
uses: ncipollo/release-action@v1.8.6
with:
artifacts: ${{ github.workspace }}/PocketMine-MP.phar,${{ github.workspace }}/start.*,${{ github.workspace }}/build_info.json
commit: ${{ github.sha }}
draft: true
name: PocketMine-MP ${{ steps.get-pm-version.outputs.PM_VERSION }}
tag: ${{ steps.get-pm-version.outputs.PM_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
body: |
**For Minecraft: Bedrock Edition ${{ steps.get-pm-version.outputs.MCPE_VERSION }}**
Please see the [changelogs](/changelogs/${{ steps.get-pm-version.outputs.PM_VERSION_SHORT }}.md#${{ steps.get-pm-version.outputs.PM_VERSION_MD }}) for details.

204
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,204 @@
name: CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
build-php:
name: Prepare PHP
runs-on: ${{ matrix.image }}
strategy:
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
steps:
- name: Build and prepare PHP cache
uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636
with:
php-version: ${{ matrix.php }}
install-path: "./bin"
phpstan:
name: PHPStan analysis
needs: build-php
runs-on: ${{ matrix.image }}
strategy:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636
with:
php-version: ${{ matrix.php }}
install-path: "./bin"
- name: Install Composer
run: curl -sS https://getcomposer.org/installer | php
- name: Restore Composer package cache
uses: actions/cache@v2
with:
path: |
~/.cache/composer/files
~/.cache/composer/vcs
key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}"
restore-keys: |
composer-v2-cache-
- name: Install Composer dependencies
run: php composer.phar install --prefer-dist --no-interaction
- name: Run PHPStan
run: ./vendor/bin/phpstan analyze --no-progress --memory-limit=2G
phpunit:
name: PHPUnit tests
needs: build-php
runs-on: ${{ matrix.image }}
strategy:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636
with:
php-version: ${{ matrix.php }}
install-path: "./bin"
- name: Install Composer
run: curl -sS https://getcomposer.org/installer | php
- name: Restore Composer package cache
uses: actions/cache@v2
with:
path: |
~/.cache/composer/files
~/.cache/composer/vcs
key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}"
restore-keys: |
composer-v2-cache-
- name: Install Composer dependencies
run: php composer.phar install --prefer-dist --no-interaction
- name: Run PHPUnit tests
run: ./vendor/bin/phpunit --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit
integration:
name: Integration tests
needs: build-php
runs-on: ${{ matrix.image }}
strategy:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup PHP
uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636
with:
php-version: ${{ matrix.php }}
install-path: "./bin"
- name: Install Composer
run: curl -sS https://getcomposer.org/installer | php
- name: Restore Composer package cache
uses: actions/cache@v2
with:
path: |
~/.cache/composer/files
~/.cache/composer/vcs
key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}"
restore-keys: |
composer-v2-cache-
- name: Install Composer dependencies
run: php composer.phar install --no-dev --prefer-dist --no-interaction
- name: Run integration tests
run: ./tests/travis.sh -t4
codegen:
name: Generated Code consistency checks
needs: build-php
runs-on: ${{ matrix.image }}
strategy:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636
with:
php-version: ${{ matrix.php }}
install-path: "./bin"
- name: Install Composer
run: curl -sS https://getcomposer.org/installer | php
- name: Restore Composer package cache
uses: actions/cache@v2
with:
path: |
~/.cache/composer/files
~/.cache/composer/vcs
key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}"
restore-keys: |
composer-v2-cache-
- name: Install Composer dependencies
run: php composer.phar install --no-dev --prefer-dist --no-interaction
- name: Regenerate registry annotations
run: php build/generate-registry-annotations.php src
- name: Regenerate KnownTranslation APIs
run: php build/generate-known-translation-apis.php
- name: Verify code is unchanged
run: |
git diff
git diff --quiet
codestyle:
name: Code Style checks
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Setup PHP and tools
uses: shivammathur/setup-php@2.15.0
with:
php-version: 8.0
tools: php-cs-fixer:3.2
- name: Run PHP-CS-Fixer
run: php-cs-fixer fix --dry-run --diff

22
.github/workflows/support.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: 'Manage support request issues'
on:
issues:
types: [labeled, unlabeled, reopened]
jobs:
support:
runs-on: ubuntu-latest
steps:
- uses: dessant/support-requests@v2
with:
github-token: ${{ github.token }}
support-label: "Support request"
issue-comment: >
Thanks, but this issue tracker is not intended for support requests. Please read the guidelines on [submitting an issue](https://github.com/pmmp/PocketMine-MP/blob/master/CONTRIBUTING.md#creating-an-issue).
[Docs](https://pmmp.rtfd.io) | [Discord](https://discord.gg/bmSAZBG) | [Forums](https://forums.pmmp.io)
close-issue: true
lock-issue: false

View File

@ -0,0 +1,49 @@
<?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);
const VERSIONS = [
"8.0"
];
$workflowFile = file_get_contents(__DIR__ . '/main.yml');
$newWorkflowFile = $workflowFile;
foreach(VERSIONS as $v){
$releaseInfo = file_get_contents("https://secure.php.net/releases?json&version=$v");
if($releaseInfo === false){
throw new \RuntimeException("Failed to contact php.net API");
}
$data = json_decode($releaseInfo, true);
if(!is_array($data) || !isset($data["version"]) || !is_string($data["version"]) || preg_match('/^\d+\.\d+\.\d+(-[A-Za-z\d]+)?$/', $data["version"]) === 0){
throw new \RuntimeException("Invalid data returned by API");
}
$updated = preg_replace("/$v\.\d+/", $data["version"], $newWorkflowFile);
if($updated !== $newWorkflowFile){
echo "Updated $v revision to " . $data["version"] . "\n";
}
$newWorkflowFile = $updated;
}
if($workflowFile !== $newWorkflowFile){
echo "Writing modified workflow file\n";
file_put_contents(__DIR__ . '/main.yml', $newWorkflowFile);
}

View File

@ -0,0 +1,45 @@
name: Update update.pmmp.io API info
on:
release:
types:
- published
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install jq
run: sudo apt update && sudo apt install jq -y
- uses: actions/checkout@v2
with:
repository: pmmp/update.pmmp.io
ssh-key: ${{ secrets.UPDATE_PMMP_IO_DEPLOY_KEY }}
- name: Get actual tag name
id: tag-name
run: echo ::set-output name=TAG_NAME::$(echo "${{ github.ref }}" | sed 's{^refs/tags/{{')
- name: Download new release information
run: curl -f -L ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ steps.tag-name.outputs.TAG_NAME }}/build_info.json -o new_build_info.json
- name: Detect channel
id: channel
run: echo ::set-output name=CHANNEL::$(jq -r '.channel' new_build_info.json)
- name: Copy release information
run: |
cp new_build_info.json channels/${{ steps.channel.outputs.CHANNEL }}.json
rm new_build_info.json
- name: Commit changes
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git diff-index --quiet HEAD || git commit -m "New ${{ steps.channel.outputs.CHANNEL }} release: ${{ github.repository }} ${{ steps.tag-name.outputs.TAG_NAME }}"
- name: Push changes
run: git push

16
.gitignore vendored
View File

@ -1,5 +1,7 @@
players/*
worlds/*
world_conversion_backups/*
backups/*
plugin_data/*
plugins/*
bin*/*
@ -10,11 +12,16 @@ crashdumps/*
*.phar
server.properties
/pocketmine.yml
/plugin_list.yml
memory_dumps/*
resource_packs/
server.lock
/phpstan.neon
# Common IDEs
.idea/
.idea/*
!.idea/codeStyles/
!.idea/fileTemplates/
nbproject/*
# Windows image file caches
@ -39,3 +46,10 @@ test_data/*
# Doxygen
Documentation/*
# PHPUnit
/.phpunit.result.cache
# php-cs-fixer
/.php_cs.cache
/.php-cs-fixer.cache

18
.gitmodules vendored
View File

@ -1,12 +1,6 @@
[submodule "src/pocketmine/lang/locale"]
path = src/pocketmine/lang/locale
url = https://github.com/pmmp/PocketMine-Language.git
[submodule "tests/preprocessor"]
path = tests/preprocessor
url = https://github.com/pmmp/preprocessor.git
[submodule "tests/plugins/PocketMine-DevTools"]
path = tests/plugins/PocketMine-DevTools
url = https://github.com/pmmp/PocketMine-DevTools.git
[submodule "src/pocketmine/resources/vanilla"]
path = src/pocketmine/resources/vanilla
url = https://github.com/pmmp/BedrockData.git
[submodule "tests/plugins/DevTools"]
path = tests/plugins/DevTools
url = https://github.com/pmmp/DevTools.git
[submodule "build/php"]
path = build/php
url = https://github.com/pmmp/php-build-scripts.git

71
.idea/codeStyles/Project.xml generated Normal file
View File

@ -0,0 +1,71 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="LINE_SEPARATOR" value="&#10;" />
<HTMLCodeStyleSettings>
<option name="HTML_TEXT_WRAP" value="0" />
<option name="HTML_DO_NOT_INDENT_CHILDREN_OF" value="thead,tbody,tfoot" />
</HTMLCodeStyleSettings>
<PHPCodeStyleSettings>
<option name="ALIGN_PHPDOC_PARAM_NAMES" value="true" />
<option name="PHPDOC_BLANK_LINES_AROUND_PARAMETERS" value="true" />
<option name="LOWER_CASE_BOOLEAN_CONST" value="true" />
<option name="LOWER_CASE_NULL_CONST" value="true" />
<option name="VARIABLE_NAMING_STYLE" value="CAMEL_CASE" />
<option name="SPACES_WITHIN_SHORT_ECHO_TAGS" value="false" />
<option name="SPACE_BEFORE_CLOSURE_LEFT_PARENTHESIS" value="false" />
<option name="FORCE_SHORT_DECLARATION_ARRAY_STYLE" value="true" />
<option name="SPACE_BEFORE_COLON_IN_RETURN_TYPE" value="true" />
</PHPCodeStyleSettings>
<editorconfig>
<option name="ENABLED" value="false" />
</editorconfig>
<codeStyleSettings language="HTML">
<indentOptions>
<option name="USE_TAB_CHARACTER" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JSON">
<indentOptions>
<option name="INDENT_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="PHP">
<option name="CLASS_BRACE_STYLE" value="1" />
<option name="METHOD_BRACE_STYLE" value="1" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="true" />
<option name="SPACE_BEFORE_IF_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_WHILE_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_FOR_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_CATCH_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_SWITCH_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_CLASS_LBRACE" value="false" />
<option name="SPACE_BEFORE_METHOD_LBRACE" value="false" />
<option name="SPACE_BEFORE_IF_LBRACE" value="false" />
<option name="SPACE_BEFORE_ELSE_LBRACE" value="false" />
<option name="SPACE_BEFORE_WHILE_LBRACE" value="false" />
<option name="SPACE_BEFORE_FOR_LBRACE" value="false" />
<option name="SPACE_BEFORE_DO_LBRACE" value="false" />
<option name="SPACE_BEFORE_SWITCH_LBRACE" value="false" />
<option name="SPACE_BEFORE_TRY_LBRACE" value="false" />
<option name="SPACE_BEFORE_CATCH_LBRACE" value="false" />
<option name="SPACE_BEFORE_FINALLY_LBRACE" value="false" />
<option name="SPACE_BEFORE_ELSE_KEYWORD" value="false" />
<option name="SPACE_BEFORE_WHILE_KEYWORD" value="false" />
<option name="SPACE_BEFORE_CATCH_KEYWORD" value="false" />
<option name="SPACE_BEFORE_FINALLY_KEYWORD" value="false" />
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
<indentOptions>
<option name="USE_TAB_CHARACTER" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="neon">
<indentOptions>
<option name="USE_TAB_CHARACTER" value="true" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View File

@ -0,0 +1,8 @@
#if(${THROWS_DOC} != "")
/**
${THROWS_DOC}
*/
#end
public function __construct(${PARAM_LIST}) {
${BODY}
}

View File

@ -0,0 +1,6 @@
/** @return $this */
public function set${NAME}(#if (${SCALAR_TYPE_HINT})${SCALAR_TYPE_HINT} #else#end$${PARAM_NAME})#if(${RETURN_TYPE}): self#else#end
{
$this->${FIELD_NAME} = $${PARAM_NAME};
return $this;
}

View File

@ -0,0 +1,3 @@
#if(${TYPE_HINT} != ${RETURN_TYPE} && ${TYPE_HINT} != "")/** @return ${TYPE_HINT} */#end
public ${STATIC} function ${GET_OR_IS}${NAME}()#if(${RETURN_TYPE}): ${RETURN_TYPE}#else#end
{ return #if(${STATIC} == "static")self::$${FIELD_NAME};#else$this->${FIELD_NAME};#end }

View File

@ -0,0 +1,2 @@
public ${STATIC} function set${NAME}(#if (${SCALAR_TYPE_HINT})${SCALAR_TYPE_HINT} #end$${PARAM_NAME})#if (${VOID_RETURN_TYPE}):void #end
{#if (${STATIC} == "static") self::$${FIELD_NAME} = $${PARAM_NAME}; #else $this->${FIELD_NAME} = $${PARAM_NAME}; #end}

View File

View File

@ -0,0 +1,21 @@
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* 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);

View File

@ -0,0 +1,5 @@
#if (${THROWS_DOC} != "")
/**
${THROWS_DOC}
*/
#end

View File

@ -0,0 +1 @@
/** @var ${TYPE_HINT} */

View File

View File

@ -0,0 +1,10 @@
<?php
#parse("PHP File Header.php")
#if (${NAMESPACE})
namespace ${NAMESPACE};
#end
final class ${NAME} {
}

View File

@ -0,0 +1,4 @@
<?php
#parse("PHP File Header.php")

View File

@ -0,0 +1,10 @@
<?php
#parse("PHP File Header.php")
#if (${NAMESPACE})
namespace ${NAMESPACE};
#end
interface ${NAME} {
}

View File

@ -0,0 +1,10 @@
<?php
#parse("PHP File Header.php")
#if (${NAMESPACE})
namespace ${NAMESPACE};
#end
trait ${NAME} {
}

83
.php-cs-fixer.php Normal file
View File

@ -0,0 +1,83 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/build')
->in(__DIR__ . '/tests')
->in(__DIR__ . '/tools')
->notPath('plugins/DevTools')
->notName('PocketMine.php');
return (new PhpCsFixer\Config)
->setRiskyAllowed(true)
->setRules([
'align_multiline_comment' => [
'comment_type' => 'phpdocs_only'
],
'array_indentation' => true,
'array_syntax' => [
'syntax' => 'short'
],
'binary_operator_spaces' => [
'default' => 'single_space'
],
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => [
'statements' => [
'declare'
]
],
'cast_spaces' => [
'space' => 'single'
],
'concat_space' => [
'spacing' => 'one'
],
'declare_strict_types' => true,
'elseif' => true,
'global_namespace_import' => [
'import_constants' => true,
'import_functions' => true,
'import_classes' => null,
],
'indentation_type' => true,
'native_function_invocation' => [
'scope' => 'namespaced',
'include' => ['@all'],
],
'no_closing_tag' => true,
'no_empty_phpdoc' => true,
'no_extra_blank_lines' => true,
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => true,
],
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_whitespace_in_blank_line' => true,
'no_unused_imports' => true,
'ordered_imports' => [
'imports_order' => [
'class',
'function',
'const',
],
'sort_algorithm' => 'alpha'
],
'phpdoc_line_span' => [
'property' => 'single',
'method' => null,
'const' => null
],
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'return_type_declaration' => [
'space_before' => 'one'
],
'single_import_per_statement' => true,
'strict_param' => true,
'unary_operator_spaces' => true,
])
->setFinder($finder)
->setIndent("\t")
->setLineEnding("\n");

View File

@ -1,25 +0,0 @@
language: php
php:
- 7.2
- 7.3
before_script:
# - pecl install channel://pecl.php.net/pthreads-3.1.6
- echo | pecl install channel://pecl.php.net/yaml-2.0.4
- git clone https://github.com/pmmp/pthreads.git
- cd pthreads
- git checkout 6ca019c58b4fa09ee2ff490f2444e34bef0773d0
- phpize
- ./configure
- make
- make install
- cd ..
- echo "extension=pthreads.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- composer install
script:
- ./tests/travis.sh -t4
notifications:
email: false

39
BUILDING.md Normal file
View File

@ -0,0 +1,39 @@
# Building
## Pre-requisites
- A bash shell (git bash is sufficient for Windows)
- [`git`](https://git-scm.com) available in your shell
- PHP 8.0 or newer available in your shell
- [`composer`](https://getcomposer.org) available in your shell
## Custom PHP binaries
Because PocketMine-MP requires several non-standard PHP extensions and configuration, PMMP provides scripts to build custom binaries for running PocketMine-MP, as well as prebuilt binaries.
- [Prebuilt binaries](https://jenkins.pmmp.io/job/PHP-8.0-Aggregate)
- [Compile scripts](https://github.com/pmmp/php-build-scripts) are provided as a submodule in the path `build/php`
If you use a custom binary, you'll need to replace `composer` usages in this guide with `path/to/your/php path/to/your/composer.phar`.
## Setting up environment
1. `git clone https://github.com/pmmp/PocketMine-MP.git`
2. `composer install`
## Checking out a different branch to build
1. `git checkout <branch to checkout>`
2. Re-run `composer install` to synchronize dependencies.
## Optimizing for release builds
1. Add the flags `--no-dev --classmap-authoritative` to your `composer install` command. This will reduce build size and improve autoloading speed.
## Building `PocketMine-MP.phar`
Run `composer make-server` 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.
There is a bug in PHP that might cause an error which looks like this:
```
Fatal error: Uncaught BadMethodCallException: unable to create temporary file in PocketMine-MP/build/server-phar.php:119
```
You can work around it by setting `ulimit -n` to some bigger number, e.g. `8192`, or by updating your PHP version to at least 8.0.3.
## Running PocketMine-MP from source code
Run `src/PocketMine.php` using your preferred PHP binary.

View File

@ -2,125 +2,102 @@
# PocketMine-MP Contribution Guidelines
PocketMine-MP is an open source project, and contributions from the community are welcomed, as long as they comply with our quality standards and licensing.
## Creating an Issue
- If you are reporting a bug:
- **make sure that you are using the latest supported version** before opening an issue.
- **test it on a clean test server, WITHOUT PLUGINS**, to see if the issue still occurs. If not then it may be a plugin issue. Please also indicate the result of such tests.
- **[Search the issue tracker](https://github.com/pmmp/PocketMine-MP/issues?utf8=%E2%9C%93&q=is%3Aissue)** to check if anyone has already reported it, to avoid needlessly creating duplicate issues. Make sure you also check closed issues, as an issue you think is valid may already have been resolved.
- **Do not report plugin issues here.** If your issue is related to a plugin, contact the plugin's original author instead.
- **Support requests are not bugs.** Issues such as "How do I do this" are not bugs and will be closed. If you need help, please see [here](README.md#discussion) and do not misuse our issue tracker.
- **No generic titles** such as "Question", "Help", "Crash Report" etc. A good issue report provides a quick summary in the title. If you just got a crash report but you don't understand it, please look for a line starting with `Message`. It summarizes the bug.
- **Provide information in the issue body, not in the title.** No tags like `[BUG]` are allowed in the title, including `[SOLVED]` for solved issues.
- **No generic issue reports.** For bugs, it is the issue author's responsibility to provide us an issue that is **trackable, debuggable, reproducible, reported professionally and is an actual bug**.
<br>Valid issue reports must include instructions how to reproduce the issue or a crashdump/backtrace (unless the cause of the issue is obvious).
<br>**If you do not provide us with a summary or instructions on how to reproduce the issue, it will be treated as spam and will therefore be closed.**
<br>In simple words, if the issue cannot be properly confirmed to be valid or lacks required information, the issue will be closed until further information is provided.
- To express appreciation, objection, confusion or other supported reactions on pull requests, issues or comments on them, use GitHub [reactions](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) rather than posting an individual comment with an emoji only. This helps keeping the issue/pull request conversation clean and readable.
- If your issue is related to the PocketMine-MP website, forums, etc., please [talk to a human directly](README.md#discussion).
Code contributions must be submitted using [GitHub Pull Requests](https://github.com/pmmp/PocketMine-MP/pulls), where they will be reviewed by maintainers.
Small contributions (e.g. minor bug fixes) can be submitted as pull requests directly.
Larger contributions like feature additions should be preceded by a [Change Proposal](#rfcs--change-proposals) to allow maintainers and other people to discuss and decide if it's a good idea or not.
## Contributing
To contribute to the repository, [fork it on GitHub](https://github.com/pmmp/PocketMine-MP/fork), create a branch on your fork, and make your changes on your fork. You can then make a [pull request](https://github.com/pmmp/PocketMine-MP/pull/new) to the project to compare your branch to ours and propose your changes to our repository. We use the Pull Request system to allow members of the team to review changes before they are merged.
## Useful documentation from github.com
- [About pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)
- [About forks](https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/about-forks)
- [Creating a pull request from a fork](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)
### Licensing
By proposing a pull request to the project, you agree to your code being distributed within PocketMine-MP under the [LGPL license](LICENSE).
## Other things you'll need
- [git](https://git-scm.com/)
### Contribution standards
- **We enforce a very high standard for contributions**. This is because PocketMine-MP and its related projects are used very widely in production. While this might seem like we are being mean at times, **our priority is what is best for PocketMine-MP itself**.
We try to ensure that our project's codebase is as clean as possible and ensure that only top-quality material makes it through to PocketMine-MP itself.
- **If a contribution does not meet our standards, changes may be requested or the pull request may be closed.**
## Making a pull request
The basic procedure to create a pull request is:
1. [Fork the repository on GitHub](https://github.com/pmmp/PocketMine-MP/fork). This gives you your own copy of the repository to make changes to.
2. Create a branch on your fork for your changes.
3. Make the changes you want to make on this branch.
4. You can then make a [pull request](https://github.com/pmmp/PocketMine-MP/pull/new) to the project.
### Pull requests
- **Create a new branch for each pull request.** Do not create a pull request with commits that exist in another pull request.
## Pull request reviews
Pull requests will be reviewed by maintainers when they are available.
Note that there might be a long wait time before a reviewer looks at your PR.
Depending on the changes, maintainers might ask you to make changes to the PR to fix problems or to improve the code.
**Do not delete your fork** while your pull request remains open, otherwise you won't be able to make any requested changes and the PR will end up being declined.
### Requirements
The following are required as a minimum for pull requests. PRs that don't meet these requirements will be declined unless updated to meet them.
#### Licensing
PocketMine-MP is licensed under [LGPLv3 license](LICENSE).
By proposing a pull request, you agree to your code being distributed within PocketMine-MP under the same license.
If you take code from other projects, that code MUST be licensed under an LGPL-compatible license.
#### PRs should be about exactly ONE thing
If you want to make multiple changes, those changes should each be contributed as separate pull requests. **DO NOT** mix unrelated changes.
#### PRs must not include unnecessary/unrelated changes
Do not include changes which aren't strictly necessary. This makes it harder to review a PR, because the code diff becomes larger and harder to review.
This means:
- don't reformat or rearrange existing code
- don't change things that aren't related to the PR's objective
- don't rewrite existing code just to make it "look nicer"
- don't change PhpDocs to native types in code you didn't write
#### Tests must be provided
Where possible, PHPUnit tests should be written for new or changed code.
If that's not possible (e.g. for in-game functionality), the code must be tested manually and details of the tests done must be provided.
**Simply saying "Tested" is not acceptable** and will lead to your PR being declined.
#### Comments and documentation must be written in American English
English is the shared languages of all current maintainers.
#### Code must be in the PocketMine-MP style
It's your responsibility to ensure your code matches the formatting and styling of the rest of the code.
If you use PhpStorm, a `Project` code style is provided, which you can use to automatically format new code.
You can also use [`php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to format your code.
### Recommendations
- **Do not edit code directly on github.com.** We recommend learning how to use [`git`](https://git-scm.com). `git` allows you to "clone" a repository onto your computer, so that you can make changes using an IDE.
- **Use an IDE, not a text editor.** We recommend PhpStorm or VSCode.
- **Create a new branch on your fork for each pull request.** This allows you to use the same fork to make multiple pull requests at the same time.
- **Use descriptive commit titles.** You can see an example [here](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
- **Do not include multiple unrelated changes in one commit.** An atomic style for commits is preferred - this means that changes included in a commit should be part of a single distinct change set. See [this link](https://www.freshconsulting.com/atomic-commits/) for more information on atomic commits. See the [documentation on `git add`](https://git-scm.com/docs/git-add) for information on how to isolate local changes for committing.
- **Your pull request will be checked and discussed in due time.** Since the team is scattered all around the world, your PR may not receive any attention for some time.
- **It is inadvisable to create large pull requests with lots of changes** unless this has been discussed with the team beforehand. Large pull requests are difficult to review, and such pull requests may end up being closed. The only exception is when all features in the pull request are related to each other, and share the same core changes.
- **You may be asked to rebase your pull request** if the branch becomes outdated and/or if possibly conflicting changes are made to the target branch. To see how to do this, read [this page](https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request).
- **Details should be provided of tests done.** Simply saying "Tested" or equivalent is not acceptable.
### Code contributions
- **Avoid committing changes directly on GitHub. This includes use of the web editor, and also uploading files.** The web editor lacks most useful GIT features and **should only be used for very minor changes**. It is immediately clear if the web editor has been used, and if so the PR is more likely to be rejected. If you want to make serious contributions, **please learn how to use [GIT version control](https://git-scm.com/)**.
- **Do not copy-paste code**. There are potential license issues implicit with copy-pasting, and copy-paste usually indicates a lack of understanding of the actual code. Copy-pasted code is obvious a mile off and **any PR like this is likely to be closed**. If you want to use somebody else's code from a Git repository, **use [GIT's cherry-pick feature](https://git-scm.com/docs/git-cherry-pick)** to cherry-pick the commit. **Cherry-picking is the politer way to copy somebody's changes** and retains all the original accreditation, so there is no need for copy-pasted commits with descriptions like `Some code, thanks @exampleperson`.
- **Make sure you can explain your changes**. If you can't provide a good explanation of changes, your PR may be rejected.
- **Code should use the same style as in PocketMine-MP.** See [below](#code-syntax) for an example.
- **The code must be clear** and written in English, comments included.
- **Do not make large pull requests without an RFC.** Large changes should be discussed beforehand using the [RFC / Change Proposal](#rfcs--change-proposals) process. Large changes are much harder to review and are more likely to be declined if maintainers don't have a good idea what you're trying to do in advance.
- **Do not copy-paste code**. There are potential license issues implicit with copy-pasting, and copy-paste usually indicates a lack of understanding of the actual code. Copy-pasted code is obvious a mile off and **any PR like this is likely to be closed**. If you want to use somebody else's code from a Git repository, **use [GIT's cherry-pick feature](https://git-scm.com/docs/git-cherry-pick)** to cherry-pick the commit.
**Thanks for contributing to PocketMine-MP!**
## RFCs / Change Proposals
Change Proposals are issues or discussions which describe a new feature proposal or behavioural change.
They are used to get feedback from maintainers and the community about an idea for a change, to decide whether or not it's a good idea.
### Submitting an RFC
RFCs should be submitted using Issues or Discussions.
RFCs _can_ be submitted as pull requests if you've already written the code, but this is not recommended, since it's not guaranteed that an RFC will pass, in which case your effort would be wasted.
### Code Syntax
RFCs should include the following:
- A summary of what you want to change
- Why you want to change it (e.g. what problems it solves)
- Alternative methods you've considered to solve the problem. This should include any possible ways that what you want can be done without the change.
It is mainly [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) with a few exceptions.
### Voting on RFCs
Community members can vote on RFCs. This gives maintainers an idea of how popular the idea is.
Votes can be cast using :+1: and :-1: reactions.
- Opening braces MUST go on the same line, and MUST NOT have spaces before.
- `else if` MUST be written as `elseif`. _(It is in PSR-2, but using a SHOULD)_
- Control structure keywords or opening braces MUST NOT have one space before or after them.
- Code MUST use tabs for indenting.
- Long arrays MAY be split across multiple lines, where each subsequent line is indented once.
- Files MUST use only the `<?php` tag.
- Files MUST NOT have an ending `?>` tag.
- Code MUST use namespaces.
- Strings SHOULD use the double quote `"` except when the single quote is required.
- All code SHOULD have parameter and type declarations where possible.
- Strict types SHOULD be enabled on new files where it is sensible to do so.
- All constant declarations SHOULD be preceded by a visibility modifier.
**Please don't downvote without providing a reason why!**
```php
<?php
### Implementing RFCs
Anyone can write the code to implement an RFC, and submit a pull request for it. It doesn't have to be the RFC author.
declare(strict_types=1);
namespace pocketmine\example;
class ExampleClass{
public const EXAMPLE_CLASS_CONSTANT = 1;
public $examplePublicVariable = "defaultValue";
private $examplePrivateVariable;
/**
* Creates an instance of ExampleClass
*
* @param string $firstArgument the first argument
* @param string|null $secondArgument default null
*/
public function __construct(string $firstArgument, ?string &$secondArgument = null){
if($firstArgument === "exampleValue"){ //Remember to use === instead of == when possible
//do things
}elseif($firstArgument === "otherValue"){
$secondArgument = function(){
$this->examplePrivateVariable = [
0 => "value1",
1 => "value2",
2 => "value3",
3 => "value4",
4 => "value5",
5 => "value6",
];
};
}
}
public function doStuff(string $stuff) : string{
return $stuff;
}
}
```
<!-- TODO: RFC and voting on the forums instead -->
### RFC and Voting
* These are big Pull Requests or contributions that change important behavior.
* RFCs will be tagged with the *PR: RFC* label
* A vote will be held once the RFC is ready. All users can vote commenting on the Pull Request
* Comments MUST use "Yes" or "No" on the FIRST sentence to signify the vote, except when they don't want it to be counted.
* If your comment is a voting comment, specify the reason of your vote or it won't be counted.
* After voting has been closed, no further votes will be counted.
* An RFC will be rejected if less than 50% + 1 (simple majority) has voted Yes.
* If the RFC is approved, Team Members have the final word on its implementation or rejection.
* RFCs with complex voting options will specify the vote percentage or other details.
Implementations should be submitted as pull requests. The pull request description must include a link to the RFC.

View File

@ -1,45 +1,44 @@
# [![PocketMine-MP](http://cdn.pocketmine.net/img/PocketMine-MP-h.png)](https://pmmp.io)
<p align="center">
<a href="https://pmmp.io"><img src="http://cdn.pocketmine.net/img/PocketMine-MP-h.png"></img></a><br>
<b>A highly customisable, open source server software for Minecraft: Bedrock Edition written in PHP</b>
</p>
__A highly customisable, open source server software for Minecraft: Bedrock Edition written in PHP__
<p align="center">
<img src="https://github.com/pmmp/PocketMine-MP/workflows/CI/badge.svg" alt="CI" />
<img alt="GitHub release (latest SemVer)" src="https://img.shields.io/github/v/release/pmmp/PocketMine-MP?label=release&sort=semver">
<a href="https://hub.docker.com/r/pmmp/pocketmine-mp"><img src="https://img.shields.io/docker/v/pmmp/pocketmine-mp?logo=docker&label=image" alt="Docker image version (latest semver)" /></a>
<a href="https://discord.gg/bmSAZBG"><img src="https://img.shields.io/discord/373199722573201408?label=discord&color=7289DA&logo=discord" alt="Discord" /></a>
<br>
<img alt="GitHub all releases" src="https://img.shields.io/github/downloads/pmmp/PocketMine-MP/total?label=downloads%40total">
<img alt="GitHub release (latest by SemVer)" src="https://img.shields.io/github/downloads/pmmp/PocketMine-MP/latest/total?sort=semver">
</p>
[![Build Status](https://travis-ci.org/pmmp/PocketMine-MP.svg?branch=master)](https://travis-ci.org/pmmp/PocketMine-MP)
## Getting started
- [Documentation](http://pmmp.readthedocs.org/)
- [Installation instructions](https://pmmp.readthedocs.io/en/rtfd/installation.html)
- [Docker image](https://hub.docker.com/r/pmmp/pocketmine-mp)
- [Plugin repository](https://poggit.pmmp.io/plugins)
### Setup, help & support, FAQs
Head over to the [documentation site](http://pmmp.readthedocs.org/).
If you don't find what you're looking for there, [talk to a human](#discussion). Please do not use our issue tracker for support requests.
### Discussion
## Discussion/Help
- [Forums](https://forums.pmmp.io/)
- [Discord](https://discord.gg/bmSAZBG)
- [StackOverflow](https://stackoverflow.com/tags/pocketmine)
### Plugins
There are a very wide range of already-written plugins available which you can use to customise your server. Check out [Poggit](https://poggit.pmmp.io), or just search GitHub.
### For developers
## For developers
* [Building and running from source](BUILDING.md)
* [Developer documentation](https://devdoc.pmmp.io) - General documentation for PocketMine-MP plugin developers
* [Latest API documentation](https://jenkins.pmmp.io/job/PocketMine-MP-doc/doxygen/) - Doxygen documentation generated from development
* [DevTools](https://github.com/pmmp/PocketMine-DevTools/) - A development tools plugin for creating plugins.
* [DevTools](https://github.com/pmmp/DevTools/) - Development tools plugin for creating plugins
* [ExamplePlugin](https://github.com/pmmp/ExamplePlugin/) - Example plugin demonstrating some basic API features
* [Contributing Guidelines](CONTRIBUTING.md)
### Can I contribute?
Yes you can! Contributions are welcomed provided that they comply with our [Contributing Guidelines](CONTRIBUTING.md). Please ensure you read the relevant sections of the guidelines carefully before making a Pull Request or opening an Issue.
### Where can I get the latest .phar?
- Latest release builds can be found in our [GitHub releases](https://github.com/pmmp/PocketMine-MP/releases).
- Latest bleeding-edge development builds (and other builds in the build job channels) can be found on our [Jenkins server](https://jenkins.pmmp.io/).
**Note: Please avoid development builds unless there is no other alternative for what you need.** Development builds are subject to changes at any time without notice, and it is likely that your server or plugins might break without warning.
## Donate
- Bitcoin Cash (BCH): `qq3r46hn6ljnhnqnfwxt5pg3g447eq9jhvw5ddfear`
- Bitcoin (BTC): `171u8K9e4FtU6j3e5sqNoxKUgEw9qWQdRV`
- Stellar Lumens (XLM): `GAAC5WZ33HCTE3BFJFZJXONMEIBNHFLBXM2HJVAZHXXPYA3HP5XPPS7T`
- [Patreon](https://www.patreon.com/pocketminemp)
## Licensing information
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
This project is licensed under LGPL-3.0. Please see the [LICENSE](/LICENSE) file for details.
pmmp/PocketMine are not affiliated with Mojang. All brands and trademarks belong to their respective owners. PocketMine-MP is not a Mojang-approved software, nor is it associated with Mojang.

25
SECURITY.md Normal file
View File

@ -0,0 +1,25 @@
# Security Policy
## Reporting a Vulnerability
**DO NOT report vulnerabilities on the GitHub issue tracker.**
GitHub is public and anyone can see the issues you post on the issue tracker, including people who would exploit vulnerabilities for their own gain.
**WARNING: You may put live servers at risk by reporting a vulnerability on the GitHub issue tracker.**
**Contact us** by sending an email to [**team@pmmp.io**](mailto:team@pmmp.io?subject=Security%20Vulnerability%20in%20PocketMine-MP). Include the following information:
- Version of PocketMine-MP
- Detailed description of the vulnerability (e.g. how to exploit it, what the effects are)
Please note that we can't guarantee a reply to every email.
## FAQ
### Do you offer a bug bounty?
No.
### How soon can I expect a fix for a vulnerability I've reported?
This depends on the nature of the problem. We can't provide any general ETA (nor would it be wise to provide one).
In general, it depends on when developers have time to look into the problem, how complex the problem is to fix, and how many users it impacts.
When a fix for a severe vulnerability is pushed, a patch release for the target version will usually be released within 24 hours so that users can update.

View File

@ -0,0 +1,43 @@
<?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);
require dirname(__DIR__) . '/vendor/autoload.php';
if(count($argv) !== 5){
fwrite(STDERR, "required args: <git hash> <tag name> <github repo (owner/name)> <build number>");
exit(1);
}
echo json_encode([
"php_version" => sprintf("%d.%d", PHP_MAJOR_VERSION, PHP_MINOR_VERSION),
"base_version" => \pocketmine\VersionInfo::BASE_VERSION,
"build" => (int) $argv[4],
"is_dev" => \pocketmine\VersionInfo::IS_DEVELOPMENT_BUILD,
"channel" => \pocketmine\VersionInfo::BUILD_CHANNEL,
"git_commit" => $argv[1],
"mcpe_version" => \pocketmine\network\mcpe\protocol\ProtocolInfo::MINECRAFT_VERSION_NETWORK,
"date" => time(), //TODO: maybe we should embed this in VersionInfo?
"details_url" => "https://github.com/$argv[3]/releases/tag/$argv[2]",
"download_url" => "https://github.com/$argv[3]/releases/download/$argv[2]/PocketMine-MP.phar",
"source_url" => "https://github.com/$argv[3]/tree/$argv[2]",
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";

View File

@ -0,0 +1,193 @@
<?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\build\generate_known_translation_apis;
use pocketmine\lang\Translatable;
use pocketmine\utils\Utils;
use Webmozart\PathUtil\Path;
use function array_map;
use function count;
use function dirname;
use function file_put_contents;
use function fwrite;
use function implode;
use function is_numeric;
use function ksort;
use function ob_get_clean;
use function ob_start;
use function parse_ini_file;
use function preg_match_all;
use function str_replace;
use function strtoupper;
use const INI_SCANNER_RAW;
use const SORT_NUMERIC;
use const SORT_STRING;
use const STDERR;
require dirname(__DIR__) . '/vendor/autoload.php';
function constantify(string $permissionName) : string{
return strtoupper(str_replace([".", "-"], "_", $permissionName));
}
function functionify(string $permissionName) : string{
return str_replace([".", "-"], "_", $permissionName);
}
const SHARED_HEADER = <<<'HEADER'
<?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\lang;
HEADER;
/**
* @param string[] $languageDefinitions
* @phpstan-param array<string, string> $languageDefinitions
*/
function generate_known_translation_keys(array $languageDefinitions) : void{
ob_start();
echo SHARED_HEADER;
echo <<<'HEADER'
/**
* This class contains constants for all the translations known to PocketMine-MP as per the used version of pmmp/Language.
* This class is generated automatically, do NOT modify it by hand.
*
* @internal
*/
final class KnownTranslationKeys{
HEADER;
ksort($languageDefinitions, SORT_STRING);
foreach(Utils::stringifyKeys($languageDefinitions) as $k => $_){
echo "\tpublic const ";
echo constantify($k);
echo " = \"" . $k . "\";\n";
}
echo "}\n";
file_put_contents(dirname(__DIR__) . '/src/lang/KnownTranslationKeys.php', ob_get_clean());
echo "Done generating KnownTranslationKeys.\n";
}
/**
* @param string[] $languageDefinitions
* @phpstan-param array<string, string> $languageDefinitions
*/
function generate_known_translation_factory(array $languageDefinitions) : void{
ob_start();
echo SHARED_HEADER;
echo <<<'HEADER'
/**
* This class contains factory methods for all the translations known to PocketMine-MP as per the used version of
* pmmp/Language.
* This class is generated automatically, do NOT modify it by hand.
*
* @internal
*/
final class KnownTranslationFactory{
HEADER;
ksort($languageDefinitions, SORT_STRING);
$parameterRegex = '/{%(.+?)}/';
$translationContainerClass = (new \ReflectionClass(Translatable::class))->getShortName();
foreach(Utils::stringifyKeys($languageDefinitions) as $key => $value){
$parameters = [];
$allParametersPositional = true;
if(preg_match_all($parameterRegex, $value, $matches) > 0){
foreach($matches[1] as $parameterName){
if(is_numeric($parameterName)){
$parameters[$parameterName] = "param$parameterName";
}else{
$parameters[$parameterName] = $parameterName;
$allParametersPositional = false;
}
}
}
if($allParametersPositional){
ksort($parameters, SORT_NUMERIC);
}
echo "\tpublic static function " .
functionify($key) .
"(" . implode(", ", array_map(fn(string $paramName) => "$translationContainerClass|string \$$paramName", $parameters)) . ") : $translationContainerClass{\n";
echo "\t\treturn new $translationContainerClass(KnownTranslationKeys::" . constantify($key) . ", [";
foreach($parameters as $parameterKey => $parameterName){
echo "\n\t\t\t";
if(!is_numeric($parameterKey)){
echo "\"$parameterKey\"";
}else{
echo $parameterKey;
}
echo " => \$$parameterName,";
}
if(count($parameters) !== 0){
echo "\n\t\t";
}
echo "]);\n\t}\n\n";
}
echo "}\n";
file_put_contents(dirname(__DIR__) . '/src/lang/KnownTranslationFactory.php', ob_get_clean());
echo "Done generating KnownTranslationFactory.\n";
}
$lang = parse_ini_file(Path::join(\pocketmine\LOCALE_DATA_PATH, "eng.ini"), false, INI_SCANNER_RAW);
if($lang === false){
fwrite(STDERR, "Missing language files!\n");
exit(1);
}
generate_known_translation_keys($lang);
generate_known_translation_factory($lang);

View File

@ -0,0 +1,119 @@
<?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\build\update_registry_annotations;
use function basename;
use function class_exists;
use function count;
use function dirname;
use function file_get_contents;
use function file_put_contents;
use function implode;
use function ksort;
use function mb_strtoupper;
use function preg_match;
use function sprintf;
use function str_replace;
use function substr;
use const SORT_STRING;
if(count($argv) !== 2){
die("Provide a path to process");
}
/**
* @param object[] $members
*/
function generateMethodAnnotations(string $namespaceName, array $members) : string{
$selfName = basename(__FILE__);
$lines = ["/**"];
$lines[] = " * This doc-block is generated automatically, do not modify it manually.";
$lines[] = " * This must be regenerated whenever registry members are added, removed or changed.";
$lines[] = " * @see build/$selfName";
$lines[] = " * @generate-registry-docblock";
$lines[] = " *";
static $lineTmpl = " * @method static %2\$s %s()";
$memberLines = [];
foreach($members as $name => $member){
$reflect = new \ReflectionClass($member);
while($reflect !== false and $reflect->isAnonymous()){
$reflect = $reflect->getParentClass();
}
if($reflect === false){
$typehint = "object";
}elseif($reflect->getNamespaceName() === $namespaceName){
$typehint = $reflect->getShortName();
}else{
$typehint = '\\' . $reflect->getName();
}
$accessor = mb_strtoupper($name);
$memberLines[$accessor] = sprintf($lineTmpl, $accessor, $typehint);
}
ksort($memberLines, SORT_STRING);
foreach($memberLines as $line){
$lines[] = $line;
}
$lines[] = " */";
return implode("\n", $lines);
}
require dirname(__DIR__) . '/vendor/autoload.php';
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($argv[1], \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME)) as $file){
if(substr($file, -4) !== ".php"){
continue;
}
$contents = file_get_contents($file);
if($contents === false){
throw new \RuntimeException("Failed to get contents of $file");
}
if(preg_match("/(*ANYCRLF)^namespace (.+);$/m", $contents, $matches) !== 1 || preg_match('/(*ANYCRLF)^((final|abstract)\s+)?class /m', $contents) !== 1){
continue;
}
$shortClassName = basename($file, ".php");
$className = $matches[1] . "\\" . $shortClassName;
if(!class_exists($className)){
continue;
}
$reflect = new \ReflectionClass($className);
$docComment = $reflect->getDocComment();
if($docComment === false || preg_match("/(*ANYCRLF)^\s*\*\s*@generate-registry-docblock$/m", $docComment) !== 1){
continue;
}
echo "Found registry in $file\n";
$replacement = generateMethodAnnotations($matches[1], $className::getAll());
$newContents = str_replace($docComment, $replacement, $contents);
if($newContents !== $contents){
echo "Writing changed file $file\n";
file_put_contents($file, $newContents);
}else{
echo "No changes made to file $file\n";
}
}

136
build/make-release.php Normal file
View File

@ -0,0 +1,136 @@
<?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\build\make_release;
use pocketmine\utils\Utils;
use pocketmine\utils\VersionString;
use pocketmine\VersionInfo;
use function array_keys;
use function array_map;
use function dirname;
use function fgets;
use function file_get_contents;
use function file_put_contents;
use function fwrite;
use function getopt;
use function is_string;
use function max;
use function preg_replace;
use function sleep;
use function sprintf;
use function str_pad;
use function strlen;
use function system;
use const STDERR;
use const STDIN;
use const STDOUT;
use const STR_PAD_LEFT;
require_once dirname(__DIR__) . '/vendor/autoload.php';
function replaceVersion(string $versionInfoPath, string $newVersion, bool $isDev, string $channel) : void{
$versionInfo = file_get_contents($versionInfoPath);
$versionInfo = preg_replace(
$pattern = '/^([\t ]*public )?const BASE_VERSION = "(\d+)\.(\d+)\.(\d+)(?:-(.*))?";$/m',
'$1const BASE_VERSION = "' . $newVersion . '";',
$versionInfo
);
$versionInfo = preg_replace(
'/^([\t ]*public )?const IS_DEVELOPMENT_BUILD = (?:true|false);$/m',
'$1const IS_DEVELOPMENT_BUILD = ' . ($isDev ? 'true' : 'false') . ';',
$versionInfo
);
$versionInfo = preg_replace(
'/^([\t ]*public )?const BUILD_CHANNEL = ".*";$/m',
'$1const BUILD_CHANNEL = "' . $channel . '";',
$versionInfo
);
file_put_contents($versionInfoPath, $versionInfo);
}
const ACCEPTED_OPTS = [
"current" => "Version to insert and tag",
"next" => "Version to put in the file after tagging",
"channel" => "Release channel to post this build into"
];
function main() : void{
$filteredOpts = [];
foreach(Utils::stringifyKeys(getopt("", ["current:", "next:", "channel:", "help"])) as $optName => $optValue){
if($optName === "help"){
fwrite(STDOUT, "Options:\n");
$maxLength = max(array_map(fn(string $str) => strlen($str), array_keys(ACCEPTED_OPTS)));
foreach(ACCEPTED_OPTS as $acceptedName => $description){
fwrite(STDOUT, str_pad("--$acceptedName", $maxLength + 4, " ", STR_PAD_LEFT) . ": $description\n");
}
exit(0);
}
if(!is_string($optValue)){
fwrite(STDERR, "--$optName expects exactly 1 value\n");
exit(1);
}
$filteredOpts[$optName] = $optValue;
}
if(isset($filteredOpts["current"])){
$currentVer = new VersionString($filteredOpts["current"]);
}else{
$currentVer = new VersionString(VersionInfo::BASE_VERSION);
}
if(isset($filteredOpts["next"])){
$nextVer = new VersionString($filteredOpts["next"]);
}else{
$nextVer = new VersionString(sprintf(
"%u.%u.%u",
$currentVer->getMajor(),
$currentVer->getMinor(),
$currentVer->getPatch() + 1
));
}
$channel = $filteredOpts["channel"] ?? VersionInfo::BUILD_CHANNEL;
echo "About to tag version $currentVer. Next version will be $nextVer.\n";
echo "$currentVer will be published on release channel \"$channel\".\n";
echo "please add appropriate notes to the changelog and press enter...";
fgets(STDIN);
system('git add "' . dirname(__DIR__) . '/changelogs"');
system('git diff --cached --quiet "' . dirname(__DIR__) . '/changelogs"', $result);
if($result === 0){
echo "error: no changelog changes detected; aborting\n";
exit(1);
}
$versionInfoPath = dirname(__DIR__) . '/src/VersionInfo.php';
replaceVersion($versionInfoPath, $currentVer->getBaseVersion(), false, $channel);
system('git commit -m "Release ' . $currentVer->getBaseVersion() . '" --include "' . $versionInfoPath . '"');
system('git tag ' . $currentVer->getBaseVersion());
replaceVersion($versionInfoPath, $nextVer->getBaseVersion(), true, $channel);
system('git add "' . $versionInfoPath . '"');
system('git commit -m "' . $nextVer->getBaseVersion() . ' is next" --include "' . $versionInfoPath . '"');
echo "pushing changes in 5 seconds\n";
sleep(5);
system('git push origin HEAD ' . $currentVer->getBaseVersion());
}
main();

1
build/php Submodule

Submodule build/php added at bd329dba08

183
build/server-phar.php Normal file
View File

@ -0,0 +1,183 @@
<?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\build\server_phar;
use pocketmine\utils\Git;
use function array_map;
use function count;
use function dirname;
use function file_exists;
use function getcwd;
use function getopt;
use function implode;
use function ini_get;
use function microtime;
use function preg_quote;
use function realpath;
use function round;
use function rtrim;
use function sprintf;
use function str_replace;
use function unlink;
use const PHP_EOL;
require dirname(__DIR__) . '/vendor/autoload.php';
/**
* @param string[] $strings
*
* @return string[]
*/
function preg_quote_array(array $strings, string $delim) : array{
return array_map(function(string $str) use ($delim) : string{ return preg_quote($str, $delim); }, $strings);
}
/**
* @param string[] $includedPaths
* @param mixed[] $metadata
* @phpstan-param array<string, mixed> $metadata
*
* @return \Generator|string[]
*/
function buildPhar(string $pharPath, string $basePath, array $includedPaths, array $metadata, string $stub, int $signatureAlgo = \Phar::SHA1, ?int $compression = null){
$basePath = rtrim(str_replace("/", DIRECTORY_SEPARATOR, $basePath), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$includedPaths = array_map(function(string $path) : string{
return rtrim(str_replace("/", DIRECTORY_SEPARATOR, $path), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
}, $includedPaths);
yield "Creating output file $pharPath";
if(file_exists($pharPath)){
yield "Phar file already exists, overwriting...";
try{
\Phar::unlinkArchive($pharPath);
}catch(\PharException $e){
//unlinkArchive() doesn't like dodgy phars
unlink($pharPath);
}
}
yield "Adding files...";
$start = microtime(true);
$phar = new \Phar($pharPath);
$phar->setMetadata($metadata);
$phar->setStub($stub);
$phar->setSignatureAlgorithm($signatureAlgo);
$phar->startBuffering();
//If paths contain any of these, they will be excluded
$excludedSubstrings = preg_quote_array([
realpath($pharPath), //don't add the phar to itself
], '/');
$folderPatterns = preg_quote_array([
DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR,
DIRECTORY_SEPARATOR . '.' //"Hidden" files, git dirs etc
], '/');
//Only exclude these within the basedir, otherwise the project won't get built if it itself is in a directory that matches these patterns
$basePattern = preg_quote(rtrim($basePath, DIRECTORY_SEPARATOR), '/');
foreach($folderPatterns as $p){
$excludedSubstrings[] = $basePattern . '.*' . $p;
}
$regex = sprintf('/^(?!.*(%s))^%s(%s).*/i',
implode('|', $excludedSubstrings), //String may not contain any of these substrings
preg_quote($basePath, '/'), //String must start with this path...
implode('|', preg_quote_array($includedPaths, '/')) //... and must be followed by one of these relative paths, if any were specified. If none, this will produce a null capturing group which will allow anything.
);
$directory = new \RecursiveDirectoryIterator($basePath, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS | \FilesystemIterator::CURRENT_AS_PATHNAME); //can't use fileinfo because of symlinks
$iterator = new \RecursiveIteratorIterator($directory);
$regexIterator = new \RegexIterator($iterator, $regex);
$count = count($phar->buildFromIterator($regexIterator, $basePath));
yield "Added $count files";
if($compression !== null){
yield "Compressing files...";
$phar->compressFiles($compression);
yield "Finished compression";
}
$phar->stopBuffering();
yield "Done in " . round(microtime(true) - $start, 3) . "s";
}
function main() : void{
if(ini_get("phar.readonly") == 1){
echo "Set phar.readonly to 0 with -dphar.readonly=0" . PHP_EOL;
exit(1);
}
if(file_exists(dirname(__DIR__) . '/vendor/phpunit')){
echo "Remove Composer dev dependencies before building (composer install --no-dev)" . PHP_EOL;
exit(1);
}
$opts = getopt("", ["out:", "git:", "build:"]);
if(isset($opts["git"])){
$gitHash = $opts["git"];
}else{
$gitHash = Git::getRepositoryStatePretty(dirname(__DIR__));
echo "Git hash detected as $gitHash" . PHP_EOL;
}
if(isset($opts["build"])){
$build = (int) $opts["build"];
}else{
$build = 0;
}
foreach(buildPhar(
$opts["out"] ?? getcwd() . DIRECTORY_SEPARATOR . "PocketMine-MP.phar",
dirname(__DIR__) . DIRECTORY_SEPARATOR,
[
'resources',
'src',
'vendor'
],
[
'git' => $gitHash,
'build' => $build
],
<<<'STUB'
<?php
$tmpDir = sys_get_temp_dir();
if(!is_readable($tmpDir) or !is_writable($tmpDir)){
echo "ERROR: tmpdir $tmpDir is not accessible." . PHP_EOL;
echo "Check that the directory exists, and that the current user has read/write permissions for it." . PHP_EOL;
echo "Alternatively, set 'sys_temp_dir' to a different directory in your php.ini file." . PHP_EOL;
exit(1);
}
require("phar://" . __FILE__ . "/src/PocketMine.php");
__HALT_COMPILER();
STUB
,
\Phar::SHA1,
\Phar::GZ
) as $line){
echo $line . PHP_EOL;
}
}
main();

182
changelogs/1.3.md Normal file
View File

@ -0,0 +1,182 @@
# 1.3.3
- Minecraft: Pocket Edition alpha 0.7.2 compatible!
- Unicode support
- Fixed /difficulty command
- Fixed a few flying kicks
- Fixed async. operations thread
- Added whitelist enabled property to Query
# 1.3.4
**This is a compatibility update for Minecraft: Pocket Edition v0.7.3 alpha.**
Double chests do not work yet, we will fix more bugs and add them when MCPE 0.7.4 is released. There were too many bugs in 0.7.3 to test double chests properly.
#### Including in this release:
- Fixed armor crash
- Fixed ghost armor
- Fixed packets being received after player disconnection
- Fixed player count bug
- Added compatibility with encrypted login
- Fixed flying check on fences
- Fixed players connecting with empty usernames
- Fixed several crashes related to Items
- Added temporal water flowing. Really buggy
- Automatic recovery of index-corrupted maps
- Fixed hotbar reset when changing armor
- Fixed some hotbar reset bugs on block placement
- Added basic tool durability and breaking
- Chests now have opening/closing animation.
- Fixed /difficulty
- In-game player list is now handled correctly
- Player entities are saved in all worlds to remove join/leave spam
- Quartz slabs
# 1.3.5
#### Including in this release:
- Fixed block durability (blocks being replaced)
- Added armor replacing (changing the armor while you have other)
- Added proper Player object cleanups as a fix to a memory leak
# 1.3.7
**This update is compatible with Minecraft: Pocket Edition v0.7.4 alpha.** Older versions won't work.
In Minecraft: PE 0.7.4 you can add External servers directly. [How to add servers](https://github.com/PocketMine/PocketMine-MP/wiki/How-to-add-servers)
![](http://i.imgur.com/ltBJgmUl.png)
### Changelog
- **Updated for 0.7.4 alpha**
- **New API version 10**
- Adds Tile methods
- Changes message events to use new Minecraft protocol
- Added Level::getSafeSpawn()
- Linux now uses PHP 5.5.3
- Removed water updating
- Fixes for Player teleporting
- Removed invalid Cookie and fish items
- Fixed Stone brick and quartz slab recipes
- Shears now are used to drop leaves
- Fixed a crash on Windows XP
- Cake is removed when the bottom block is broken
- Added new NBT parser/writer
- Fixed chests and furnaces drops when broken.
- Fixed signs not spawning on world load
- Fixed actions not being deleted (memory leak)
- Chests now are spawned correctly
- Double chests
- Added random x,z offset to item drops
# 1.3.8
This release consists of a few bugfixes and several features added. It is compatible with MCPE 0.7.4 and 0.7.5
**Changelog:**
- No API changes
- Fixed x,y,z indexes when opening a Furnace
- Fixed invalid fix for CPU usage limiter on idle
- Fixed cross-compiling
- Fixed some Stonecutter recipes
- Fixed a few items stack sizes
- Fixed TimeAPI bugs
- Forces position on teleport, blocks fast teleport mods
- Fixed some blocks havin a send lag on place/break
- Fixed Sign Posts not deleting the Tile data when broken by update
- Fixed Ice converting to Water on creative mode
- Added beds
- Added scheduled teleport on spawn to fix spawning underground
- Added date to console logs
# 1.3.9
This release is compatible with MCPE 0.7.4 and 0.7.5.
**Changelog:**
- Fixed server crash related to beds
- Player movement is less laggy
- Added new text formatting system for future updates
- New Terminal Emulator for Windows
- More colors! Less warnings!
# 1.3.10
**Changelog:**
- Added door sounds
- Fixed bed sleeping position offset
- Added explosions
- Flint & Steel on Creative Mode (replaces Eggs)
- Changed the Sword and Hoe to the diamond tier on the Creative inventory
- Fixed colors on MacOS
- Water flow
- Fixed Windows console input not being accepted when using special keys
- Added a way to disable console colors
- Updated PHP to 5.5.6, pthreads to 0.0.55, and cURL
- Armor drops
- Fixed plugin issues
- Fixed some block drops
- Fixed a crash when @all is used in console, and only usable for OPs
- Fixed some issues regarding teleporting
- deop no longer op the player again
# 1.3.11
And here it comes the stable release for **MCPE v0.8.1 alpha**. We decided to remove the improved networking that was delaying this release, but you should see it in the next one. Minecarts couldn't be added for the same reason as mobs, but we will try to implement "fake" minecarts that behave correctly inside rails, but not outside of them.
Starting with this release, all PocketMine-MP versions will be given a codename. This one received the codename 「甘いビートルート」_(Amai Beetroot)_.
**Changelog:**
- Fixed existing Packets of Death
- Fixed lots of bugs related to crafting
- Fixed block placement bugs
- Redstone ore drops redstone dust
- Sideway logs
- Sponges
- Added new wooden planks & stairs
- Added iron bars, cobblestone walls and pumpkins
- Added carpets, hay bales and coal blocks
- Added potatoes, carrots and beetroots
- Additional tall grass drops
- Achievements
- Added multiple orders for _/gamemode_ command
- Chat plugins can work with each other #975
- Fixed internal world chunks bug
- Private messages are now hidden on console except when the console is the target/origin
- PHP plugins are now loaded with include()
- Fixed plugin paths
- Added source SHA1 sum to crash reports
- Added Level::startTime() and Level::stopTime()
- Fixed server not being able to start on several OS when offline
- More small fixes and small additions
For more information, check the [complete changelog](https://github.com/PocketMine/PocketMine-MP/compare/Alpha_1.3.10...Alpha_1.3.11).
# 1.3.12
Before starting to rewrite even more parts of the code, we are releasing the last version of the Alpha_1.3.x Amai Beetroot「甘いビートルート」. Next one will be Alpha_1.4 with more rewrite!
We have included the new Event API that will be used on the next release, but now it is only used to hook on packets.
**API Changelog:**
- **Full network rewrite.** Plugins can work with packets easily now.
- **New Event API,** only implemented for packets right now.
- Added player.block.place.bypass and player.block.break.bypass
- Level included in data for event item.drop
- Added Utils::getUniqueID()
- **Added default support in PHP binaries for MySQLi**
- Removed Spyc
- Call Plugin::__destruct() on PluginAPI::__destruct()
- Added more OS detection on Utils::getOS()
**Changelog:**
- New set-up wizard in multiple languages. Help translate it to more languages on http://translate.pocketmine.net/
- Updated pthreads and PHP binaries
- New font for MinTTY console on Windows
- Send partial hotbar history
- Fixed Tile saving indexes
- Fixed a few teleport bugs
- Improved crash dumps
- Increased apple health restore
- Fixed players being invincible after death
- Fixed Level::unloadChunk() not using saveEnabled
- Show player name on bad username kick
- Fixed item duplication on void #1100
- OPs can bypass the player limit
- Fixed item replacing on furnace #1114
- Fixed multiple small bugs #1058 #1032 #854 #823 #1135 #1150 #1172 #1173 #486 #466 #483
- Fixed PHP compilation on 64-bit linux #519 #861 #940 #505 #590 #761 #129
- Included OPCache to optimize opcodes
If you are on Linux, you can use `wget -q -O - http://cdn.pocketmine.net/installer.sh | bash -s - -v Alpha_1.3.12` to update. If you are on a MacOS, use `curl -sL http://cdn.pocketmine.net/installer.sh | bash -s - -v Alpha_1.3.12`

1278
changelogs/1.4.md Normal file

File diff suppressed because it is too large Load Diff

72
changelogs/1.6.md Normal file
View File

@ -0,0 +1,72 @@
# 1.6.1dev-87
**For Minecraft PE 0.16.0.5 alpha**
**THIS IS A PRE RELEASE. Do not use it in production unless you are sure you know what you are doing.**
Only changes since the 1.6dev tag will be documented here. Changes between 1.4.1 and 1.6dev are far too extensive to document effectively.
## Core
- New RNG, based on XorShift128 from the php-random library. This fixes issue with repeating terrain on 32-bit systems. _Note however that new generation into existing worlds will not be seamless._
- Block and Item IDs have been moved to interfaces for better consistency
- Better method for synchronisation of client/server time (less packet spam)
- Utils::getRandomBytes() has been deprecated in favour of php7's random_bytes() function.
- `<player>.dat` saving/reading can now be disabled in `pocketmine.yml` (set `player.save-player-data` to `false`)
## Gameplay/game features
- Added Flower Pots
- Containers can now be opened in creative
- Trapdoors can now be placed without a supporting block
## API
This release has API changes, bumping the version to 2.1.0.
### Entity metadata (0.16)
Many changes have been made to entity metadata. Many true/false data properties are now entity status flags, such as NoAI, NametagVisible and various others. Entity status flags can be set using:
`$entity->setDataFlag(Entity::DATA_FLAGS, Entity::INSERT_DATA_FLAG_NAME, true/false);`
**Breaking** changes are detailed here. Additions are not documented. https://gist.github.com/dktapps/76b291b7a861762b54f7a8b834389883
**NOTE: It's strongly recommended to use provided API methods where possible instead of tampering with metadata directly.**
### AsyncTask API additions
- Main thread local storage: Developers can pass any data including objects to the constructor of AsyncTask such that the data can be retrieved after the AsyncTask completes using the new `AsyncTask::fetchLocal()` method, or use the `AsyncTask::peekLocal()` method to get the data without removing it.
- Progress updates: Developers can use the new `AsyncTask::publishProgress() method and override`AsyncTask::onProgressUpdated()` to handle AsyncTask progress information in the main thread.
Refer to #1 and #100 for details.
### WeakPosition
WeakPosition was added in 1.6.1 to fix bugs with unloading levels which have player spawn points set in them. This type of position holds a level ID instead of a direct reference. Use this when your position may outlive the level it is in.
### Removal of Item/NBT circular dependency
Refer to #121 for details.
### Other
- Added Player->sendWhisper() (#73).
- Removed LargeExplodeParticle due to incorrect name - use HugeExplodeParticle. Added HugeExplodeSeedParticle and BlockForceFieldParticle (7314aaf7f7bdae582f674c085c7ae879985bf847)
## Fixes
- Fixed the infamous hotbar spaz bug
- Creative/spectator inventory now sends correctly
- Fixed spectator flight controls
- Fixed issues with items going past the end of the regular inventory
- Fixed furnace client crashes
- Fixed inventory windows for anvils and enchanting tables
- Fixed kicked for walking on lily pads (#blameshoghicp)
- Fixed a nasty entity-related memory leak on chunk unload
- Fixed sleeping players floating above beds and teleportation of sleeping players.
- Fixed a bug in Level::updateAround() where only one block would update
- Fixed some slab placement issues (#31)
- Fixed crash loading 1.11 worlds (#32)
- Fixed broken `--disable-readline` command-line option (#34)
- Fixed world unload crash when players have spawnpoints set in that world (#24)
- Fixed start.sh detection of system PHP binaries (#66)
- Fixed anvil rotation when placed and variant drops (d696049a0ad5e3b878a8f902e4ef75f19ec8cecc)
- /timings command is now more verbose about paste errors (#95)
- Fixed server crash at shutdown when RCON is enabled (#101)
- Fixed server name is always "Minecraft: PE Server" when running setup wizard (92bd1a755d4b171b687538db83893b9bd9c70420)
- Fixed CraftItemEvent->getInput() does not return used items (7eb9530346e953d1555623ff871086f85447b6c6)
- Fixed useless ServerKiller (#122)

1155
changelogs/3.0-alpha.md Normal file

File diff suppressed because it is too large Load Diff

264
changelogs/3.0.md Normal file
View File

@ -0,0 +1,264 @@
**For Minecraft: Bedrock Edition 1.4.0**
Plugin scheduler rewrite, RCON rewrite, performance improvements, improved idle memory usage
**While this release is nominally not an alpha, it is still not feature complete and does not include all gameplay features. Please do not create issues for missing gameplay features.**
This build has breaking API changes.
This release is the first to use the new merged versioning system. The PocketMine-MP version and the API version are now one and the same.
Please use our issue tracker to report bugs.
# 3.0.0
## Core
### General
- This release introduces a new dependency library called `Snooze`, which PocketMine-MP utilizes for managing notifications between threads. This library is currently utilized by command reading, RCON and RakLib, allowing faster response times to commands, reduced network latency, and better performance due to lack of need for polling.
- Fixed race condition causing `ServerKiller` to sometimes kill the server for no reason on shutdown.
### Dependency libraries
Requires the following libraries:
- [`pocketmine/raklib` `^0.12.0`](https://github.com/pmmp/RakLib/releases/0.12.0)
- [`pocketmine/spl` `^0.3.0`](https://github.com/pmmp/SPL/releases/0.3.0)
- [`pocketmine/binaryutils` `^0.1.0`](https://github.com/pmmp/BinaryUtils/releases/0.1.0)
- [`pocketmine/nbt` `^0.2.0`](https://github.com/pmmp/NBT/releases/0.2.0)
- [`pocketmine/math` `^0.2.0`](https://github.com/pmmp/Math/releases/0.2.0)
- [`pocketmine/snooze` `^0.1.0`](https://github.com/pmmp/Snooze/releases/0.1.0)
These libraries may individually have changes which are not recorded here. See their independent repository releases for their changelogs.
### Async pooling
- Async workers are now started dynamically when they are needed only, instead of being started immediately on startup. This allows reducing idle memory usage.
- AsyncPool now appropriately shuts down the workers when instructed to, instead of leaving it up to the ThreadManager to clean it up. This eliminates debug messages of shutting down async workers on server shutdown.
- Default maximum async worker memory limit has been lowered from 1024MB to 256MB.
- Async workers are now started using the options `PTHREADS_INHERIT_CONSTANTS | PTHREADS_INHERIT_INI`, which reduces idle memory wastage and works around some bugs in pthreads.
### Entities
- Fixed entities not being despawned when flagged, if they weren't scheduled for an update.
### Levels
- Seed handling is now always consistent between `pocketmine.yml` and `server.properties`.
- Fixed generation bugs in imported LevelDB worlds where the classpath was saved into level.dat.
- Generators for levels are no longer created on the main thread, reducing memory usage.
### Plugins
- Plugin data is now stored under `<data dir>/plugin_data` by default on new installations, instead of in `<plugins dir>`. This behaviour does not affect existing installations by default - if you want to enable it, set `plugins.legacy-data-dir` to `false` in `pocketmine.yml`.
### RCON
RCON has been almost completely rewritten in this release.
- Now event-driven (using Snooze) instead of poll-based, improving performance.
- Fixed segmentation fault when stopping the server with RCON enabled.
## API
**WARNING: Dependency library API changes are not listed here. See their individual release notes for changes (linked above in the Core section).**
### API versioning changes for plugins
The way that the API versioning is done has changed. Now the API version is synonymous with the PocketMine-MP version.
Plugin compatibility is determined by the following:
- Take the base version, and strip any metadata (everything after the `+` sign, for example `3.0.0+dev.1191` becomes `3.0.0`).
- Assert that:
- The major versions is the same
- The server's minor version is greater than or equal to the plugin's
- The server's patch version is greater than or equal to the plugin's
Currently there is no support for locking version by metadata, although this could be implemented if it is a wanted feature.
### General
- `Server->getCodename()` and `\pocketmine\CODENAME` have been removed.
- Added API method `Server->getTickSleeper()`, which returns a `\pocketmine\snooze\SleeperHandler` instance.
- `Server->getIp()` now returns `0.0.0.0` if not set.
### Block
- Added `Block->getXpDropForTool()`.
### Entity
- Calling `scheduleUpdate()` on an `Entity` after it has been `close()`d will now cause an exception to be thrown.
- `Entity->motionX`, `Entity->motionY` `Entity->motionZ` have been removed in favour of an `Entity->motion` `Vector3` field. This also applies for the `lastMotion` fields.
- `Entity->isInsideOfWater()` has been renamed to `isUnderwater()`.
### Events
- Added support for `@softDepend` annotation on event handlers, which allows the event handler to not be registered if the dependency plugin is not loaded.
- Added support for `@notHandler` annotation for `Listener` methods to indicate that such methods are not event handlers.
- Typehints have been applied to the events API to PHP 7.2 standards.
- Fixed preventing effect expiry using `EntityEffectRemoveEvent` not being reflected on the client.
- `EntityDamageEvent` API has significant changes. The general purpose of this is to split up base damage from modifiers.
- Added methods `getBaseDamage()`, `setBaseDamage()`, `getOriginalBaseDamage()`, `getModifiers()`, `getOriginalModifiers()`
- `setDamage()` renamed to `setModifier()`, and type parameter is now mandatory
- `getDamage()` renamed to `getModifier()`, and type parameter is now mandatory
- `getOriginalDamage()` renamed to `getOriginalModifier()`, and type parameter is now mandatory
- Removed `MODIFIER_BASE` constant
- Constructors now accept: `float baseDamage`, `float[] modifiers` instead of just `float[] modifiers`
- Added `BlockBreakEvent->getXpDropAmount()` and `BlockBreakEvent->setXpDropAmount()`.
### Inventory
- `InventoryTransaction->getCreationTime()` has been removed.
- `EntityInventoryChangeEvent` and `EntityArmorChangeEvent` are no longer fired during entity inventory intialization.
### Item
- Methods `isPickaxe()`, `isAxe()`, `isSword()`, `isShovel()`, `isHoe()`, `isShears()` have been removed. These should be replaced with `instanceof` checks for the relevant classes.
- Removed `Item->useOn()`. This has been superseded by new methods used for handling durability changes.
- Added hooks `Item->onDestroyBlock()` and `Item->onAttackEntity()`. These are called when a player uses the item to destroy a block or attack an entity respectively. This is used in the core code for updating durability.
- `Item->pop()` now accepts an optional count parameter.
- `Enchantment` now has separated primary items (which can be enchanted directly) and secondary items (which can be enchanted on an anvil). The constructor of `Enchantment` has been updated to reflect this.
- Removed `Enchantment->getSlot()` and `Enchantment->hasSlot()`.
- Added `Enchantment->getPrimaryItemFlags()`, `Enchantment->hasPrimaryItemFlag()`, `Enchantment->getSecondaryItemFlags()` and `Enchantment->hasSecondaryItemFlag()`
### Level
- `Biome` classes have been moved to `pocketmine\level\biome` namespace. This is in preparation for future work on Levels which requires biome information (such as weather conditions).
- `WeakPosition` has been removed.
- Added `Level->getBiome()`.
- `Level->getSafeSpawn()` now always returns a `Position` instance.
- `Level->getBlockExtraData()` and `Level->setBlockExtraData()` have been removed (as well as their associated `Chunk` methods).
- `ChunkManager->isInWorld()` now accepts integers instead of floats.
- Added `SubChunkIteratorManager->invalidate()`.
#### Generator
- `BiomeSelector` has been refactored to make it simpler and more robust.
- Generator-management methods `registerDefaultGenerators()`, `addGenerator()`, `getGeneratorList()`, `getGenerator()`, and `getGeneratorName()` have been moved from `Generator` to a new `GeneratorManager` class.
- Static noise functions in the `Generator` base class have been moved to `Noise` instance methods.
- Added static method `Generator::convertSeed()`, which converts an int or string into a numeric seed for generation.
### Network
- `SourceInterface->process()` no longer returns a value.
### Plugin
- `PluginBase->getResources()` now returns an associative array where the index is the path to the resource relative to the plugin's `resources` directory.
- `PluginLoader`s have been almost completely rewritten to make them simpler and more robust.
- `PluginManager->registerInterface()` does not return anything, and now accepts a `PluginLoader` instance instead of a `string`.
- `PluginLoader`:
- `getPluginFilters()`, `enablePlugin()` and `disablePlugin()` are removed.
- `loadPlugin()` responsibilities are now solely confined to doing whatever is necessary to make the plugin's classes visible by the server, and does not emit log messages or check for data directories.
- Added method `getAccessProtocol()` which determines what prefix to apply to the plugin path to access the files inside it (for example `phar://`).
- `PluginBase->init()` and `PluginBase->isInitialized()` have been removed.
- `Plugin` interface now declares a signature for the constructor which implementations must comply with.
- `Plugin` interface now declares `setEnabled()`.
- It is now possible to create a custom `Plugin` implementation without requiring a custom `PluginLoader`.
### Scheduler
This release features major changes to how plugin task scheduling works.
- Removed `Server->getScheduler()`. All plugins now have their own scheduler which is accessible using `Plugin->getScheduler()`. Aside from being syntactically more concise and pleasant, this also allows much more effective management of tasks when plugins are disabled.
- Removed `PluginTask` class, because it's now unnecessary. Previously it was required to allow the server to delete tasks associated with a plugin when the plugin was disabled. With plugin-owned schedulers, this is no longer a requirement. Plugins may now utilize the `Task` class as a base if they like.
- Added `Server->getAsyncPool()`. Since the global scheduler does not exist any more, it does not manage the server's `AsyncPool` any more. Additionally, `ServerScheduler` was previously bloated by a lot of `AsyncTask` related methods, which are now not necessary because direct access to `AsyncPool` is granted instead.
- `ServerScheduler`:
- `ServerScheduler` has been renamed to `TaskScheduler` since it is now a general-purpose task scheduler which is non-dependent on the user. This allows much greater flexibility and also makes it possible to unit-test.
- All `AsyncTask`/`AsyncPool` related methods have been removed - the task scheduler does not manage the async pool anymore.
- Calls to `Server->getScheduler()->scheduleAsyncTask()` should be replaced with `Server->getAsyncPool()->submitTask()`.
- Calls to `Server->getScheduler()->scheduleAsyncTaskToWorker()` should be replaced with and `Server->getAsyncPool()->submitTaskToWorker()`.
### Tile
- Calling `scheduleUpdate()` on a `Tile` after it has been `close()`d will now cause an exception to be thrown.
- Tile NBT is now ephemeral and is not retained after creating the tile.
- `Tile->namedtag` has been removed.
- `Tile->saveNBT()` now returns a new `CompoundTag` containing saved data.
- Added new protected methods `Tile->readSaveData()` and `Tile->writeSaveData()`. These should be overridden to add or read tile-specific data, instead of overriding `saveNBT()` and `__construct()`.
### Utils
- Added `MainLogger->getFormat()` and `MainLogger->setFormat()` to allow manipulating console output format.
## Gameplay
### General
- Fixed a range of block collision issues stemming from off-by-one errors when fetching areas.
### Blocks
- Fixed a crash which occurred when leaving a bed which was broken and replaced during sleep.
- Fixed dark oak and acacia saplings growing into oak trees - now they will not grow at all (they need to be implemented).
- Saplings now take light level into account when trying to grow.
- Ores and other blocks now drop experience when broken with an appropriate tool.
### Entities
- Fixed dropped items not being correctly destroyed by fire, cacti and other damage sources.
### Generation
- Grass no longer generates as the top layer of ground cover in river biomes.
- Ocean biomes now use gravel instead of grass+dirt for ground cover.
- Reduced maximum elevation of plains biomes to make them less bumpy.
- Snow layers and other can-be-flowed-into blocks no longer generate underwater.
### Items
- Buckets are no longer able to delete any block by replacing it with water.
- Dried Kelp, Bleach, Nautilus Shell and Heart of the Sea items are registered (although crafting recipes for these are not yet available).
- Implemented `Vanishing` enchantment.
- Implemented Totems.
### World
- Fixed explosions sometimes leaving behind air blocks with non-zero damage values.
# 3.0.1
- Fixed error when players move things around in the crafting grid after plugins cancel `PlayerInteractEvent` on crafting tables.
# 3.0.2
- Fixed memory dumps not showing private properties of parent classes.
- Fixed a memory leak when cancelling all tasks in the `TaskScheduler`.
- Fixed scheduled task timings showing `Unknown` as the plugin name.
# 3.0.3
- Fixed possible crash in Sign when placed by a plugin.
- Fixed slightly-damaged and very-damaged anvils dropping incorrect items.
- `Living->applyPostDamageEffects()` is no longer called if the mob died from an attack.
- Cooldown for mob attack is now reset prior to applying post-damage effects.
- Added constant `ItemIds::MUTTON` to resolve crashes using PC worlds.
- Fixed emerald ore not dropping XP when broken with a valid tool.
- Fixed mobs getting crazy vertical knockback if attacked while airborne.
- Fixed XP orbs continuing to follow dead players.
# 3.0.4
- Fixed RCON spamming the console when a client does not disconnect correctly.
- Fixed dropping chunk cache unnecessarily when no blocks need to be updated on a chunk.
- Fixed outdated block updates getting sent on chunks replaced using `setBlock()`.
# 3.0.5
- Fixed not being able to place blocks where a player died and has not yet respawned (#2265).
- Fixed mob death animation not being played when `Entity->kill()` is called directly or `/kill` is used.
- Fixed viewers of different halves of double chests not seeing changes made by viewers who opened the other half (#2261).
- Fixed bugs setting items into wrong indexes when double chest halves have differently sized inventories.
- Fixed `getConfig()` crashing when called when the plugin's data directory doesn't exist.
- Fixed a possible exploit with keychain signing for XBL login.
# 3.0.6
- Fixed invalid keys in `.properties` config files being considered as invalid strings.
- Fixed whitespace between key and value `key = value` being invalid in `.properties` config files.
- Fixed a bug in exception message when an invalid permission type is written for a command in plugin.yml.
- Properly fixed newline issues when parsing event handler annotations - `@notHandler` will now work as expected when CRLF line endings are used.
- Fixed `PluginManager->registerEvents()` registering functions as event handlers declared by parent classes which are not `Listener` instances (#2293).
# 3.0.7
- Fixed setting spawn points in un-generated chunks causing the player to fall out of the world.
- Fixed spawn protection deactivating when there are no ops set (this was an unwanted/unexpected feature, so it's considered a bug).
- Fixed cursor items not getting dropped when closing the inventory or dying.
- Fixed more issues with blocks with invalid metadata appearing as update! blocks.
- `Entity->setNameTagAlwaysVisible()` now works (although nametags will still not be shown if the entity is invisible, due to a behavioural change in Minecraft PE).
- Fixed errors passing zero motions to projectiles in some cases.
# 3.0.8
- Fixed player on-ground state not updating when moving horizontally. This allowed fly hacks with the built in anti-cheat, and also affected some third party anti-cheat plugins due to the effect on `inAirTicks`.
- Fixed knockback. PC 1.9-style knockback was mistakenly introduced in 3.0.3. This has now been reverted back to the old 1.8-style behaviour.
# 3.0.9
- Cleaned up odd behaviour of `/kill` due to old broken code.
- Fixed patch level check for plugin APIs not allowing lesser patch versions on greater minor versions.
- Fixed `/timings paste`. This now reports directly to the timings host instead of using Ubuntu Pastebin.
- Minor code cleanups in various places.
- Zip resource packs will now give slightly less useless errors - errors for broken manifest have been separated from those with fields missing, and now reports why decoding failed if it failed.
# 3.0.10
- Syntax error crashdumps will no longer be reported to the crash archive.
- Chunk sending is now fault-tolerant. Before this release, any error on a worker during async chunk sending (such as memory errors caused by pthreads) would cause that chunk to never get sent, resulting in invisible and missing chunks. Levels will now attempt to retry chunk prepare when a task crashes, which should fix most invisible chunk bugs.
- `MainLogger` now logs exception stack traces in a synchronized block to ensure that they are coherent when log messages are emitted from multiple threads at once.
- `AsyncTask->isCrashed()` now returns `true` if a fatal error occurred during the task execution.
# 3.0.11
- `DropItemAction` will now consider itself invalid if attempting to drop a null item.
- Fixed leaking globally broadcasted Level packets when no players are on the server.
- Fixed title bar not being cleared on server stop on some terminals.
- Fixed `FallingBlock` saving corrupted data.
- Fixed the structure of `GuiDataPickItemPacket`.
- Cleaned up some code in `OfflinePlayer`.
- Splash potions no longer apply effects to dead (but not yet respawned) players.
- Coal ore no longer drops XP when mined with a silk touch tool.
- Item entities now cannot be picked up when a negative pickup delay is used.
# 3.0.12
- `Config` keys which are considered bools by YAML 1.1 will no longer be transformed into 1 or 0.
- Fixed painting motives not getting saved.
- Fixed cacti spewing items when placed in some invalid locations.
- Fixed entity fire damage not applying in the void.
- Fixed entities not getting updated appropriately in some conditions.

68
changelogs/3.1.md Normal file
View File

@ -0,0 +1,68 @@
**For Minecraft: Bedrock Edition 1.5.0**
### Note
Plugins compatible with any previous 3.x.y version will also run on this build and do not need API bumps. Plugin developers should **only** update their required API to this version if you need the changes in this build.
**This build contains changes to the **protocol** which are not covered by the API version. To lock your plugin to a specific protocol version, declare the `mcpe-protocol` attribute in your `plugin.yml`.
# 3.1.0
- Support for Minecraft: Bedrock Edition version 1.5.0
# 3.1.1
- Fixed player on-ground state not updating when moving horizontally. This allowed fly hacks with the built in anti-cheat, and also affected some third party anti-cheat plugins due to the effect on `inAirTicks`.
- Fixed knockback. PC 1.9-style knockback was mistakenly introduced in 3.0.3. This has now been reverted back to the old 1.8-style behaviour.
# 3.1.2
- Cleaned up odd behaviour of `/kill` due to old broken code.
- Fixed patch level check for plugin APIs not allowing lesser patch versions on greater minor versions.
- Fixed `/timings paste`. This now reports directly to the timings host instead of using Ubuntu Pastebin.
- Minor code cleanups in various places.
- Zip resource packs will now give slightly less useless errors - errors for broken manifest have been separated from those with fields missing, and now reports why decoding failed if it failed.
- Added constant `Entity::DATA_FLAG_SHOW_TRIDENT_ROPE`.
# 3.1.3
- Syntax error crashdumps will no longer be reported to the crash archive.
- Chunk sending is now fault-tolerant. Before this release, any error on a worker during async chunk sending (such as memory errors caused by pthreads) would cause that chunk to never get sent, resulting in invisible and missing chunks. Levels will now attempt to retry chunk prepare when a task crashes, which should fix most invisible chunk bugs.
- `MainLogger` now logs exception stack traces in a synchronized block to ensure that they are coherent when log messages are emitted from multiple threads at once.
- `AsyncTask->isCrashed()` now returns `true` if a fatal error occurred during the task execution.
# 3.1.4
- `DropItemAction` will now consider itself invalid if attempting to drop a null item.
- Fixed leaking globally broadcasted Level packets when no players are on the server.
- Fixed title bar not being cleared on server stop on some terminals.
- Fixed `FallingBlock` saving corrupted data.
- Fixed the structure of `GuiDataPickItemPacket`.
- Cleaned up some code in `OfflinePlayer`.
- Splash potions no longer apply effects to dead (but not yet respawned) players.
- Coal ore no longer drops XP when mined with a silk touch tool.
- Item entities now cannot be picked up when a negative pickup delay is used.
- Fixed extra byte at the end of `PlayerSkinPacket` not being read (1.5 protocol change that somehow got lost).
# 3.1.5
- `Config` keys which are considered bools by YAML 1.1 will no longer be transformed into 1 or 0.
- Fixed painting motives not getting saved.
- Fixed cacti spewing items when placed in some invalid locations.
- Fixed entity fire damage not applying in the void.
- Fixed entities not getting updated appropriately in some conditions.
# 3.1.6
- Fixed players disconnected during login verification getting leaked and not destroyed correctly.
- Updated NBT dependency to 0.2.1 to receive bug fixes (see https://github.com/pmmp/NBT/releases/tag/0.2.1).
# 3.1.7
- Errors thrown during level tick will now crash the server instead of spamming the console.
- Fixed arrows despawning too soon after hitting the ground.
- Fixed projectiles despawning before colliding if they were airborne for > 60 seconds.
# 3.1.8
- Fixed levels unloaded during an earlier level's tick on the same tick causing a crash.
- PermissibleBase->clearPermissions() now properly unsubscribes from all permissions.
- Fixed incorrect break check for standing torch.
- Fixed drops for brewing stand.
- Fixed block picking brewing stand, bed, double slab, cake, farmland, and mob heads giving the wrong items.
- Fixed blocks not placing correctly when clicking on redstone ore.
- Fixed unknown PC items in tile inventories crashing the server - now they'll be quietly removed instead.
- Fixed server freezing when eating chorus fruit from high altitude.
- `readline` is now disabled by default on Windows and must be explicitly enabled with `--enable-readline` due to thread-safety issues.
- Fixed server crash when trying to use non-implemented splash potions.
- Removed incorrect maximum region file size cap which may have caused some worlds to be incorrectly detected as corrupted.

20
changelogs/3.10.md Normal file
View File

@ -0,0 +1,20 @@
**For Minecraft: Bedrock Edition 1.13.0**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.10.0
- Added support for Minecraft: Bedrock Edition 1.13.0
- Removed compatibility with 1.12.0
## Note about skins
PocketMine-MP **does not support skins made in the Charactor Creator** (known as Persona skins), due to technical changes which would require premature backwards compatibility breaks. The dev team has decided not to support Persona yet.
These skins will be **replaced with a random solid-colour skin. This is not a bug.**
Skins chosen from the Classic tab (classic skins) will continue to work as normal.
# 3.10.1
- Fixed custom plugin-created skins being invisible when no geometry name was specified.
- Updated RakLib to 0.12.6 to fix security bugs.

97
changelogs/3.11.md Normal file
View File

@ -0,0 +1,97 @@
**For Minecraft: Bedrock Edition 1.14.0**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.11.0
- Added support for Minecraft: Bedrock Edition 1.14.0
- Removed compatibility with 1.13.0
# 3.11.1
- Fixed blocks with incorrect properties when placed or interacted with.
# 3.11.2
## Core
- PHPStan 0.12.3 with level 5 is now used for automated static analysis.
- Fixed a possible crash when plugins override the `EnderChest` tile class with something incompatible.
- Fixed disconnected players being considered as never played.
- Fixed enchantments with IDs outside the range 0-255 in item NBT crashing the server.
- Fixed particles rendering incorrectly.
- Timings handlers are no longer able to underflow; they now throw exceptions when attempting to be stopped more times than they were started.
- Fixed explosion rays getting stuck in empty subchunks (possible incorrect behaviour in large caves).
- Fixed bad tile/entity NBT data being propagated from world providers in some cases.
- Fixed a possible crash when detecting timezone on CentOS.
- Fixed many cases of incorrectly documented types in the API found by PHPStan.
- Generation tasks no longer assume that generator instances stored in TLS are always valid, fixing a possible crash.
## Protocol
- Fixed skin animation image corruption in LoginPacket handling caused by incorrect data handling.
- Fixed skin animation extra data not being decoded from LoginPacket.
- `SkinImage` now throws `InvalidArgumentException` if it receives an unexpected amount of bytes for the given image heigh/width.
- Fixed broken code in `PlayerAuthInputPacket::create()`.
- Removed some dead constants from `NetworkInventoryAction`.
# 3.11.3
- Fixed some PHPStan false-positives in release builds.
- Git hash is now correctly detected for source builds when the working directory is not the repository root.
- Added a specialized build script `build/server-phar.php` for creating server phars.
- Fixed timings crashing the server.
- Timings chains now work correctly.
- Fixed some minor timing errors in chained timings.
- Forcing resource packs no longer causes removal of client-sided resource packs. If this behaviour is desired, use a vanilla resource pack at the bottom of your resource stack (as was necessary for non-forced packs).
- Added documentation to the API to clarify that effect durations are in ticks.
# 3.11.4
- Fixed performance issue in leaf decay.
- Fixed entity position desync when entities stop moving, but still have velocity on the client.
- Fixed a crash when encountering truncated `level.dat` files in LevelDB worlds.
- Core code is now analyzed using PHPStan level 6.
- The core constants `pocketmine\PATH` and `pocketmine\RESOURCE_PATH` are now unconditionally available when including the Composer autoloader.
- Populate type information in lots of places where it was previously missing; this will improve the quality of static analysis for plugins.
- `MainLogger::logException()` now logs previous exceptions recursively.
- `MainLogger::logException()` now always logs exceptions as `critical`.
# 3.11.5
- PHPStan and PHPUnit are now managed as Composer dev dependencies.
- Core code is now analyzed using PHPStan level 6 (full, including iterable types checking).
- Improved type information available to PHPStan in many areas.
- Mass-removal of useless PHPDoc.
- Fixed incorrect documentation of `Internet::getURL()`, `Internet::postURL()` and `Internet::simpleCurl()`.
- Fixed crash on use of case-mismatched recursive command aliases.
- Basic build instructions are now provided in `BUILDING.md`.
- `build/server-phar.php` now uses GZIP compression on created phars, providing a 75% size reduction.
- `ClientboundMapItemDataPacket` now uses `MapDecoration` objects for decorations instead of associative arrays.
- Updated Composer dependencies to get bug fixes in `pocketmine/nbt` and other libraries.
- Packages `pocketmine/classloader` and `pocketmine/log` are now required; these provide classes previously part of `pocketmine/spl`. This change has no effect on API compatibility.
# 3.11.6
- Core code, tests and build scripts are now analyzed using `phpstan-strict-rules` and `phpstan-phpunit` rules.
- Added more PHPStan-specific type annotations to improve static analysis.
- Fixed more incorrect PHPDoc types.
- Added a workaround for player movement not working since 1.14.30.
- Fixed lava and water buckets being edible since 1.13.
- `AutoUpdater` is now created before any plugins are loaded.
- Fixed trees not generating below y=2 in custom generators.
- Fixed crash when opening a chest improperly unpaired from its pair (destroyed, setBlock(), unloaded, etc.).
- `ThreadManager` is now lazily initialized.
- Removed raw NBT storage from `Item` internals. The following methods are now deprecated:
- `Item::setCompoundTag()`
# 3.11.7
- Build system: Fixed crash reports of Jenkins builds being rejected by the crash archive as invalid.
- Introduced a new dependency on `pocketmine/log-pthreads`, which contains classes separated from `pocketmine/log`.
- Fixed minimum composer stability preventing any newer version of `pocketmine/pocketmine-mp` being installed than 3.3.4 by replacing `daverandom/callback-validator` with [`pocketmine/callback-validator`](https://github.com/pmmp/CallbackValidator).
- Fixed every player seeing eating particles when any player eats.
- Fixed setting held item not working during `BlockBreakEvent`, `PlayerInteractEvent` and `EntityDamageEvent`.
- Fixed some incorrect documented types in `PlayerQuitEvent` reported by PHPStan.
- Fixed documentation of `Item->pop()` return value.
- Fixed server crash on encountering corrupted compressed data stored in region files.
- Protocol: Split screen header is now properly accounted for during decoding. Note that split screen is still not supported natively, but their packets can be decoded properly now.
- Protocol: Fixed wrong order of fields in `UpdateTradePacket`.
- Protocol: Fixed loss of `fullSkinId` when decoding network skins.
- Fixed RCON not being able to bind to port after a fast server restart.

58
changelogs/3.12.md Normal file
View File

@ -0,0 +1,58 @@
**For Minecraft: Bedrock Edition 1.14.60**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.12.0
- Added support for Minecraft: Bedrock Edition 1.14.60
- Removed compatibility with 1.14.0-1.14.30
# 3.12.1
- Fixed parsing of single-line doc comments for event handlers, e.g. `/** @ignoreCancelled */` should now work correctly.
- The server will no longer crash on failure to load `level.dat` contents, but will gracefully shutdown instead without producing a crashdump.
- Fixed some bugs in login verification that could cause undefined behaviour.
- Fixed item-use behaviour when sneaking - sneaking and clicking a block with an empty hand, and sneaking and using an item, both now follow vanilla behaviour.
- `start.sh` will now work on platforms where `/bin/bash` is not available, as long as `/usr/bin/env` knows where bash is.
# 3.12.2
- Fixed permission default timings not being reported in timings reports (they were never stopped, only started).
- Resource packs with a directory tree like `pack.zip/MyPack/manifest.json` are now supported. Note that the manifest closest to the root will be used.
- Fixed `SkinImage` height and width being inverted at the protocol layer.
- Fixed blocks being able to be placed inside the spawn 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.
# 3.12.5
- Fixed broken attack cooldowns.
# 3.12.6
- Fixed entities not getting movement updates after teleports.
- Fixed slow flight in spectator mode when starting from the ground and after teleportation.
- Errors communicating with the crash archive on automatic crash submission are now logged.

131
changelogs/3.13.md Normal file
View File

@ -0,0 +1,131 @@
**For Minecraft: Bedrock Edition 1.14.60**
This is a feature release, containing various minor API additions, deprecations and a few minor features.
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.13.0
## Core
- PHP 7.3.0 or newer is now required.
- Player movement processing has been revamped. It's now more tolerant of network lag and doesn't have as many problems with falling.
## User Interface
- `/time` now supports additional aliases `noon`, `sunset`, `midnight` and `sunrise`.
- Removed warnings when a plugin registers a handler for a deprecated event. Since this warning is developer-focused, and too specific to be useful, it just caused annoyance and confusion to users who didn't know what it meant.
## API
### General
- It's now possible to require a specific operating system using the `os` directive in `plugin.yml`. More information about this directive can be found in the [developer documentation](https://github.com/pmmp/DeveloperDocs).
### Player
- `Player->resetItemCooldown()` now accepts a second parameter, allowing plugins to provide a custom duration.
- The following methods have been deprecated and have recommended replacements:
- `Player->addTitle()` -> `Player->sendTitle()`
- `Player->addSubTitle()` -> `Player->sendSubTitle()`
- `Player->addActionBarMessage()` -> `Player->sendActionBarMessage()`
### Event
- The following methods have been deprecated:
- `EntityDespawnEvent->getType()`
- `EntityDespawnEvent->getPosition()`
- `EntityDespawnEvent->isCreature()`
- `EntityDespawnEvent->isHuman()`
- `EntityDespawnEvent->isProjectile()`
- `EntityDespawnEvent->isVehicle()`
- `EntityDespawnEvent->isItem()`
- `EntitySpawnEvent->getType()`
- `EntitySpawnEvent->getPosition()`
- `EntitySpawnEvent->isCreature()`
- `EntitySpawnEvent->isHuman()`
- `EntitySpawnEvent->isProjectile()`
- `EntitySpawnEvent->isVehicle()`
- `EntitySpawnEvent->isItem()`
- Added the following API methods:
- `EntityDeathEvent->getXpDropAmount()`
- `EntityDeathEvent->setXpDropAmount()`
- `PlayerDeathEvent::__construct()` now accepts a fourth (optional) parameter `int $xp`.
- `EntityDeathEvent::__construct()` now accepts a third (optional) parameter `int $xp`.
### Inventory
- The following classes have been deprecated:
- `Recipe`
- The following methods have been deprecated:
- `CraftingManager->registerRecipe()`
- `Recipe->registerToCraftingManager()` (and all its implementations)
### Item
- New `Enchantment` type ID constants have been added.
- `ItemFactory::fromStringSingle()` has been added. This works exactly the same as `ItemFactory::fromString()`, but it has a return type of `Item` instead of `Item|Item[]` (more static analysis friendly).
### Level
- Added the following API methods:
- `Position->getLevelNonNull()`: this is the same as `Position->getLevel()`, but throws an `AssumptionFailedError` if the level is null or invalid (more static analysis friendly).
- `Level->getTimeOfDay()`
- The following constants have been changed:
- `Level::TIME_DAY` now has a value of `1000`
- `Level::TIME_NIGHT` now has a value of `13000`
- Added the following constants:
- `Level::TIME_MIDNIGHT`
- `Level::TIME_NOON`
- The following types of particles now accept optional `Color` parameters in the constructor:
- `EnchantParticle`
- `InstantEnchantParticle`
### Network
- Added the following API methods:
- `RakLibInterface->setPacketLimit()`
### Scheduler
AsyncTask thread-local storage has been improved, making it simpler and easier to use.
- `AsyncTask->fetchLocal()` no longer deletes stored thread-local data. Instead, the storage behaves more like properties, and gets deleted when the AsyncTask object goes out of scope.
- `AsyncTask->peekLocal()` has been `@deprecated` (use `fetchLocal()` instead).
- Notices are no longer emitted if an async task doesn't fetch its locally stored data.
- The following methods have been deprecated:
- `AsyncTask->getFromThreadStore()` (use its worker's corresponding method)
- `AsyncTask->saveToThreadStore()` (use its worker's corresponding method)
- `AsyncTask->removeFromThreadStore()` (use its worker's corresponding method)
### Utils
- The following functions have been deprecated and have recommended replacements:
- `Utils::getMemoryUsage()` -> split into `Process::getMemoryUsage()` and `Process::getAdvancedMemoryUsage()` (not 1:1 replacement!!)
- `Utils::getRealMemoryUsage()` -> `Process::getRealMemoryUsage()`
- `Utils::getThreadCount()` -> `Process::getThreadCount()`
- `Utils::kill()` -> `Process::kill()`
- `Utils::execute()` -> `Process::execute()`
- Added the following constants:
- `Utils::OS_WINDOWS`
- `Utils::OS_IOS`
- `Utils::OS_MACOS`
- `Utils::OS_ANDROID`
- `Utils::OS_LINUX`
- `Utils::OS_BSD`
- `Utils::OS_UNKNOWN`
- Added the following API methods:
- `Config->getPath()`
- `Utils::recursiveUnlink()`
- `Terminal::write()`
- `Terminal::writeLine()`
# 3.13.1
- Fixed issues with `server.lock` not being unlocked on some platforms. Now, the server explicitly releases it before exiting.
- `/timings` now sends a usage message when using an unknown subcommand. Previously, it would just give no output.
- `/whitelist` now sends a usage message when using an unknown subcommand. Previously, it would just give no output.
- The output from `/timings` is now broadcasted on the `pocketmine.broadcast.admin` broadcast channel for auditability, similarly to other operator commands.
- Fixed `ShapedRecipe` deprecation warning on PHP 7.4.
- Fixed some potential crashes with Bedrock worlds when chunk data is corrupted or missing.
- Fixed a bug in region handling that caused region loaders to overestimate the amount of space used in the file. This resulted in an up to 4 MB growth of the file size every time the region was reloaded after writing a chunk.
- Region handlers now try to reuse free space in region files before putting the chunk at the end of the file. Previously, space was only reused if the new version of the chunk was <= the size of the old. This fixes endless growth of region files.
- Regions now never directly overwrite old copies of chunks when saving; instead they try to find an alternative location (preferring unused space within the file first). This avoids chunk corruption on power failure (the old copy of the chunk won't be damaged, so a rollback might occur instead), and as happy side effect, causes oversized regions to gradually shrink towards their most packed state over time, saving disk space.
- Regions now have a hard size cap at 64 GB. This is because the header pointers will overflow beyond 64 GB (besides, a normal region shouldn't be this big anyway).
- Fixed a crash that could occur when reading a too-short region header.
- `VerifyLoginTask` now only copies JWTs to verify instead of the entire login packet. This reduces the amount of data copied between threads, improving performance.
- Added a fast-fail check to `VerifyLoginTask` by checking the JWT header's `x5u` against the expected public key.
- `Skin->validate()` now throws `InvalidSkinException` instead of `\InvalidArgumentException`.
- A debug message is now logged when a player is kicked for having an invalid skin, giving a brief line of detail why.
- Fixed players not being kicked for having an invalid `resourcePatch`.
- Fixed block meta value of cake being preserved when using pick-block.
- Fixed explosions not fully destroying multi-block objects like beds and doors.

40
changelogs/3.14.md Normal file
View File

@ -0,0 +1,40 @@
**For Minecraft: Bedrock Edition 1.16.0**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.14.0
- Added support for Minecraft: Bedrock Edition 1.16.0.
- Removed compatibility with 1.14.60.
## Known issues (please don't open issues for these)
- Walls don't connect to each other
- Pumpkin and melon stems may not connect to their corresponding pumpkin/melon
- New blocks, items & mobs aren't implemented
- Nether doesn't exist
# 3.14.1
- All skins are now trusted, bypassing the client-side trusted skin setting. Note that this means that NSFW skin filtering will **not** apply.
- Fixed projectile motion being altered by ladders.
- Fixed client-sided crashes when pressing E repeatedly very quickly on a high-latency connection.
- `/plugins`, `/whitelist list`, `/banlist` and `/list` now show output in alphabetical order.
- Some `pocketmine\event` APIs which accept arrays now have more robust type checking, fixing type errors caused by plugin input occurring in core code.
- `Attribute::getAttributeByName()` is now aware of the `minecraft:lava_movement` attribute.
# 3.14.2
- Exception stack traces are now logged as CRITICAL. It's hoped that users will recognize that they are just as important as the error message and not leave them out when asking for help with errors on Discord.
- `TaskScheduler` no longer accepts tasks that already have a handler. This fixes undefined behaviour which occurs when scheduling the same task instance twice, but it does break plugins such as **MyPlot** which unintentionally used this buggy behaviour.
- Players will now correctly receive the needed number of spawn chunks if they are teleported between `PlayerLoginEvent` and `PlayerJoinEvent`. This fixes a bug that could occur when teleporting players in delayed tasks between login and join.
- `PlayerRespawnEvent->setRespawnPosition()` now throws an exception if the provided `Position` has an invalid world associated with it (null or unloaded).
- Fixed a crash that occurred when stats reporting was enabled.
# 3.14.3
- Fixed deprecation error when running `/whitelist list` on PHP 7.4.
- Fixed podzol breaking animation being incorrect (incorrect hardness).
- `Entity::getSaveId()` now reports the class name in the message thrown for unregistered entities.
- Fixed `CraftingManager->validate()` producing different results when called multiple times for the same transaction.
- Fixed various issues with batch-crafting items using the recipe book and shift-clicking.
- `tests/plugins/PocketMine-DevTools` submodule has been renamed to `tests/plugins/DevTools`.

54
changelogs/3.15.md Normal file
View File

@ -0,0 +1,54 @@
**For Minecraft: Bedrock Edition 1.16.20**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.15.0
- Added support for Minecraft: Bedrock Edition 1.16.20.
- Removed compatibility with 1.16.0.
## Known issues (please don't open issues for these)
- Walls don't connect to each other
- Pumpkin and melon stems may not connect to their corresponding pumpkin/melon
- New blocks, items & mobs aren't implemented
- Nether doesn't exist
# 3.15.1
- Fixed various PHP 7.4 compatibility issues in Composer dependencies (primarily callback-validator).
- Fixed LevelDB worlds with corrupted `level.dat` crashing the server instead of failing gracefully.
- Fixed error spam when using strings for layers in flatworld presets (`e.g. bedrock,3xdirt,grass`).
- Fixed blocks not getting updated properly on explosions.
- Fixed `BlockGrowEvent` not being called when sugarcane grows.
- Potato crops now drop poisonous potatoes when harvested.
- Fixed the wrong number of potatoes being dropped when harvesting potato crops.
- Players no longer get pullbacks when sprinting on slabs, stairs and various other blocks when `player.anti-cheat.allow-movement-cheats` is set to `false`. (This bug has been around for over 5 years, so many of you will be used to its existence.)
- Fixed entity collision box calculation not taking clip distance into account.
- Entities now step up the correct height of the target block, instead of jumping into the air 0.6 blocks and falling back down.
# 3.15.2
- Fixed issues with preloading `SubChunk`.
- `/gc` and automatic garbage collection will now release unused heap blocks back to the OS. Previously, the PHP process might hold onto these blocks indefinitely even when not used, causing elevated real memory usage.
- Added some documentation to `FurnaceBurnEvent`.
# 3.15.3
- Fixed fall damage accumulation over continuous knockbacks (e.g. combo attacks in PvP).
- Fixed a bug in `Human->addXp()` that would cause a crash when saving player data.
- `Human->addXp()` will no longer modify the target's total XP if `PlayerExperienceChangeEvent` was cancelled.
- `AsyncPool->getTaskQueueSizes()` has been added to allow external detection of async pool overload. This is planned to be implemented as a core feature in the future, but it hasn't been done yet.
- `BaseInventory->canAddItem()` behaviour now matches `addItem()` by considering the max stack size of the given item.
- Fixed a bug in generator options handling for worlds loaded via `pocketmine.yml`. This fix has the following side effects:
- It's now possible to provide generator options as an `options` key when loading a world via `pocketmine.yml`.
- If generator options are not provided, the options from `server.properties` will be used, instead of using an empty preset. (It's not clear whether this is desired behaviour, but it was clearly intended, since there is code to do this which was broken until this release. As such, this behaviour is subject to change in the future.)
- Fixed a bug in region-based world loading where some files without filename extensions and names containing a region filename extension (e.g a file named `amca` in a McRegion world) would cause the world not to load. These files are now ignored.
- Default network compression level has been lowered to 6, due to level 7 being 25% more expensive for only a marginal improvement in bandwidth.
- Fixed a performance issue with chunk requesting when players trigger chunk generation on first join.
- Setup wizard will now always show IP information, even if the user chose to skip the setup wizard when prompted. (This doesn't affect `--no-wizard` in any way.)
- `Maximum memory (system)` is no longer reported in `/status` due to having a misleading output (it was the same as the current memory usage).
- The `Player Chunk Send` timer on timings reports now actually reports measurements of chunk sending, not chunk loading.
- A new parent timer `World Load` has been added to timings reports, which aggregates timings from `syncChunkLoad` and subtimings from all worlds.
# 3.15.4
- Fixed a bug in the inventory transaction system that caused the server to freeze under some circumstances.

24
changelogs/3.16.md Normal file
View File

@ -0,0 +1,24 @@
**For Minecraft: Bedrock Edition 1.16.100**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.16.0
- Added support for Minecraft: Bedrock Edition 1.16.100.
- Removed compatibility with earlier versions.
- Added new custom composer commands `make-server` and `make-devtools` to ease setting up a development environment and building the server.
## Known issues (please don't open issues for these)
- Walls don't connect to each other
- Pumpkin and melon stems may not connect to their corresponding pumpkin/melon
- New blocks, items & mobs aren't implemented
- Nether doesn't exist
# 3.16.1
- Fixed incorrect encoding of skins in the protocol.
- `/version` no longer crashes when a plugin provides `string[]` for the `author` field in `plugin.yml`.
- `author` in `plugin.yml` now accepts arrays, just like `authors`.
- Fixed `HellBiome` never being registered.

63
changelogs/3.17.md Normal file
View File

@ -0,0 +1,63 @@
**For Minecraft: Bedrock Edition 1.16.200**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.17.0
- Added support for Minecraft: Bedrock Edition 1.16.200.
- Removed compatibility with earlier versions.
## Known issues (please don't open issues for these)
- Walls don't connect to each other
- Pumpkin and melon stems may not connect to their corresponding pumpkin/melon
- New blocks, items & mobs aren't implemented
- Nether doesn't exist
# 3.17.1
- Fixed some instances of plugin-caused crashes not being detected (eval()'d code, custom plugin paths).
- Server uptime is now included in crash reports.
- Hoes now take damage when used to break sponges.
- Using lava as fuel in a furnace now leaves behind an empty bucket.
# 3.17.2
- Fixed region header corruption when chunks with larger-than-expected lengths are found. These chunks are now treated as corrupted, instead of automatically attempting to salvage them (which usually fails anyway).
- `RegionLoader->removeChunk()` now allows the space used by the removed chunk to be reused by future region saves.
- Extracted `Living->applyConsumptionResults()` from `Living->consumeObject()` (preparation for a future bug fix).
# 3.17.3
- Improved performance of chunk loading in Region-based worlds.
- Improved performance of region header validation in Region-based worlds (indirect improvement to chunk loading performance).
- Fixed some PHP 8.0 language-level compatibility issues.
- Source installations will now exit with an error when Composer dependencies are not in sync with the current Git revision. Now, it's required to run `composer install` after every git pull to make sure the correct dependency versions are installed.
# 3.17.4
- Removed `readline` support. This hasn't been maintained for many years, never worked correctly, and isn't thread-safe in any case.
- Fixed false-positives of region corruption in Region-based worlds (outdated file stat cache).
- Fixed more deprecation warnings on PHP 8.0 (optional parameter before required).
- `CraftItemEvent->getInputs()` now returns a list starting at offset 0, instead of random offsets. (Note that the contents still won't be ordered.)
- `CraftItemEvent->getOutputs()` now returns a list starting at offset 0, instead of random offsets. (Note that the contents still won't be ordered.)
- Fixed a bug that broke synchronized building, bridging, towering and more.
- Objects in memory dumps no longer show inherited properties multiple times.
# 3.17.5
- Reduced CPU wastage by the logger thread.
- Fixed LevelDB deprecation errors on PHP 8.0.
- Added some protocol changes for 1.16.200 which were previously overlooked.
- Player XUIDs are now tracked. If a player's XUID does not match the previously recorded XUID when they next join the server, they will be kicked. This can be disabled by the `player.verify-xuid` setting in `pocketmine.yml`.
- `BUILDING.md` now has a note about `build/server-phar.php`'s compression bug (a bug in PHP).
# 3.17.6
- Fixed core race conditions that could have led to server freezes (race conditions in pmmp/Snooze).
- The log message about Xbox Live authentication being enabled has been reduced to INFO, and the tip on how to turn it off removed (disabling it should usually only be done by power users anyway).
- Fixed `PlayerMoveEvent->getFrom()` returning incorrect results for players who experienced movement reversions.
- Fixed a bug in `ResourcePackClientResponsePacket` decoding that caused unexpected results when decoding the packet twice.
- XUID verification now compares XUIDs against players who are already on the server to detect mismatches to avoid unnecessary loading of playerdata.
- Fixed an inventory duplication bug which could occur when the same player joined with two devices at the same time.
- Fixed cursor item not being synced on inventory transaction rollbacks.
- Fixed items with TAG_Float in their NBT not being able to be moved around in the inventory.
# 3.17.7
- Fixed crash caused by preprocessor in 3.17.6.

31
changelogs/3.18.md Normal file
View File

@ -0,0 +1,31 @@
**For Minecraft: Bedrock Edition 1.16.210**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.18.0
- Added support for Minecraft: Bedrock Edition 1.16.210.
- Removed compatibility with earlier versions.
## Known issues (please don't open issues for these)
- Walls don't connect to each other
- Pumpkin and melon stems may not connect to their corresponding pumpkin/melon
- New blocks, items & mobs aren't implemented
- Nether doesn't exist
- Items can't be removed from item frames in Survival mode
# 3.18.1
- UPnP is now supported on all platforms instead of just Windows. Note that it's still experimental. Please file issues for any bugs that you find.
- Fixed server joining when default game mode is set to Spectator mode.
- Fixed items not being able to be removed from item frames in Survival mode.
- Fixed field order in ClientCacheBlobStatusPacket (hits and misses were inverted).
- Fixed a deadlock that could occur when MainLogger->syncFlushBuffer() was used (usually only used during exception logging).
- Updated constants for various things in the protocol.
# 3.18.2
- Fixed `InventoryCloseEvent` not being called on server-initiated inventory closures.
- `PlayerToggleFlightEvent` may now be pre-cancelled if the player attempted to enable flight when flying was not allowed. This replaces the previous behaviour of kicking the player.
- Fixed being unable to change the item in hand from the inventory window when looking at an entity.

31
changelogs/3.19.md Normal file
View File

@ -0,0 +1,31 @@
**For Minecraft: Bedrock Edition 1.16.220**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.19.0
- Added support for Minecraft: Bedrock Edition 1.16.220.
- Removed compatibility with earlier versions.
## Known issues (please don't open issues for these)
- Walls don't connect to each other
- Pumpkin and melon stems may not connect to their corresponding pumpkin/melon
- New blocks, items & mobs aren't implemented
- Nether doesn't exist
# 3.19.1
- Fixed some particles not working since 1.16.220.
- Fixed issues with creative inventory items appearing in the wrong places since 1.16.220.
- `Item->removeEnchantment()` now removes the `ench` tag from item NBT when removing the only enchantment on an item.
- Fixed temporary memory leak of repeating tasks which cancelled themselves during their `onRun()` handler (they were pushed back onto the task queue even though cancelled, and only removed at their next attempted repeat).
# 3.19.2
- Signs can now only be edited by the player who placed them. They will become finalized if the chunk containing them is unloaded and reloaded, or if the creating player quits the server.
# 3.19.3
- Fixed `Worker->quit()` returning without stopping the thread.
- Added some protocol constants in `SetDisplayObjectivePacket`.
- Fixed possible client crash caused by `CraftingDataPacket`.

121
changelogs/3.2.md Normal file
View File

@ -0,0 +1,121 @@
**For Minecraft: Bedrock Edition 1.6.0**
This is a minor feature release, including support for Minecraft Bedrock 1.6.0, some new minor gameplay features and some API deprecations and additions.
### Note
Plugins compatible with any previous 3.x.y version will also run on this build and do not need API bumps.
However, some API features have been deprecated in this version. Plugin developers do not need to do anything about these deprecations immediately, however they may raise harmless warnings if used.
Features marked **`@deprecated`** are **recommended** not to be used, but will continue to work for any future 3.x.y versions. They will be removed in the next major release (4.0).
# 3.2.0
### Core
- `Level` generators are now registered only when needed instead of as soon as a worker starts. This drastically reduces memory consumption on servers with lots of workers.
- Async workers are now garbage-collected along with everything else on the default schedule. Idle workers with 0 queued tasks will be shutdown and removed from the pool to reduce memory usage.
- UPnP error messages are now more informative of troubleshooting steps.
- Errors are no longer caught in cases where they are unrecoverable.
### API
#### Entity
- Arrow pickup mode can now be controlled via `Arrow->setPickupMode()`. This accepts one of three `Arrow` constants: `PICKUP_NONE`, `PICKUP_ANY`, `PICKUP_CREATIVE`.
- Added new API methods `Projectile->getBaseDamage()` and `Projectile->setBaseDamage()`.
- Added new API methods `Entity->getScoreTag()` and `Entity->setScoreTag()`.
#### Events
- The `Listener` interface has now received in-depth documentation about its behaviour and uses. See the top of the `Listener` class to read it.
- It is now possible to declare `@ignoreCancelled` on an event handler without specifying `true` or `false`. If no value is found, `true` will be assumed.
- `ServerCommandEvent` and `RemoteServerCommandEvent` are now **`@deprecated`** and their usage discouraged. A new generic `CommandEvent` has been introduced in its place, which allows capturing commands from any type of command sender. This was done in response to difficulties of code duplication when wanting to intercept commands from both console and players.
- `EntityDamageEvent`
- Added `MODIFIER_WEAPON_ENCHANTMENTS` constant for attack damage bonuses due to enchantments like Sharpness.
- Added new API methods `getAttackCooldown()` and `setAttackCooldown()` to allow controlling Living entities attack cooldown times (default 10 ticks).
- `PlayerDeathEvent`: Added new static method `deriveMessage()`.
- `PlayerKickEvent`: Added new method `setReason()`.
#### Forms
- Added a new `pocketmine\form\Form` interface. Implementing this interface permits custom form implementations to make use of `Player->sendForm()`, eliminating the need to handle packets directly and also solving the form ID collision problem.
#### Items
- `Item` and `ItemFactory` now support negative item IDs (needed for future extended blocks support).
- Updated `ItemIds` interface with new constants.
#### Permission
- Added a new `PermissionManager` class which encapsulates all of the permission-management functionality originally bloating `PluginManager`. The API is identical to that of `PluginManager`'s permission API. All methods moved to `PermissionManager` have **`@deprecated`** redirects remaining behind in `PluginManager`, which will be removed in the next major release (4.0).
#### Plugin
- `PluginBase->getConfig()` will now automatically save the default config if it does not already exist.
- Plugin data directories will now be automatically created on plugin load, eliminating the need for boilerplate `@mkdir($this->getDataFolder())` calls at the top of every plugin.
#### Tile
- `Tile::createNBT()` will now throw a `BadMethodCallException` when called directly.
#### Utils
- `Utils::getURL()`, `Utils::postURL()`, `Utils::simpleCurl()` and `Utils::getIP()` have been moved to a new `pocketmine\utils\Internet` class. The original methods are **`@deprecated`** and will be removed for the next major version (4.0).
- Removed the ability for `Config` to be asynchronously saved. This was discussed for removal because of various problems that it causes. It was deemed not worth fixing since `Config` saving should not be significant enough to cause problems anyway. See #2298 for details.
#### Server
- Deprecated `level` parameter of `findEntity()`. This parameter was premature optimization. Code using it will continue to work as before.
### Gameplay
#### General
- Air bubbles are now regenerated at the same speed as vanilla UpdateAquatic, instead of instantly when leaving water.
- Implemented Conduit Power effect.
#### Enchantments
- Implemented the following enchantments: Thorns, Sharpness, Knockback, Fire Aspect, Power, Punch, Flame, Infinity, Mending.
#### Items
- Added the following new items: `Scute`
# 3.2.1
- Fixed `VerifyLoginTask` completion bug when players get disconnected prior to the task completing.
- Fixed client crash issue due to outdated runtime ID mappings.
# 3.2.2
- Updated NBT dependency to 0.2.1 to receive bug fixes (see https://github.com/pmmp/NBT/releases/tag/0.2.1).
# 3.2.3
- Errors thrown during level tick will now crash the server instead of spamming the console.
- Fixed arrows despawning too soon after hitting the ground.
- Fixed projectiles despawning before colliding if they were airborne for > 60 seconds.
- Fixed crash related to Flame enchantment when the player shooting the arrow was on fire.
# 3.2.4
- Fixed levels unloaded during an earlier level's tick on the same tick causing a crash.
- PermissibleBase->clearPermissions() now properly unsubscribes from all permissions.
- Fixed incorrect break check for standing torch.
- Fixed drops for brewing stand.
- Fixed block picking brewing stand, bed, double slab, cake, farmland, and mob heads giving the wrong items.
- Fixed blocks not placing correctly when clicking on redstone ore.
- Fixed unknown PC items in tile inventories crashing the server - now they'll be quietly removed instead.
- Fixed server freezing when eating chorus fruit from high altitude.
- `readline` is now disabled by default on Windows and must be explicitly enabled with `--enable-readline` due to thread-safety issues.
- Fixed server crash when trying to use non-implemented splash potions.
- Removed incorrect maximum region file size cap which may have caused some worlds to be incorrectly detected as corrupted.
# 3.2.5
- `Player->sendForm()` now throws a proper exception when failing to JSON-encode `Form` objects given to it.
- Fixed crash when handling later packets in a batch when an earlier packet triggered termination of the player's connection.
- Fixed a race condition causing progress updates in `AsyncTasks` to be lost when published near completion.
- Fixed bad decoding for some packets with unsupported structures.
- Crash dumps no longer report 20 empty lines when an error occurs in `eval()`'d code.
- `pocketmine/nbt` dependency updated to `0.2.2` to fix bugs (see NBT repo for changelog).
# 3.2.6
- Chunk ticking no longer occurs in chunks which have an adjacent unloaded chunks, fixing things like grass ticking triggering unintentional chunk loading.
- Fixed some lighting propagation issues where step count is the same but light level is different.
- Fixed full-chunk light repopulation producing broken lighting when the generator hasn't been registered on a worker.
- Fixed a missing field in `MoveEntityDeltaPacket`.
- Added client-sided rate limiting for crashdump reporting to mitigate involuntary DDoS of the crash archive.
- Fixed a bug in `start.cmd` where quotes would appear around the "couldn't find installation" message.
# 3.2.7
- Added a network-layer check for item NBT size to avoid unexplained client-sided crashes due to length overflow.
- Fixed some desync bugs with double chests when one half of a double chest is unloaded.
- Anonymous class timings will now have a cleaned path for the identifier relative to the plugins directory.
- Anonymous class timings now render correctly on timings.pmmp.io.
- Fixed empty garbage subchunks not getting removed from long-life chunks.
- `start.ps1`, `start.sh` and `start.cmd` no longer recognize source-code installations. Since source-code installations should only be used by developers who know what they are doing anyway, this was considered unwise to keep.
- Fixed a bug/oversight in network chunk preparation that caused chunk prepare to be 4x slower than necessary.
- `Chunk->fastSerialize()` now doesn't serialize useless data (data is omitted based on chunk flags). This significantly reduces the amount of useless data getting copied for generation, population and light calculation.
- `TaskHandler->cancel()` was incorrectly marked as `@internal` in 2014. This has been fixed. Plugin developers should in fact prefer `TaskHandler->cancel()` since it does not require a task to have a circular dependency on its own executor.

11
changelogs/3.20.md Normal file
View File

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

15
changelogs/3.21.md Normal file
View File

@ -0,0 +1,15 @@
**For Minecraft: Bedrock Edition 1.17.0**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.21.0
- PHP 7.4 is now required as a minimum.
- A workaround for player movement added in 1.14.30 has been removed.
# 3.21.1
- Fixed so-called 'pot lag' - a bug that could occur when using items while rapidly switching hotbar slots.
- Plugins in crashdumps are now ordered alphabetically for easier reading.

36
changelogs/3.22.md Normal file
View File

@ -0,0 +1,36 @@
**For Minecraft: Bedrock Edition 1.17.10**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.22.0
- Added support for Minecraft: Bedrock Edition 1.17.10.
- Removed compatibility with earlier versions.
# 3.22.1
- Added a giant yellow startup warning if using OPcache JIT on PHP 8.0. JIT is currently considered highly unstable and not recommended for production use.
- When using a bad PHP binary, the bootstrap will now report the used `php.ini` path. This can be useful for debugging issues with extension loading when the wrong `php.ini` file is loaded for some reason.
- Fixed `start.cmd` causing the wrong `php.ini` to be loaded on Windows when a global PHP installation is used.
- A debug message is now logged containing expected vs. actual XUID of players when an XUID mismatch is detected.
- Improved the documentation for `Player->getUniqueId()`.
- Fixed a mistake in the documentation of `PlayerAuthInputFlags`.
- Fixed incorrect encoding of `NpcDialoguePacket`.
# 3.22.2
- PHP 8.0 is now the primary supported version. PHP 7.4 is still supported for now, but it will be dropped in the coming weeks. It's recommended to start testing your servers on 8.0 now so you're ready.
- Fixed items in the crafting grid getting deleted on server-side disconnect or session timeout.
- A warning is now logged on startup if a debug build of PHP is used to run the server (because it has a significant performance impact).
- GitHub Actions is now used to build new releases, instead of Jenkins. You can see build logs [here](https://github.com/pmmp/PocketMine-MP/actions/workflows/draft-release.yml).
# 3.22.3
- Fixed a bug in the release build of 3.22.2 which caused the crash archive to reject all crashdumps.
- Fixed possible server crash during player spawning.
# 3.22.4
- Fixed a bug which broke the build of 3.22.3.
# 3.22.5
- Added a workaround for polyfilled solid-colour Persona skin replacements turning into a corrupted mess (caused by https://bugs.mojang.com/browse/MCPE-130275).

14
changelogs/3.23.md Normal file
View File

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

12
changelogs/3.24.md Normal file
View File

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

38
changelogs/3.25.md Normal file
View File

@ -0,0 +1,38 @@
**For Minecraft: Bedrock Edition 1.17.40**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.25.0
- Added support for Minecraft: Bedrock Edition 1.17.40.
- Removed compatibility with earlier versions.
# 3.25.1
- Fixed autosave bug that caused unmodified chunks to be saved at least once (during the first autosave after they were loaded).
- `Entity->spawnTo()` now has an additional sanity check for matching worlds (might expose a few new errors in plugins).
- Fixed a missing field in `CraftRecipeAuto` item stack request type.
# 3.25.2
- Now analysed using level 9 on PHPStan 1.0.0.
- `ext-pthreads` v4.0.0 or newer is now required.
- Fixed crash in `Player->showPlayer()` when the target is not in the same world.
- `Human->setLifetimeTotalXp()` now limits the maximum value to 2^31.
- Fixed players, who died in hardcore mode and were unbanned, getting re-banned on next server join.
# 3.25.3
- Fixed crash when players try to pickup XP while already having max XP.
- Added a sanity check to `Human->setCurrentTotalXp()` to try and catch an elusive bug that's been appearing in the wild - please get in touch if you know how to reproduce it!
# 3.25.4
- Fixed a long-standing issue with `Player->removeWindow()` breaking inventory UIs on the client.
# 3.25.5
- Protocol: Fixed incorrect encoding in `StructureSettings`
- Fixed reading tags from non-docblock comments in script plugins.
- Build number is now defined in phar metadata instead of being patched into the source code directly.
# 3.25.6
- Fixed borked build number in release build of 3.25.5.

28
changelogs/3.26.md Normal file
View File

@ -0,0 +1,28 @@
**For Minecraft: Bedrock Edition 1.18.0**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.26.0
- Added support for Minecraft: Bedrock Edition 1.18.0.
- Removed compatibility with earlier versions.
# 3.26.1
- Fixed a bug in chunk sending that caused double chests to not be paired, signs to be blank, and various other issues.
# 3.26.2
- Improved error messages shown by `start.cmd`, `start.sh` and `start.ps1` when the PHP binary was not found.
- The value of PHPRC is now shown when erroring out due to unsatisfied PHP requirements.
- Removed restriction on the range of valid channels for `auto-updater.channel` in `pocketmine.yml`.
# 3.26.3
- `PlayerExperienceChangeEvent->setNewProgress()` now performs range checks. This fixes the root of a very old and confusing crash bug which took several years to identify the cause of.
- Note that the defective plugin(s) which caused this problem will still cause a server crash, but the plugin responsible will now get blamed correctly.
# 3.26.4
- Fixed skins appearing black when using RTX resource packs.
- Fixed chunks containing furnaces in old worlds (pre-2017) being discarded as corrupted.
- This was caused by a strict corruption check detecting bad data created by a bug in PocketMine-MP that was fixed in 2017.

44
changelogs/3.3.md Normal file
View File

@ -0,0 +1,44 @@
**For Minecraft: Bedrock Edition 1.7.0**
### Note
Plugins compatible with any previous 3.x.y version will also run on these releases and do not need API bumps. Plugin developers should **only** update their required API to this version if you need the bug fixes in this build.
# 3.3.0
- Compatibility with Minecraft: Bedrock Edition 1.7.0
- Removed compatibility with 1.6.0
- `Player->sendForm()` now throws a proper exception when failing to JSON-encode `Form` objects given to it.
- Fixed crash when handling later packets in a batch when an earlier packet triggered termination of the player's connection.
- Fixed a race condition causing progress updates in `AsyncTasks` to be lost when published near completion.
- Fixed bad decoding for some packets with unsupported structures.
- Crash dumps no longer report 20 empty lines when an error occurs in `eval()`'d code.
- `pocketmine/nbt` dependency updated to `0.2.2` to fix bugs (see NBT repo for changelog).
# 3.3.1
- Chunk ticking no longer occurs in chunks which have an adjacent unloaded chunks, fixing things like grass ticking triggering unintentional chunk loading.
- Fixed some lighting propagation issues where step count is the same but light level is different.
- Fixed full-chunk light repopulation producing broken lighting when the generator hasn't been registered on a worker.
- Fixed a missing field in `MoveEntityDeltaPacket`.
- Added client-sided rate limiting for crashdump reporting to mitigate involuntary DDoS of the crash archive.
- Fixed a bug in `start.cmd` where quotes would appear around the "couldn't find installation" message.
# 3.3.2
- Added a network-layer check for item NBT size to avoid unexplained client-sided crashes due to length overflow.
- Fixed some desync bugs with double chests when one half of a double chest is unloaded.
- Anonymous class timings will now have a cleaned path for the identifier relative to the plugins directory.
- Anonymous class timings now render correctly on timings.pmmp.io.
- Fixed empty garbage subchunks not getting removed from long-life chunks.
- `start.ps1`, `start.sh` and `start.cmd` no longer recognize source-code installations. Since source-code installations should only be used by developers who know what they are doing anyway, this was considered unwise to keep.
- Fixed a bug/oversight in network chunk preparation that caused chunk prepare to be 4x slower than necessary.
- `Chunk->fastSerialize()` now doesn't serialize useless data (data is omitted based on chunk flags). This significantly reduces the amount of useless data getting copied for generation, population and light calculation.
- `TaskHandler->cancel()` was incorrectly marked as `@internal` in 2014. This has been fixed. Plugin developers should in fact prefer `TaskHandler->cancel()` since it does not require a task to have a circular dependency on its own executor.
# 3.3.3
- Development build error messages are now more user friendly.
- Fixed meta-only changes not getting saved correctly in `SubChunk->setBlock()`.
- Server will now sleep for up to 120 seconds on a crash if the uptime was less than 120 seconds. This delay is intended to reduce crash archive spam and can be skipped by the user if attended by pressing CTRL+C.
- Fixed preprocessed builds sometimes having `new ` calls treated as function calls.
- Fixed a rare corruption case where player data could be written incorrectly due to a race condition.
- `DataPacket` will now throw errors when attempting to read/write nonexisting fields to make it easier to debug protocol change errors.
# 3.3.4
- Fixed an undefined `DataPacket` field making the previous release unusable.

97
changelogs/3.4.md Normal file
View File

@ -0,0 +1,97 @@
**For Minecraft: Bedrock Edition 1.7.0**
This is a cumulative minor release featuring performance improvements, memory usage improvements, some new minor gameplay features, some API deprecations and additions, and significant changes to error handling.
### Note
Plugins compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
However, some API features have been deprecated in this version. Plugin developers do not need to do anything about these deprecations immediately, however they may raise harmless warnings if used.
Features marked **`@deprecated`** are **recommended** not to be used, but will continue to work for any future 3.x.y versions. They will be removed in the next major release (4.0).
# 3.4.0
## Core changes
### Performance & memory improvements
- Entity `EXHAUSTION` attribute is no longer synced to the client, which reduces network traffic for survival players and reduces client-sided lag.
- A redundant call was removed from an `Event` call hot path which improves event calling performance by ~15% per event handler executed.
- Light updates are now batched together and executed on the end of each tick. The effects of this are noticeable when setting a large number of blocks in a close area - significant performance improvements should be noticeable for world editors (the ones that didn't disable light updates) and liquid flow is now significantly less expensive.
- Internal enhancements have been made to subchunk light array interfacing to reduce branching and improve access performance.
- Memory usage of most chunks has dropped by ~30-40% due to some improvements to internal storage of unlit subchunks. In real terms this translates to ~30% memory usage reduction for a freshly generated world.
### Error handling
The most notable core change in this release revolves around error handling. Internals have been cleaned up substantially to improve the server behaviour under occurrence of unexpected behaviour. The goal of this is to improve consistency and quality while reducing undefined runtime behaviour.
The following changes have been made:
- Throwing **unexpected** `Throwable`s in the following cases will now cause a server crash (except on network (this will be changed in the future)):
- Event handlers
- `Task->onRun()` on a scheduler
- `AsyncTask->onCompletion()`
- `Command->execute()` and `CommandExecutor->onCommand()`
- Unexpected `Throwable`s thrown during packet handling will now cause the target player to be disconnected with an `Internal server error` message.
### Other changes
- Anti-flight has been removed, along with the `allow-flight` directive in `server.properties`.
- Server language is now controlled by the `language` directive in `server.properties`.
- Added `unban` and `unban-ip` as aliases of `pardon` and `pardon-ip` commands respectively.
## API changes
### Block
- `BlockSpreadEvent` is now fired when lava or water tries to flow into a block.
- `BlockFormEvent` is now fired when lava and water collide to form cobblestone, obsidian or stone.
### Event
- Added new method `Event->call()`. This should be used instead of `PluginManager->callEvent()` in plugins only supporting 3.4+.
- `PluginManager->callEvent()` has been `@deprecated`.
### Level
- Attempting to unload a level during its tick will now throw an `InvalidStateException`.
- Added the following new methods:
- `Level->broadcastPacketToViewers()`
- `Level->getViewersForPosition()`
- `Level->broadcastGlobalPacket()`
- `Level->getChunkAtPosition()`
- `Level->isInLoadedTerrain()`
- `Level->addGlobalPacket()` has been `@deprecated`.
- `LightUpdate` now allows calling `setAndUpdateLight()` for the same position multiple times (needed for light update batching).
### Permission
- `Permission::getByName()` now throws an exception on invalid values instead of silently returning `DEFAULT_FALSE`. This may cause new errors to appear if your plugins had broken permission defaults in `plugin.yml`.
### Player
- `addWindow()` now has stricter validity checks and will now throw exceptions in the following cases: No window IDs left to use, and when a forced window ID collides with an existing window.
- The public `$speed` field has been removed (this was only used by anti-cheat which has now been removed).
### Scheduler
- `AsyncTask->setResult()` has had the `$serialize` parameter removed - now it will automatically serialize (or not) as appropriate.
- Added a new `ClosureTask` which allows concisely scheduling closure execution on a `TaskScheduler`.
- `TaskScheduler->__construct()` `$logger` parameter has been `@deprecated` and will be removed in a future major version.
### Server
- Added new method `Server->hasOfflinePlayerData(string $name) : bool`.
- `Server->getAllowFlight()` has been `@deprecated`.
### Utils
- `Config->save()` will no longer catch unexpected exceptions thrown while encoding data.
## Gameplay changes
### Blocks
- Rail connectivity has been implemented for normal, powered, detector and activator rails (but there are currently no minecarts).
# 3.4.1
- Updated crashdump format to be compatible with newest CA. This version or newer is required if you want to be able to submit crashdumps to crash.pmmp.io.
# 3.4.2
- `DataPacket` errors when writing to undefined fields are now more clear.
- Fixed trees being able to overwrite the log parts of other trees.
- Fixed `Player->sendForm()` not working during `PlayerJoinEvent`.
- `Entity->setScale()` now explicitly requires a scale larger than 0.
- Adding invisible `FloatingTextParticle` to a level no longer causes an error.
# 3.4.3
- Fixed burning TNT setting hurt entities on fire when exploding.
- `~` relative coordinates now work in the `/particle` command.
- Various boring fixes to error stack trace reporting.
- `Level->setChunk()` no longer deletes tiles and entities when replacing a chunk with itself.
- Fixed a generator race condition causing rare appearances of half-trees on the client in freshly generated terrain.
- `Attribute->resetToDefault()` now fits the default per the min/max bounds, fixing crashes when the bounds are changed to exclude the default.
- Fixed a crash with LevelDB worlds when the `TAG_2D_MAPS` tag is missing.
- Fixed `Utils::getCoreCount()` crashing on some Debian variants.

149
changelogs/3.5.md Normal file
View File

@ -0,0 +1,149 @@
**For Minecraft: Bedrock Edition 1.8.0**
### Note
Plugins compatible with any previous 3.x.y version will also run on these releases and do not need API bumps. Plugin developers should **only** update their required API to this version if you need the changes in this build.
# 3.5.0
- Compatibility with Minecraft: Bedrock Edition 1.8.0
- Removed compatibility with 1.7.0
# 3.5.1
- Fixed internal server errors when attempting to craft.
- `DataPacket` errors when writing to undefined fields are now more clear.
- Fixed trees being able to overwrite the log parts of other trees.
- Fixed `Player->sendForm()` not working during `PlayerJoinEvent`.
- `Entity->setScale()` now explicitly requires a scale larger than 0.
- Adding invisible `FloatingTextParticle` to a level no longer causes an error.
# 3.5.2
- Updated some misc protocol magic numbers.
- Fixed burning TNT setting hurt entities on fire when exploding.
- `~` relative coordinates now work in the `/particle` command.
- Various boring fixes to error stack trace reporting.
- `Level->setChunk()` no longer deletes tiles and entities when replacing a chunk with itself.
- Fixed a generator race condition causing rare appearances of half-trees on the client in freshly generated terrain.
- `Attribute->resetToDefault()` now fits the default per the min/max bounds, fixing crashes when the bounds are changed to exclude the default.
- Fixed a crash with LevelDB worlds when the `TAG_2D_MAPS` tag is missing.
- Fixed `Utils::getCoreCount()` crashing on some Debian variants.
# 3.5.3
- Rewritten documentation of `PlayerPreLoginEvent`, `PlayerLoginEvent` and `PlayerJoinEvent`. They are now much more detailed and no longer misleading.
- Chest items block-picked from double chests will no longer place chests that crash the server when opened.
- Ender chests now make the correct sounds when opening and closing.
- Fixed Sign errors when a buggy or malicious client sent broken NBT with the wrong tags or wrong number of lines.
- Resource packs with comments in the manifest will now load correctly. (MOJANG!!!)
- Placement of unknown blocks is now disallowed. This solves a range of problems with invalid blocks in the world, such as #2260 .
- Errors thrown during `PlayerQuitEvent` or other `Player->close()` errors will now crash the server instead of causing cryptic bugs later on.
- Fixed large chunks (>= 1044476 bytes) becoming corrupted when saved in Region-based worlds - now an exception is thrown instead.
- Reduced the range of exceptions caught during chunk loading. Now, only chunk corruption errors are caught, and anything else will produce a crash.
- Removed catch-all block on chunk saving. Unexpected errors thrown during chunk save will now create a crash.
- Fixed some asserts in packet decode methods.
- `Attribute` now throws exceptions with more informative messages on errors.
- Properly handled some remaining `Uninitialized string offset` bugs when decoding packets.
- Fixed chunk updates taking several seconds to show up on the client. This bug was most apparent during generation and some world editing tools using asynchronous tasks.
- Fixed CPU waste ordering chunks for non-moving players.
# 3.5.4
### Fixes
- Fixed server crash when a block update occurs on a torch with corrupted metadata.
- Added a hack to mitigate client-side right-click spam bug. This mostly eliminates spam of `PlayerInteractEvent` on right-click.
- Players will no longer see commands they don't have permission to use in client-sided hints when typing a `/` in the chat window.
- `Event->isCancelled()` and `Event->setCancelled()` now throw more informative errors.
- Errors thrown during a network interface processing will now _actually_ crash the server.
### API changes
- Deprecated `NetworkInterfaceCrashEvent`. Nobody should have been using this anyway.
- Deprecated `Network->processInterface()`
- Deprecated `SourceInterface->emergencyShutdown()`
# 3.5.5
- Mobs no longer spawn with their heads facing a different direction to their bodies.
- Added a console message when the crash strangler sleeps to stop crash spam.
- Fixed crash in `/title` command `times` subcommand when not enough arguments were passed.
- AsyncWorkers will now not be shut down on GC unless they have not been used for the last 5 minutes. This reduces lag spikes on garbage collection.
- Fixed some unhandled error cases in `AddEntityPacket` encoding.
- Fixed `LogicException` descendents being thrown from some packet decoding methods when encountering bad userdata.
- Player network inventory transaction processing now catches more specific errors.
- Fixed missing decode for `TakeItemEntityPacket`.
- Fixed `/gc` and `/status` truncating memory statistics - now they report to 0.01 precision.
- Global functions and constants are now imported to improve performance.
- Fixed a typo in `pocketmine.command.op.take` description.
- Ice no longer creates water when a creative player breaks it.
- `spawn-mobs` and `spawn-animals` no longer appear in generated `server.properties` on a newly-installed server.
- Added a hack to disable pre-spawn client-sided movement.
- Assertions enabled warning now always shows when `zend.assertions` is not `-1`. The config option to disable this warning has been removed.
- `/status`,`/dumpmemory` and `/gc` are now enabled by default. The `debug.commands` config option has been removed.
- Crash dumps are now more thorough at catching plugin-related crashes.
# 3.5.6
- Fixed `#`-commenting properties in `.properties` files not working.
- `pocketmine.yml` now permits writing `worldname:` with no generation settings in the `worlds` section to force a world to be loaded.
- Fixed Bow force being too low - now it's consistent with Minecraft Java (but not with Bedrock due to a vanilla bug).
- Fixed `recursion detected` bug when encoding crashdumps in some cases.
- Items with too-large NBT tags on network will now have their tags ignored when sending over network, instead of crashing the server. This is a workaround for a protocol bug which will be addressed in a future Minecraft release.
- `/enchant` no longer crashes the server when out-of-bounds enchantment levels are used.
- Fixed some crashes loading Region-based worlds when encountering unexpected EOF.
- `Entity->fireTicks` is now protected (but accessible by magic method for BC purposes) and will now throw an exception when written to if the value is > 32767 or < 0.
- Fixed Signs asserting on corrupted world data with more than 4 lines of text per sign.
# 3.5.7
- Fixed several bugs in RCON packet receive that would allow an attacker to block or crash the RCON thread, denying service to other legitimate RCON clients.
- Fixed RCON connections not working (timing out with no response) on some platforms.
- Logins are now permitted to have up to 60 seconds clock drift on the `nbf` and `exp` timestamps in the login JWT.
- Fixed XP orbs following players who switched to a location spatially nearby in a different world.
- `Player->removeWindow()` now throws `InvalidArgumentException` instead of `BadMethodCallException` when trying to non-forcefully remove a fixed window ID.
# 3.5.8
- Fixed player XP not dropping if a player was fast enough to respawn.
- Player XP drop amount now matches vanilla (7x level points, incurs some loss of points for higher levels)
- Fixed Doxygen configuration including test sources.
- Improved performance of block-cache accesses.
- Improved performance of random block-ticking.
- Closure tasks will now show the correctly formatted name on timings.
- Fixed a crash when a local update happens next to an `ItemFrame` with invalid metadata.
- Fixed player being subscribed to broadcast permissions too early when permissions are modified before spawn.
- Block-picking is now disallowed on unknown blocks.
- Internal IP detection now works correctly on all platforms.
- Fixed UPnP portforwarding not working correctly when multiple network adapters are installed.
- Starting or stopping flight now resets fall distance and in-air ticks.
- Fixed falling causing starvation.
- Fixed crops consuming bone meal when fully grown.
- Users are no longer able to avoid agreeing to the license by restarting the server.
- Explosions no longer create broken double chests which crash the server. Existing chests affected by this bug will continue to crash. This will be addressed in a future release.
- Cactus and sugarcane no longer grow through non-air blocks.
- Fixed a memory leak in `setChunk()` when the `unload` parameter is true.
- Generator will now crash if preset is invalid, instead of producing unexpected results.
# 3.5.9
- Fixed a `setChunk()` bug introduced by 3.5.8.
- Applied a hack to disable client-sided automatic regeneration.
- `Level->getChunkPlayers()` is now deprecated.
# 3.5.10
- Some internal `Level` functions are now correctly marked `@internal`.
- Fixed splash potion distance being measured from player feet instead of eye height.
- Fixed tall grass being unplaceable on dirt.
- A debug message is now recorded when a chunk is loaded with no associated loaders.
- Composer dependencies have been updated to fix bugs in some dependencies.
# 3.5.11
- Fixed crashing when items with negative IDs are found in the inventory (caused by downgrading from dev builds).
- Updated creative inventory and crafting recipes.
# 3.5.12
- Fixed crash when too-large values are given to `/effect` for duration.
- `/op` and other commands no longer crash when an invalid player name is given.
- Startup time no longer includes the time spent in the setup wizard.
- `TextFormat::clean()` is now UTF-8 aware, and will scrub any invalid UTF-8 characters from the given string.
- Fixed `TextFormat::clean()` not fully removing ANSI escape codes in some cases.
- Fixed Korean command arguments failing to parse.
- `Sign->setText()` and `Sign->setLine()` now enforce that the given text must be UTF-8 text, or an exception will be thrown.
- Sign text is now processed by `mb_scrub()` immediately after loading to remove invalid UTF-8 characters that could crash the client.
- `Human->exhaust()` no longer underflows when the hunger attribute has a fractional value.
# 3.5.13
- Added a hack to disable client sided AI for non-moving entities. This fixes items floating in water despite it not being implemented server-side yet.
- Fixed max health not working as expected on respawn if changed by plugins.
- Fixed Item Frame hardness (0.25 instead of 0).
- Fire Aspect tools will now light TNT when right-clicked with.
- Fixed incorrect nullable typehints on `TaskScheduler` return values.

65
changelogs/3.6.md Normal file
View File

@ -0,0 +1,65 @@
**For Minecraft: Bedrock Edition 1.9.0**
### Note
Plugins compatible with any previous 3.x.y version will also run on these releases and do not need API bumps. Plugin developers should **only** update their required API to this version if you need the changes in this build.
This changelog **does not account for protocol changes**. If your plugin uses the protocol, you're not shielded by API change constraints.
# 3.6.0
- Compatibility with Minecraft: Bedrock Edition 1.9.0
- Removed compatibility with 1.8.0
- `Item->getCompoundTag()` is now `@deprecated`.
- `Item->setCompoundTag()` now accepts NULL as a possible value.
- `ItemFactory::fromString()` now accepts NULL for the `tags` parameter.
# 3.6.1
- Fixed crashing when items with negative IDs are found in the inventory (caused by downgrading from dev builds).
- Updated creative inventory and crafting recipes.
- Fixed handling for some new blocks which magically appeared without appropriate implementations (extra meta values).
# 3.6.2
- Fixed client-sided crash when upper-case letters appear in command names.
- Fixed crash when too-large values are given to `/effect` for duration.
- `/op` and other commands no longer crash when an invalid player name is given.
- Startup time no longer includes the time spent in the setup wizard.
- `TextFormat::clean()` is now UTF-8 aware, and will scrub any invalid UTF-8 characters from the given string.
- Fixed `TextFormat::clean()` not fully removing ANSI escape codes in some cases.
- Fixed Korean command arguments failing to parse.
- `Sign->setText()` and `Sign->setLine()` now enforce that the given text must be UTF-8 text, or an exception will be thrown.
- Sign text is now processed by `mb_scrub()` immediately after loading to remove invalid UTF-8 characters that could crash the client.
- `Human->exhaust()` no longer underflows when the hunger attribute has a fractional value.
# 3.6.3
- Added a hack to disable client sided AI for non-moving entities. This fixes items floating in water despite it not being implemented server-side yet.
- Fixed max health not working as expected on respawn if changed by plugins.
- Fixed Item Frame hardness (0.25 instead of 0).
- Fire Aspect tools will now light TNT when right-clicked with.
- Fixed incorrect nullable typehints on `TaskScheduler` return values.
# 3.6.4
- `NetworkStackLatencyPacket` unhandled debug has been silenced.
- Fixed `Player->removeWindow()` removing GUI or crashing clients when removing a window which was not added.
- Fixed packed ice dropping itself when mined without a silk touch pickaxe.
- Fixed players not taking fall damage when falling off the side of a ladder when their AABB was intersecting with the ladder's full block area.
- Fixed arrows reloaded from disk never despawning.
- Fixed player XP not dropping on death.
- Fixed player's held slot being out of sync when respawning.
- Fixed items with different NBT being considered stackable in some cases by `BaseInventory->canAddItem()`.
# 3.6.5
- Fixed stdout silence on crash if a crash occurs when PHP output buffering is enabled.
- Fixed `RegionLoader` considering a range of invalid chunk coordinates as valid.
- Fixed `RegionLoader` causing region header corruption when an oversized chunk was discovered. This was causing entire regions to be discarded next time they were freshly loaded.
- Fixed performance issue loading old LevelDB worlds (from before MCPE 1.0) due to unmodified chunks being converted every time they were loaded.
- Added new debug messages when a world takes too long (longer than 50ms) to complete a tick.
- Debug messages are now logged when autosave kicks in (with time measurements), which helps debugging unexplained lag spikes.
- Level "auto tick rate" anti-feature and its associated `pocketmine.yml` settings have been removed (see #2665). The settings will persist in old configurations, but will be ignored by this version and future versions.
- The `/save-all` command now outputs custom (non-vanilla) messages informing the user how long it took to complete autosaving.
- The word `level` has been replaced with `world` (where appropriate) throughout language strings and general user interface messages.
# 3.6.6
- Fixed protocol argument types for commands.
- Autosave debug message will now report in milliseconds when the time taken is less than 1 second.
- Flatworld presets now allow `*` as a multiplier symbol (fixes PC compatibility).
- Network runtimeIDs for blocks are now randomized to prevent things (like plugins) relying on them.
- Updated NBT dependency to 0.2.7 for some bug fixes.

33
changelogs/3.7.md Normal file
View File

@ -0,0 +1,33 @@
**For Minecraft: Bedrock Edition 1.10.0**
### Note
Plugins compatible with any previous 3.x.y version will also run on these releases and do not need API bumps. Plugin developers should **only** update their required API to this version if you need the changes in this build.
This changelog **does not account for protocol changes**. If your plugin uses the protocol, you're not shielded by API change constraints.
# 3.7.0
- Compatibility with Minecraft: Bedrock Edition 1.10.0
- Removed compatibility with 1.9.0
# 3.7.1
- Fixed protocol argument types for commands.
- Autosave debug message will now report in milliseconds when the time taken is less than 1 second.
- Flatworld presets now allow `*` as a multiplier symbol (fixes PC compatibility).
- Network runtimeIDs for blocks are now randomized to prevent things (like plugins) relying on them.
- Updated NBT dependency to 0.2.7 for some bug fixes.
# 3.7.2
- Fixed a memory leak when `PlayerLoginEvent` is cancelled.
- Fixed permissions `pocketmine.command.ban.list`, `pocketmine.command.difficulty`, `pocketmine.command.whitelist.enable` and `pocketmine.command.whitelist.disable` always being granted to operators.
- Fixed some commands outputting `commands.generic.permission` instead of the proper message when running commands that the sender doesn't have permission to use.
- Worlds with unknown generator types will now refuse to load instead of getting incorrect terrain generation ruining them.
- `TextFormat::tokenize()` no longer corrupts Unicode sequences.
- `TextFormat::clean()` now removes non-printable Unicode code points in the private-use area.
- Running two servers in the same data directory is no longer allowed and will gracefully halt instead of corrupting your data.
- Sign text length is now soft-capped at 1000 characters.
# 3.7.3
- World save timings now include saves that are triggered by chunk unloading.
- Fixed several network denial-of-service bugs.
- A warning is now emitted when the `ChunkUtils` extension is not loaded.
- Moved version constants to a separate `VersionInfo` file for easier parsing and handling.

69
changelogs/3.8.md Normal file
View File

@ -0,0 +1,69 @@
**For Minecraft: Bedrock Edition 1.11.0**
### Note
Plugins compatible with any previous 3.x.y version will also run on these releases and do not need API bumps. Plugin developers should **only** update their required API to this version if you need the changes in this build.
This changelog **does not account for protocol changes**. If your plugin uses the protocol, you're not shielded by API change constraints.
# 3.8.0
- Compatibility with Minecraft: Bedrock Edition 1.11.0
- Removed compatibility with 1.10.0
# 3.8.1
- Fixed furnace smelting recipes not working.
- Reduced legacy hacks dealing with `BatchPacket` to fix possible ID collisions.
- Reduced release phar size by minifying JSON data blobs.
- Moved some MCPE-specific JSON blobs to submodule.
# 3.8.2
- Fixed --enable-ansi and --disable-ansi not being respected on threads.
- Fixed a crash that could occur when decoding `AvailableCommandsPacket`.
- Fixed a crash when loading worlds with entities with missing `Motion` NBT tag.
- Fixed a crash when world time overflows signed int64 max.
- Fixed world generators and providers being registered too late (this was causing plugin issues).
- Updated RakLib version to get a security fix.
- Fixed errors when custom clients fill the wrong information in `ResourcePackClientResponsePacket`.
- Fixed `setImmobile()` getting overridden directly after `PlayerJoinEvent`.
- Fixed air being breakable by creative players.
- Fixed performance loss caused by bugs in the preprocessor.
# 3.8.3
- Fixed infinite recursion when using `Entity->close()` during `EntityDespawnEvent`.
- Fixed crash reports caused by folder plugins being reported to the crash archive.
- Fixed spawning entities on unloaded chunks during spawn sequence (possible client crash cause).
- Fixed `/time query` output message.
- Fixed `Server->hasOfflinePlayerData()` being case-sensitive.
- Improved error messages for skin validation in some places.
- Fixed classic stonecutter hardness.
- Fixed iron trapdoors being considered a valid furnace fuel.
- Fixed apple dropping from leaves happening less frequently than intended.
- Fixed tall plants like sunflower being replaceable by the top half.
# 3.8.4
- Plugin load order is now randomised to remove the ability to implicitly depend on filesystem-specific ordering.
- Packet logging in debug messages now uses base64 instead of hex (uses less space).
- Array and string size are now shown in error stack trace logs.
- Stack traces now render a maximum of 80 characters when making string parameters printable.
- Improved documentation for some transaction classes.
- Action order in inventory transactions is now randomised to prevent dependencies on any accidental or client-dependent ordering. Since the transaction system is specifically designed to avoid depending on order, this does not affect any core functionality.
# 3.8.5
- Moved preprocessor to build/ directory.
- Added documentation for `Server->getPlayer()`, `Server->getPlayerExact()` and `Server->matchPlayer()`.
- `server.lock` now contains the PID of the currently-running server.
- PID of server is now reported in the error message when attempting to run two servers from the same data directory at once.
- Fixed sluggish playercount updating on MOTD.
- Added new MultiRecipe UUIDs.
- Added an extra field to `StartGamePacket` to resolve minor incompatibility issues on different 1.11.x patch versions.
# 3.8.6
- Fixed `Entity->isNameTagAlwaysVisible()` not working.
- Log messages are now cleaned of invalid UTF-8 sequences before emitting them.
- Fixed negative integers being considered as strings for world seeds.
- Fixed out-of-bounds access on invalid inventory data in player data saves.
- Fixed crash when custom liquids have flow decays which aren't factors of 4.
- Fixed `Entity->noDamageTicks` not working when the entity had no previous damage cause.
# 3.8.7
- Improved documentation of `Player->getDisplayName()` and `Player::isValidUserName()`.
- Fixed a bug in `SetScorePacket` decoding causing the entry list to always be empty.

129
changelogs/3.9.md Normal file
View File

@ -0,0 +1,129 @@
**For Minecraft: Bedrock Edition 1.12.0**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 3.x.y version will also run on these releases and do not need API bumps.
Plugin developers should **only** update their required API to this version if you need the changes in this build.
**WARNING: If your plugin uses the protocol, you're not shielded by API change constraints.** You should consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you do.
# 3.9.0
- Added support for Minecraft: Bedrock Edition 1.12.0
- Removed compatibility with 1.11.0
## Protocol
- The following classes in the `\pocketmine\network\mcpe\protocol` namespace have been renamed:
- `AddEntityPacket` -> `AddActorPacket`
- `AddItemEntityPacket` -> `AddItemActorPacket`
- `AvailableEntityIdentifiersPacket` -> `AvailableActorIdentifiersPacket`
- `BlockEntityDataPacket` -> `BlockActorDataPacket`
- `EntityEventPacket` -> `ActorEventPacket`
- `EntityFallPacket` -> `ActorFallPacket`
- `EntityPickRequestPacket` -> `ActorPickRequestPacket`
- `MoveEntityAbsolutePacket` -> `MoveActorAbsolutePacket`
- `MoveEntityDeltaPacket` -> `MoveActorDeltaPacket`
- `RemoveEntityPacket` -> `RemoveActorPacket`
- `SetEntityDataPacket` -> `SetActorDataPacket`
- `SetEntityLinkPacket` -> `SetActorLinkPacket`
- `SetEntityMotionPacket` -> `SetActorMotionPacket`
- `TakeItemEntityPacket` -> `TakeItemActorPacket`
- The following classes in the `\pocketmine\network\mcpe\protocol` namespace have been removed:
- `FullChunkDataPacket`
- The following classes in the `\pocketmine\network\mcpe\protocol` namespace have been added:
- `AddEntityPacket` (not to be confused with the old one)
- `ClientCacheBlobStatusPacket`
- `ClientCacheMissResponsePacket`
- `ClientCacheStatusPacket`
- `LevelChunkPacket`
- `RemoveEntityPacket` (not to be confused with the old one)
- `StructureTemplateDataExportRequestPacket`
- `StructureTemplateDataExportResponsePacket`
# 3.9.1
- Fixed resource packs not working on 1.12 clients.
- Fixed some particles displaying incorrectly (some still don't render at all).
- Fixed `Entity->setFireTicks()` with a value of `0` setting the on-fire flag.
- Silenced a debug message which appeared every time a player right-clicked a block.
- Updated constants for `LevelSoundEventPacket`.
# 3.9.2
- Logger warnings for illegal player movements have been lowered to debug.
- TNT explosions now start from the center instead of the base. This fixes unexpected results when TNT is lit on top of obsidian.
- Fixed the `loadbefore` directive in `plugin.yml` sometimes being ignored.
- Fixed `Item->setCustomName()` with an empty string leaving behind an empty tag.
- Fixed incorrect positioning of bucket empty sound.
- Fixed some incorrect tag parsing in `/give` involving quoted numbers.
# 3.9.3
- Fixed a memory leak on async task removal in error conditions.
- Fixed scheduled block updates (for example liquid) triggering chunk reloading. This could cause a significant performance issue in some conditions.
- Fixed some minor cosmetic issues in documentation.
# 3.9.4
- Fixed a memory leak when scheduled updates were pending on a chunk being unloaded.
- Fixed plugin detection in crashdumps. Previously `src/pocketmine` anywhere in the path would cause the error to be considered a core crash, regardless of the preceding path.
- Fixed entity metadata types for 1.12. The SLOT type was removed and a COMPOUND_TAG type added. This change involves changes to internal API which may break plugins. **See the warning at the top of this changelog about API versioning.**
- Fixed random and base populator amounts of trees and tallgrass never being initialized. This bug had no obvious effect, but may have become a problem in future PHP versions.
- The following internal methods have been marked as `@deprecated` and documentation warnings added:
- `Entity->getBlocksAround()`
- `Entity->despawnFrom()`
- `Entity->despawnFromAll()`
- Fixed plugin `softdepend` not influencing load order when a soft-depended plugin had an unresolved soft dependency of its own.
- Fixed endless falling of sand on top of fences.
# 3.9.5
- Fixed some issues with multiple consecutive commas inside quotes in form responses.
- Fixed server crash when the manifest json does not contain a json object in a resource pack.
- Ender pearls no longer collide with blocks that do not have any collision boxes.
# 3.9.6
- Updated Composer dependencies to their latest versions.
- Prevent clients repeating the resource pack sequence. This fixes error spam with bugged 1.12 clients.
- `Internet::simpleCurl()` now includes the PocketMine-MP version in the user-agent string.
- Spawn protection is now disabled by default in the setup wizard.
- Default difficulty is now NORMAL(2) instead of EASY(1).
- Fixed crashing on corrupted world manifest and unsupported world formats.
- Fixed `/transferserver` being usable without appropriate permissions.
- `RegionLoader->removeChunk()` now writes the region header as appropriate.
- Fixed performance issue when loading large regions (bug in header validation).
- Fixed skin geometry being removed when the JSON contained comments.
- Added new constants to `EventPacket`.
- Added encode/decode for `StructureTemplateDataExportRequestPacket` and `StructureTemplateDataExportResponsePacket`.
- Fixed broken type asserts in `LevelChunkPacket::withCache()` and `ClientCacheMissResponsePacket::create()`.
- `types\CommandParameter` field `byte1` has been renamed to `flags`.
- Cleaned up public interface of `AvailableCommandsPacket`, removing fields which exposed details of the encoding scheme.
- Improved documentation for the following API methods:
- `pocketmine\item\Item`:
- `addCreativeItem()`
- `removeCreativeItem()`
- `clearCreativeItems()`
- `pocketmine\level\Explosion`:
- `explodeA()`
- `explodeB()`
- Fixed various cosmetic documentation inconsistencies in the core and dependencies.
# 3.9.7
- Fixed a crash that could occur during timezone detection.
- Squid no longer spin around constantly in enclosed spaces. Their performance impact is reduced.
- Cleaned up the bootstrap file.
# 3.9.8
- Added [PHPStan](https://github.com/phpstan/phpstan) configuration. PHPStan is now used on CI for automated QA, which should improve stability and quality going forward.
- The following constants are now autoloaded when loading the Composer autoloader:
- `pocketmine\NAME`
- `pocketmine\BASE_VERSION`
- `pocketmine\IS_DEVELOPMENT_BUILD`
- `pocketmine\BUILD_NUMBER`
- `INT32_MIN`
- `INT32_MAX`
- `INT32_MASK`
- Fixed memory leaks and crashes caused by plugin use of `Player->showPlayer()` and `Entity->spawnTo()`.
- Fixed crashes that could occur when tile classes were overridden with classes incompatible with the originals.
- Fixed improper handling of non-Compound root NBT tags on network itemstack decoding.
- Fixed paintings dropping multiple items when destroyed by block updates.
- Fixed `var_dump()` not showing private and protected properties of `DataPacket` subclasses.
- Fixed overloads with zero arguments being missing when decoding `AvailableCommandsPacket`.
- `CraftingDataPacket` now retains the `cleanRecipes` field when decoding.
- Fixed `Block->getMetadata()` returning null (non-iterable).
- `PlayerChatEvent` documentation has been updated to specify that `CommandSender` recipients are accepted. This behaviour was already present in previous versions, but incorrectly documented.
- Fixed various issues with PHPDoc comments reported by PHPStan.
- Fixed various minor code nits reported by PHPStan.

1767
changelogs/4.0-beta.md Normal file

File diff suppressed because it is too large Load Diff

1593
changelogs/4.0.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,72 +1,94 @@
{
"name": "pocketmine/pocketmine-mp",
"description": "A server software for Minecraft: Pocket Edition written in PHP",
"description": "A server software for Minecraft: Bedrock Edition written in PHP",
"type": "project",
"homepage": "https://pmmp.io",
"license": "LGPL-3.0",
"require": {
"php": ">=7.2.0",
"php": "^8.0",
"php-64bit": "*",
"ext-bcmath": "*",
"ext-curl": "*",
"ext-chunkutils2": "^0.3.1",
"ext-crypto": "^0.3.1",
"ext-ctype": "*",
"ext-curl": "*",
"ext-date": "*",
"ext-gmp": "*",
"ext-hash": "*",
"ext-igbinary": "^3.0.1",
"ext-json": "*",
"ext-leveldb": "^0.2.1 || ^0.3.0",
"ext-mbstring": "*",
"ext-morton": "^0.1.0",
"ext-openssl": "*",
"ext-pcre": "*",
"ext-phar": "*",
"ext-pthreads": ">=3.1.7dev",
"ext-pthreads": "^4.0",
"ext-reflection": "*",
"ext-simplexml": "*",
"ext-sockets": "*",
"ext-spl": "*",
"ext-yaml": ">=2.0.0",
"ext-zip": "*",
"ext-zlib": ">=1.2.11",
"pocketmine/raklib": "^0.12.0",
"pocketmine/spl": "^0.3.0",
"pocketmine/binaryutils": "^0.1.0",
"pocketmine/nbt": "^0.2.1",
"pocketmine/math": "^0.2.0",
"pocketmine/snooze": "^0.1.0",
"daverandom/callback-validator": "dev-master",
"adhocore/json-comment": "^0.0.7"
"composer-runtime-api": "^2.0",
"adhocore/json-comment": "^1.1",
"fgrosse/phpasn1": "^2.3",
"netresearch/jsonmapper": "^4.0",
"pocketmine/bedrock-data": "^1.5.0+bedrock-1.18.0",
"pocketmine/bedrock-protocol": "^7.0.0+bedrock-1.18.0",
"pocketmine/binaryutils": "^0.2.1",
"pocketmine/callback-validator": "^1.0.2",
"pocketmine/classloader": "^0.2.0",
"pocketmine/color": "^0.2.0",
"pocketmine/errorhandler": "^0.3.0",
"pocketmine/locale-data": "^2.1.0",
"pocketmine/log": "^0.4.0",
"pocketmine/log-pthreads": "^0.4.0",
"pocketmine/math": "^0.4.0",
"pocketmine/nbt": "^0.3.2",
"pocketmine/raklib": "^0.14.2",
"pocketmine/raklib-ipc": "^0.1.0",
"pocketmine/snooze": "^0.3.0",
"ramsey/uuid": "^4.1",
"webmozart/path-util": "^2.3"
},
"require-dev": {
"phpstan/phpstan": "1.2.0",
"phpstan/phpstan-phpunit": "^1.0.0",
"phpstan/phpstan-strict-rules": "^1.0.0",
"phpunit/phpunit": "^9.2"
},
"autoload": {
"psr-4": {
"": ["src"]
}
"pocketmine\\": "src/"
},
"files": [
"src/CoreConstants.php"
]
},
"autoload-dev": {
"psr-4": {
"pocketmine\\": "tests/phpunit/"
"pocketmine\\": "tests/phpunit/",
"pocketmine\\phpstan\\rules\\": "tests/phpstan/rules"
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/pmmp/RakLib"
"config": {
"platform": {
"php": "8.0.0"
},
{
"type": "vcs",
"url": "https://github.com/pmmp/SPL"
},
{
"type": "vcs",
"url": "https://github.com/pmmp/BinaryUtils"
},
{
"type": "vcs",
"url": "https://github.com/pmmp/NBT"
},
{
"type": "vcs",
"url": "https://github.com/pmmp/Math"
},
{
"type": "vcs",
"url": "https://github.com/pmmp/Snooze"
}
]
"sort-packages": true
},
"scripts": {
"make-devtools": "@php -dphar.readonly=0 tests/plugins/DevTools/src/ConsoleScript.php --make tests/plugins/DevTools --out plugins/DevTools.phar",
"make-server": [
"@composer install --no-dev --classmap-authoritative --ignore-platform-reqs",
"@php -dphar.readonly=0 build/server-phar.php"
],
"update-registry-annotations": [
"@php build/generate-registry-annotations.php src"
],
"update-translation-apis": [
"@php build/generate-known-translation-apis.php"
]
}
}

3414
composer.lock generated

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

10
doxygen/index.md Normal file
View File

@ -0,0 +1,10 @@
## PocketMine-MP API Documentation
This site contains auto-generated API documentation for PocketMine-MP (and dependencies which are not outsourced). Documentation here is regenerated for every release.
This site can be accessed via https://apidoc.pmmp.io.
### Additional developer resources
- [DevTools](https://github.com/pmmp/DevTools/) - Development tools plugin for creating plugins
- [ExamplePlugin](https://github.com/pmmp/ExamplePlugin/) - Example plugin demonstrating some basic API features
- [DeveloperDocs](https://devdoc.pmmp.io) - General documentation for PocketMine-MP plugin developers

57
phpstan.neon.dist Normal file
View File

@ -0,0 +1,57 @@
includes:
- tests/phpstan/configs/actual-problems.neon
- tests/phpstan/configs/gc-hacks.neon
- tests/phpstan/configs/impossible-generics.neon
- tests/phpstan/configs/php-bugs.neon
- tests/phpstan/configs/phpstan-bugs.neon
- tests/phpstan/configs/runtime-type-checks.neon
- tests/phpstan/configs/spl-fixed-array-sucks.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
rules:
- pocketmine\phpstan\rules\DisallowEnumComparisonRule
- pocketmine\phpstan\rules\UnsafeForeachArrayOfStringRule
# - pocketmine\phpstan\rules\ThreadedSupportedTypesRule
parameters:
level: 9
checkMissingCallableSignature: true
treatPhpDocTypesAsCertain: false
bootstrapFiles:
- tests/phpstan/bootstrap.php
scanDirectories:
- build
- tests/plugins/TesterPlugin
- tools
scanFiles:
- src/PocketMine.php
paths:
- build
- src
- tests/phpstan/rules
- tests/phpunit
- tests/plugins/TesterPlugin
- tools
excludePaths:
analyseAndScan:
- build/php
dynamicConstantNames:
- pocketmine\VersionInfo::IS_DEVELOPMENT_BUILD
- pocketmine\DEBUG
- pocketmine\IS_DEVELOPMENT_BUILD
stubFiles:
- tests/phpstan/stubs/JsonMapper.stub
- tests/phpstan/stubs/leveldb.stub
- tests/phpstan/stubs/phpasn1.stub
- tests/phpstan/stubs/pthreads.stub
reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings
staticReflectionClassNamePatterns:
- "#^COM$#"
typeAliases:
#variadics don't work for this - mixed probably shouldn't work either, but for now it does
#what we actually need is something that accepts an infinite number of parameters, but in the absence of that,
#we'll just fill it with 10 - it's very unlikely to encounter a callable with 10 parameters anyway.
anyCallable: 'callable(never, never, never, never, never, never, never, never, never, never) : mixed'
anyClosure: '\Closure(never, never, never, never, never, never, never, never, never, never) : mixed'

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
#This configuration file allows you to control which plugins are loaded on your server.
#List behaviour
# - blacklist: Only plugins which ARE NOT listed will load.
# - whitelist: Only plugins which ARE listed will load.
mode: blacklist
#List names of plugins here.
plugins: []

190
resources/pocketmine.yml Normal file
View File

@ -0,0 +1,190 @@
# Main configuration file for PocketMine-MP
# These settings are the ones that cannot be included in server.properties
# Some of these settings are safe, others can break your server if modified incorrectly
# New settings/defaults won't appear automatically in this file when upgrading.
settings:
#Whether to send all strings translated to server locale or let the device handle them
force-language: false
shutdown-message: "Server closed"
#Allow listing plugins via Query
query-plugins: true
#Enable plugin and core profiling by default
enable-profiling: false
#Will only add results when tick measurement is below or equal to given value (default 20)
profile-report-trigger: 20
#Number of AsyncTask workers.
#Used for plugin asynchronous tasks, world generation, compression and web communication.
#Set this approximately to your number of cores.
#If set to auto, it'll try to detect the number of cores (or use 2)
async-workers: auto
#Whether to allow running development builds. Dev builds might crash, break your plugins, corrupt your world and more.
#It is recommended to avoid using development builds where possible.
enable-dev-builds: false
memory:
#Global soft memory limit in megabytes. Set to 0 to disable
#This will trigger low-memory-triggers and fire an event to free memory when the usage goes over this
global-limit: 0
#Main thread soft memory limit in megabytes. Set to 0 to disable
#This will trigger low-memory-triggers and fire an event to free memory when the usage goes over this
main-limit: 0
#Main thread hard memory limit in megabytes. Set to 0 to disable
#This will stop the server when the limit is surpassed
main-hard-limit: 1024
#AsyncWorker threads' hard memory limit in megabytes. Set to 0 to disable
#This will crash the task currently executing on the worker if the task exceeds the limit
#NOTE: THIS LIMIT APPLIES PER WORKER, NOT TO THE WHOLE PROCESS.
async-worker-hard-limit: 256
#Period in ticks to check memory (default 1 second)
check-rate: 20
#Continue firing low-memory-triggers and event while on low memory
continuous-trigger: true
#Only if memory.continuous-trigger is enabled. Specifies the rate in memory.check-rate steps (default 30 seconds)
continuous-trigger-rate: 30
garbage-collection:
#Period in ticks to fire the garbage collector manually (default 30 minutes), set to 0 to disable
#This only affects the main thread. Other threads should fire their own collections
period: 36000
#Fire asynchronous tasks to collect garbage from workers
collect-async-worker: true
#Trigger on low memory
low-memory-trigger: true
#Settings controlling memory dump handling.
memory-dump:
#Dump memory from async workers as well as the main thread. If you have issues with segfaults when dumping memory, disable this setting.
dump-async-worker: true
max-chunks:
#Cap maximum render distance per player when low memory is triggered. Set to 0 to disable cap.
chunk-radius: 4
#Do chunk garbage collection on trigger
trigger-chunk-collect: true
world-caches:
#Disallow adding to world chunk-packet caches when memory is low
disable-chunk-cache: true
#Clear world caches when memory is low
low-memory-trigger: true
network:
#Threshold for batching packets, in bytes. Only these packets will be compressed
#Set to 0 to compress everything, -1 to disable.
batch-threshold: 256
#Compression level used when sending batched packets. Higher = more CPU, less bandwidth usage
compression-level: 6
#Use AsyncTasks for compression. Adds half/one tick delay, less CPU load on main thread
async-compression: false
#Experimental. Use UPnP to automatically port forward
upnp-forwarding: false
#Maximum size in bytes of packets sent over the network (default 1492 bytes). Packets larger than this will be
#fragmented or split into smaller parts. Clients can request MTU sizes up to but not more than this number.
max-mtu-size: 1492
#Enable encryption of Minecraft network traffic. This has an impact on performance, but prevents hackers from stealing sessions and pretending to be other players.
#DO NOT DISABLE THIS unless you understand the risks involved.
enable-encryption: true
debug:
#If > 1, it will show debug messages in the console
level: 1
player:
#Choose whether to enable player data saving.
save-player-data: true
#If true, checks that joining players' Xbox user ID (XUID) match what was previously recorded.
#This also prevents non-XBL players using XBL players' usernames to steal their data on servers with xbox-auth=off.
verify-xuid: true
level-settings:
#The default format that worlds will use when created
default-format: leveldb
chunk-sending:
#To change server normal render distance, change view-distance in server.properties.
#Amount of chunks sent to players per tick
per-tick: 4
#Radius of chunks that need to be sent before spawning the player
spawn-radius: 4
chunk-ticking:
#Max amount of chunks processed each tick
per-tick: 40
#Radius of chunks around a player to tick
tick-radius: 3
#Number of blocks inside ticking areas' subchunks that get ticked every tick. Higher values will accelerate events
#like tree and plant growth, but at a higher performance cost.
blocks-per-subchunk-per-tick: 3
#IDs of blocks not to perform random ticking on.
disable-block-ticking:
#- 2 # grass
chunk-generation:
#Max. amount of chunks in the waiting queue to be populated
population-queue-size: 32
ticks-per:
autosave: 6000
auto-report:
#Send crash reports for processing
enabled: true
send-code: true
send-settings: true
send-phpinfo: false
use-https: true
host: crash.pmmp.io
anonymous-statistics:
#Sends anonymous statistics for data aggregation, plugin usage tracking
enabled: false #TODO: re-enable this when we have a new stats host
host: stats.pocketmine.net
auto-updater:
enabled: true
on-update:
warn-console: true
#Can be development, alpha, beta or stable.
preferred-channel: stable
#If using a development version, it will suggest changing the channel
suggest-channels: true
host: update.pmmp.io
timings:
#Choose the host to use for viewing your timings results.
host: timings.pmmp.io
console:
#Choose whether to enable server stats reporting on the console title.
#NOTE: The title ticker will be disabled regardless if console colours are not enabled.
title-tick: true
aliases:
#Examples:
#showtheversion: version
#savestop: [save-all, stop]
worlds:
#These settings will override the generator set in server.properties and allows loading multiple worlds
#Example:
#world:
# seed: 404
# generator: FLAT
# preset: 2;bedrock,59xstone,3xdirt,grass;1
plugins:
#Setting this to true will cause the legacy structure to be used where plugin data is placed inside the --plugins dir.
#False will place plugin data under plugin_data under --data.
#This option exists for backwards compatibility with existing installations.
legacy-data-dir: false

View File

@ -0,0 +1,12 @@
#This configuration file controls global resources used on your PocketMine-MP server.
#Choose whether players must use your chosen resource packs to join the server.
#NOTE: This will do nothing if there are no resource packs in the stack below.
force_resources: false
resource_stack:
#Resource packs here are applied from bottom to top. This means that resources in higher packs will override those in lower packs.
#Entries here must indicate the filename of the resource pack.
#Example
# - natural.zip
# - vanilla.zip
#If you want to force clients to use vanilla resources, you must place a vanilla resource pack in your resources folder and add it to the stack here.

40
src/CoreConstants.php Normal file
View File

@ -0,0 +1,40 @@
<?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;
use function define;
use function defined;
use function dirname;
// composer autoload doesn't use require_once and also pthreads can inherit things
if(defined('pocketmine\_CORE_CONSTANTS_INCLUDED')){
return;
}
define('pocketmine\_CORE_CONSTANTS_INCLUDED', true);
define('pocketmine\PATH', dirname(__DIR__) . '/');
define('pocketmine\RESOURCE_PATH', dirname(__DIR__) . '/resources/');
define('pocketmine\BEDROCK_DATA_PATH', dirname(__DIR__) . '/vendor/pocketmine/bedrock-data/');
define('pocketmine\LOCALE_DATA_PATH', dirname(__DIR__) . '/vendor/pocketmine/locale-data/');
define('pocketmine\COMPOSER_AUTOLOADER_PATH', dirname(__DIR__) . '/vendor/autoload.php');

525
src/MemoryManager.php Normal file
View File

@ -0,0 +1,525 @@
<?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;
use pocketmine\event\server\LowMemoryEvent;
use pocketmine\network\mcpe\cache\ChunkCache;
use pocketmine\scheduler\DumpWorkerMemoryTask;
use pocketmine\scheduler\GarbageCollectionTask;
use pocketmine\timings\Timings;
use pocketmine\utils\AssumptionFailedError;
use pocketmine\utils\Process;
use pocketmine\utils\Utils;
use Webmozart\PathUtil\Path;
use function arsort;
use function count;
use function fclose;
use function file_exists;
use function file_put_contents;
use function fopen;
use function fwrite;
use function gc_collect_cycles;
use function gc_disable;
use function gc_enable;
use function gc_mem_caches;
use function get_class;
use function get_declared_classes;
use function get_defined_functions;
use function ini_get;
use function ini_set;
use function intdiv;
use function is_array;
use function is_object;
use function is_resource;
use function is_string;
use function json_encode;
use function mb_strtoupper;
use function min;
use function mkdir;
use function preg_match;
use function print_r;
use function round;
use function spl_object_hash;
use function sprintf;
use function strlen;
use function substr;
use const JSON_PRETTY_PRINT;
use const JSON_UNESCAPED_SLASHES;
use const SORT_NUMERIC;
class MemoryManager{
private Server $server;
private int $memoryLimit;
private int $globalMemoryLimit;
private int $checkRate;
private int $checkTicker = 0;
private bool $lowMemory = false;
private bool $continuousTrigger = true;
private int $continuousTriggerRate;
private int $continuousTriggerCount = 0;
private int $continuousTriggerTicker = 0;
private int $garbageCollectionPeriod;
private int $garbageCollectionTicker = 0;
private bool $garbageCollectionTrigger;
private bool $garbageCollectionAsync;
private int $lowMemChunkRadiusOverride;
private bool $lowMemChunkGC;
private bool $lowMemDisableChunkCache;
private bool $lowMemClearWorldCache;
private bool $dumpWorkers = true;
private \Logger $logger;
public function __construct(Server $server){
$this->server = $server;
$this->logger = new \PrefixedLogger($server->getLogger(), "Memory Manager");
$this->init($server->getConfigGroup());
}
private function init(ServerConfigGroup $config) : void{
$this->memoryLimit = $config->getPropertyInt("memory.main-limit", 0) * 1024 * 1024;
$defaultMemory = 1024;
if(preg_match("/([0-9]+)([KMGkmg])/", $config->getConfigString("memory-limit", ""), $matches) > 0){
$m = (int) $matches[1];
if($m <= 0){
$defaultMemory = 0;
}else{
switch(mb_strtoupper($matches[2])){
case "K":
$defaultMemory = intdiv($m, 1024);
break;
case "M":
$defaultMemory = $m;
break;
case "G":
$defaultMemory = $m * 1024;
break;
default:
$defaultMemory = $m;
break;
}
}
}
$hardLimit = $config->getPropertyInt("memory.main-hard-limit", $defaultMemory);
if($hardLimit <= 0){
ini_set("memory_limit", '-1');
}else{
ini_set("memory_limit", $hardLimit . "M");
}
$this->globalMemoryLimit = $config->getPropertyInt("memory.global-limit", 0) * 1024 * 1024;
$this->checkRate = $config->getPropertyInt("memory.check-rate", 20);
$this->continuousTrigger = $config->getPropertyBool("memory.continuous-trigger", true);
$this->continuousTriggerRate = $config->getPropertyInt("memory.continuous-trigger-rate", 30);
$this->garbageCollectionPeriod = $config->getPropertyInt("memory.garbage-collection.period", 36000);
$this->garbageCollectionTrigger = $config->getPropertyBool("memory.garbage-collection.low-memory-trigger", true);
$this->garbageCollectionAsync = $config->getPropertyBool("memory.garbage-collection.collect-async-worker", true);
$this->lowMemChunkRadiusOverride = $config->getPropertyInt("memory.max-chunks.chunk-radius", 4);
$this->lowMemChunkGC = $config->getPropertyBool("memory.max-chunks.trigger-chunk-collect", true);
$this->lowMemDisableChunkCache = $config->getPropertyBool("memory.world-caches.disable-chunk-cache", true);
$this->lowMemClearWorldCache = $config->getPropertyBool("memory.world-caches.low-memory-trigger", true);
$this->dumpWorkers = $config->getPropertyBool("memory.memory-dump.dump-async-worker", true);
gc_enable();
}
public function isLowMemory() : bool{
return $this->lowMemory;
}
public function getGlobalMemoryLimit() : int{
return $this->globalMemoryLimit;
}
public function canUseChunkCache() : bool{
return !$this->lowMemory or !$this->lowMemDisableChunkCache;
}
/**
* Returns the allowed chunk radius based on the current memory usage.
*/
public function getViewDistance(int $distance) : int{
return ($this->lowMemory and $this->lowMemChunkRadiusOverride > 0) ? min($this->lowMemChunkRadiusOverride, $distance) : $distance;
}
/**
* Triggers garbage collection and cache cleanup to try and free memory.
*/
public function trigger(int $memory, int $limit, bool $global = false, int $triggerCount = 0) : void{
$this->logger->debug(sprintf("%sLow memory triggered, limit %gMB, using %gMB",
$global ? "Global " : "", round(($limit / 1024) / 1024, 2), round(($memory / 1024) / 1024, 2)));
if($this->lowMemClearWorldCache){
foreach($this->server->getWorldManager()->getWorlds() as $world){
$world->clearCache(true);
}
ChunkCache::pruneCaches();
}
if($this->lowMemChunkGC){
foreach($this->server->getWorldManager()->getWorlds() as $world){
$world->doChunkGarbageCollection();
}
}
$ev = new LowMemoryEvent($memory, $limit, $global, $triggerCount);
$ev->call();
$cycles = 0;
if($this->garbageCollectionTrigger){
$cycles = $this->triggerGarbageCollector();
}
$this->logger->debug(sprintf("Freed %gMB, $cycles cycles", round(($ev->getMemoryFreed() / 1024) / 1024, 2)));
}
/**
* Called every tick to update the memory manager state.
*/
public function check() : void{
Timings::$memoryManager->startTiming();
if(($this->memoryLimit > 0 or $this->globalMemoryLimit > 0) and ++$this->checkTicker >= $this->checkRate){
$this->checkTicker = 0;
$memory = Process::getAdvancedMemoryUsage();
$trigger = false;
if($this->memoryLimit > 0 and $memory[0] > $this->memoryLimit){
$trigger = 0;
}elseif($this->globalMemoryLimit > 0 and $memory[1] > $this->globalMemoryLimit){
$trigger = 1;
}
if($trigger !== false){
if($this->lowMemory and $this->continuousTrigger){
if(++$this->continuousTriggerTicker >= $this->continuousTriggerRate){
$this->continuousTriggerTicker = 0;
$this->trigger($memory[$trigger], $this->memoryLimit, $trigger > 0, ++$this->continuousTriggerCount);
}
}else{
$this->lowMemory = true;
$this->continuousTriggerCount = 0;
$this->trigger($memory[$trigger], $this->memoryLimit, $trigger > 0);
}
}else{
$this->lowMemory = false;
}
}
if($this->garbageCollectionPeriod > 0 and ++$this->garbageCollectionTicker >= $this->garbageCollectionPeriod){
$this->garbageCollectionTicker = 0;
$this->triggerGarbageCollector();
}
Timings::$memoryManager->stopTiming();
}
public function triggerGarbageCollector() : int{
Timings::$garbageCollector->startTiming();
if($this->garbageCollectionAsync){
$pool = $this->server->getAsyncPool();
if(($w = $pool->shutdownUnusedWorkers()) > 0){
$this->logger->debug("Shut down $w idle async pool workers");
}
foreach($pool->getRunningWorkers() as $i){
$pool->submitTaskToWorker(new GarbageCollectionTask(), $i);
}
}
$cycles = gc_collect_cycles();
gc_mem_caches();
Timings::$garbageCollector->stopTiming();
return $cycles;
}
/**
* Dumps the server memory into the specified output folder.
*/
public function dumpServerMemory(string $outputFolder, int $maxNesting, int $maxStringSize) : void{
$logger = new \PrefixedLogger($this->server->getLogger(), "Memory Dump");
$logger->notice("After the memory dump is done, the server might crash");
self::dumpMemory($this->server, $outputFolder, $maxNesting, $maxStringSize, $logger);
if($this->dumpWorkers){
$pool = $this->server->getAsyncPool();
foreach($pool->getRunningWorkers() as $i){
$pool->submitTaskToWorker(new DumpWorkerMemoryTask($outputFolder, $maxNesting, $maxStringSize), $i);
}
}
}
/**
* Static memory dumper accessible from any thread.
*
* @param mixed $startingObject
*/
public static function dumpMemory($startingObject, string $outputFolder, int $maxNesting, int $maxStringSize, \Logger $logger) : void{
$hardLimit = ini_get('memory_limit');
if($hardLimit === false) throw new AssumptionFailedError("memory_limit INI directive should always exist");
ini_set('memory_limit', '-1');
gc_disable();
if(!file_exists($outputFolder)){
mkdir($outputFolder, 0777, true);
}
$obData = fopen(Path::join($outputFolder, "objects.js"), "wb+");
$objects = [];
$refCounts = [];
$instanceCounts = [];
$staticProperties = [];
$staticCount = 0;
$functionStaticVars = [];
$functionStaticVarsCount = 0;
foreach(get_declared_classes() as $className){
$reflection = new \ReflectionClass($className);
$staticProperties[$className] = [];
foreach($reflection->getProperties() as $property){
if(!$property->isStatic() or $property->getDeclaringClass()->getName() !== $className){
continue;
}
if(!$property->isPublic()){
$property->setAccessible(true);
}
if(!$property->isInitialized()){
continue;
}
$staticCount++;
$staticProperties[$className][$property->getName()] = self::continueDump($property->getValue(), $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
if(count($staticProperties[$className]) === 0){
unset($staticProperties[$className]);
}
foreach($reflection->getMethods() as $method){
if($method->getDeclaringClass()->getName() !== $reflection->getName()){
continue;
}
$methodStatics = [];
foreach($method->getStaticVariables() as $name => $variable){
$methodStatics[$name] = self::continueDump($variable, $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
if(count($methodStatics) > 0){
$functionStaticVars[$className . "::" . $method->getName()] = $methodStatics;
$functionStaticVarsCount += count($functionStaticVars);
}
}
}
file_put_contents(Path::join($outputFolder, "staticProperties.js"), json_encode($staticProperties, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
$logger->info("Wrote $staticCount static properties");
$globalVariables = [];
$globalCount = 0;
$ignoredGlobals = [
'GLOBALS' => true,
'_SERVER' => true,
'_REQUEST' => true,
'_POST' => true,
'_GET' => true,
'_FILES' => true,
'_ENV' => true,
'_COOKIE' => true,
'_SESSION' => true
];
foreach(Utils::stringifyKeys($GLOBALS) as $varName => $value){
if(isset($ignoredGlobals[$varName])){
continue;
}
$globalCount++;
$globalVariables[$varName] = self::continueDump($value, $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
file_put_contents(Path::join($outputFolder, "globalVariables.js"), json_encode($globalVariables, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
$logger->info("Wrote $globalCount global variables");
foreach(get_defined_functions()["user"] as $function){
$reflect = new \ReflectionFunction($function);
$vars = [];
foreach($reflect->getStaticVariables() as $varName => $variable){
$vars[$varName] = self::continueDump($variable, $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
if(count($vars) > 0){
$functionStaticVars[$function] = $vars;
$functionStaticVarsCount += count($vars);
}
}
file_put_contents(Path::join($outputFolder, 'functionStaticVars.js'), json_encode($functionStaticVars, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
$logger->info("Wrote $functionStaticVarsCount function static variables");
$data = self::continueDump($startingObject, $objects, $refCounts, 0, $maxNesting, $maxStringSize);
do{
$continue = false;
foreach($objects as $hash => $object){
if(!is_object($object)){
continue;
}
$continue = true;
$className = get_class($object);
if(!isset($instanceCounts[$className])){
$instanceCounts[$className] = 1;
}else{
$instanceCounts[$className]++;
}
$objects[$hash] = true;
$info = [
"information" => "$hash@$className",
];
if($object instanceof \Closure){
$info["definition"] = Utils::getNiceClosureName($object);
$info["referencedVars"] = [];
$reflect = new \ReflectionFunction($object);
if(($closureThis = $reflect->getClosureThis()) !== null){
$info["this"] = self::continueDump($closureThis, $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
foreach($reflect->getStaticVariables() as $name => $variable){
$info["referencedVars"][$name] = self::continueDump($variable, $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
}else{
$reflection = new \ReflectionObject($object);
$info["properties"] = [];
for($original = $reflection; $reflection !== false; $reflection = $reflection->getParentClass()){
foreach($reflection->getProperties() as $property){
if($property->isStatic()){
continue;
}
$name = $property->getName();
if($reflection !== $original){
if($property->isPrivate()){
$name = $reflection->getName() . ":" . $name;
}else{
continue;
}
}
if(!$property->isPublic()){
$property->setAccessible(true);
}
if(!$property->isInitialized($object)){
continue;
}
$info["properties"][$name] = self::continueDump($property->getValue($object), $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
}
}
fwrite($obData, json_encode($info, JSON_UNESCAPED_SLASHES) . "\n");
}
}while($continue);
$logger->info("Wrote " . count($objects) . " objects");
fclose($obData);
file_put_contents(Path::join($outputFolder, "serverEntry.js"), json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
file_put_contents(Path::join($outputFolder, "referenceCounts.js"), json_encode($refCounts, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
arsort($instanceCounts, SORT_NUMERIC);
file_put_contents(Path::join($outputFolder, "instanceCounts.js"), json_encode($instanceCounts, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
$logger->info("Finished!");
ini_set('memory_limit', $hardLimit);
gc_enable();
}
/**
* @param mixed $from
* @param object[] $objects reference parameter
* @param int[] $refCounts reference parameter
*
* @return mixed
*/
private static function continueDump($from, array &$objects, array &$refCounts, int $recursion, int $maxNesting, int $maxStringSize){
if($maxNesting <= 0){
return "(error) NESTING LIMIT REACHED";
}
--$maxNesting;
if(is_object($from)){
if(!isset($objects[$hash = spl_object_hash($from)])){
$objects[$hash] = $from;
$refCounts[$hash] = 0;
}
++$refCounts[$hash];
$data = "(object) $hash";
}elseif(is_array($from)){
if($recursion >= 5){
return "(error) ARRAY RECURSION LIMIT REACHED";
}
$data = [];
foreach($from as $key => $value){
$data[$key] = self::continueDump($value, $objects, $refCounts, $recursion + 1, $maxNesting, $maxStringSize);
}
}elseif(is_string($from)){
$data = "(string) len(" . strlen($from) . ") " . substr(Utils::printable($from), 0, $maxStringSize);
}elseif(is_resource($from)){
$data = "(resource) " . print_r($from, true);
}else{
$data = $from;
}
return $data;
}
}

327
src/PocketMine.php Normal file
View File

@ -0,0 +1,327 @@
<?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 {
use Composer\InstalledVersions;
use pocketmine\errorhandler\ErrorToExceptionHandler;
use pocketmine\thread\ThreadManager;
use pocketmine\utils\Filesystem;
use pocketmine\utils\MainLogger;
use pocketmine\utils\Process;
use pocketmine\utils\ServerKiller;
use pocketmine\utils\Terminal;
use pocketmine\utils\Timezone;
use pocketmine\wizard\SetupWizard;
use Webmozart\PathUtil\Path;
use function defined;
use function extension_loaded;
use function phpversion;
use function preg_match;
use function preg_quote;
use function strpos;
use function version_compare;
require_once __DIR__ . '/VersionInfo.php';
const MIN_PHP_VERSION = "8.0.0";
/**
* @param string $message
* @return void
*/
function critical_error($message){
echo "[ERROR] $message" . PHP_EOL;
}
/*
* Startup code. Do not look at it, it may harm you.
* This is the only non-class based file on this project.
* Enjoy it as much as I did writing it. I don't want to do it again.
*/
/**
* @return string[]
*/
function check_platform_dependencies(){
if(version_compare(MIN_PHP_VERSION, PHP_VERSION) > 0){
//If PHP version isn't high enough, anything below might break, so don't bother checking it.
return [
"PHP >= " . MIN_PHP_VERSION . " is required, but you have PHP " . PHP_VERSION . "."
];
}
$messages = [];
if(PHP_INT_SIZE < 8){
$messages[] = "32-bit systems/PHP are no longer supported. Please upgrade to a 64-bit system, or use a 64-bit PHP binary if this is a 64-bit system.";
}
if(php_sapi_name() !== "cli"){
$messages[] = "Only PHP CLI is supported.";
}
$extensions = [
"chunkutils2" => "PocketMine ChunkUtils v2",
"curl" => "cURL",
"crypto" => "php-crypto",
"ctype" => "ctype",
"date" => "Date",
"gmp" => "GMP",
"hash" => "Hash",
"igbinary" => "igbinary",
"json" => "JSON",
"leveldb" => "LevelDB",
"mbstring" => "Multibyte String",
"morton" => "morton",
"openssl" => "OpenSSL",
"pcre" => "PCRE",
"phar" => "Phar",
"pthreads" => "pthreads",
"reflection" => "Reflection",
"sockets" => "Sockets",
"spl" => "SPL",
"yaml" => "YAML",
"zip" => "Zip",
"zlib" => "Zlib"
];
foreach($extensions as $ext => $name){
if(!extension_loaded($ext)){
$messages[] = "Unable to find the $name ($ext) extension.";
}
}
if(extension_loaded("pthreads")){
$pthreads_version = phpversion("pthreads");
if(substr_count($pthreads_version, ".") < 2){
$pthreads_version = "0.$pthreads_version";
}
if(version_compare($pthreads_version, "4.0.0") < 0 || version_compare($pthreads_version, "5.0.0") > 0){
$messages[] = "pthreads ^4.0.0 is required, while you have $pthreads_version.";
}
}
if(extension_loaded("leveldb")){
$leveldb_version = phpversion("leveldb");
if(version_compare($leveldb_version, "0.2.1") < 0){
$messages[] = "php-leveldb >= 0.2.1 is required, while you have $leveldb_version.";
}
if(!defined('LEVELDB_ZLIB_RAW_COMPRESSION')){
$messages[] = "Given version of php-leveldb doesn't support ZLIB_RAW compression (use https://github.com/pmmp/php-leveldb)";
}
}
$chunkutils2_version = phpversion("chunkutils2");
$wantedVersionLock = "0.3";
$wantedVersionMin = "$wantedVersionLock.0";
if($chunkutils2_version !== false && (
version_compare($chunkutils2_version, $wantedVersionMin) < 0 ||
preg_match("/^" . preg_quote($wantedVersionLock, "/") . "\.\d+(?:-dev)?$/", $chunkutils2_version) === 0 //lock in at ^0.2, optionally at a patch release
)){
$messages[] = "chunkutils2 ^$wantedVersionMin is required, while you have $chunkutils2_version.";
}
if(extension_loaded("pocketmine")){
$messages[] = "The native PocketMine extension is no longer supported.";
}
if(!defined('AF_INET6')){
$messages[] = "IPv6 support is required, but your PHP binary was built without IPv6 support.";
}
return $messages;
}
/**
* @return void
*/
function emit_performance_warnings(\Logger $logger){
if(PHP_DEBUG !== 0){
$logger->warning("This PHP binary was compiled in debug mode. This has a major impact on performance.");
}
if(extension_loaded("xdebug")){
$logger->warning("Xdebug extension is enabled. This has a major impact on performance.");
}
if(((int) ini_get('zend.assertions')) !== -1){
$logger->warning("Debugging assertions are enabled. This may degrade performance. To disable them, set `zend.assertions = -1` in php.ini.");
}
if(\Phar::running(true) === ""){
$logger->warning("Non-packaged installation detected. This will degrade autoloading speed and make startup times longer.");
}
if(function_exists('opcache_get_status') && ($opcacheStatus = opcache_get_status(false)) !== false){
$jitEnabled = $opcacheStatus["jit"]["on"] ?? false;
if($jitEnabled !== false){
$logger->warning(<<<'JIT_WARNING'
--------------------------------------- ! WARNING ! ---------------------------------------
You're using PHP 8.0 with JIT enabled. This provides significant performance improvements.
HOWEVER, it is EXPERIMENTAL, and has already been seen to cause weird and unexpected bugs.
Proceed with caution.
If you want to report any bugs, make sure to mention that you are using PHP 8.0 with JIT.
To turn off JIT, change `opcache.jit` to `0` in your php.ini file.
-------------------------------------------------------------------------------------------
JIT_WARNING
);
}
}
}
/**
* @return void
*/
function set_ini_entries(){
ini_set("allow_url_fopen", '1');
ini_set("display_errors", '1');
ini_set("display_startup_errors", '1');
ini_set("default_charset", "utf-8");
ini_set('assert.exception', '1');
}
/**
* @return void
*/
function server(){
if(count($messages = check_platform_dependencies()) > 0){
echo PHP_EOL;
$binary = version_compare(PHP_VERSION, "5.4") >= 0 ? PHP_BINARY : "unknown";
critical_error("Selected PHP binary does not satisfy some requirements.");
foreach($messages as $m){
echo " - $m" . PHP_EOL;
}
critical_error("PHP binary used: " . $binary);
critical_error("Loaded php.ini: " . (($file = php_ini_loaded_file()) !== false ? $file : "none"));
$phprc = getenv("PHPRC");
critical_error("Value of PHPRC environment variable: " . ($phprc === false ? "" : $phprc));
critical_error("Please recompile PHP with the needed configuration, or refer to the installation instructions at http://pmmp.rtfd.io/en/rtfd/installation.html.");
echo PHP_EOL;
exit(1);
}
unset($messages);
error_reporting(-1);
set_ini_entries();
$bootstrap = dirname(__FILE__, 2) . '/vendor/autoload.php';
if(!is_file($bootstrap)){
critical_error("Composer autoloader not found at " . $bootstrap);
critical_error("Please install/update Composer dependencies or use provided builds.");
exit(1);
}
require_once($bootstrap);
$composerGitHash = InstalledVersions::getReference('pocketmine/pocketmine-mp');
if($composerGitHash !== null){
//we can't verify dependency versions if we were installed without using git
$currentGitHash = explode("-", VersionInfo::GIT_HASH())[0];
if($currentGitHash !== $composerGitHash){
critical_error("Composer dependencies and/or autoloader are out of sync.");
critical_error("- Current revision is $currentGitHash");
critical_error("- Composer dependencies were last synchronized for revision $composerGitHash");
critical_error("Out-of-sync Composer dependencies may result in crashes and classes not being found.");
critical_error("Please synchronize Composer dependencies before running the server.");
exit(1);
}
}
if(extension_loaded('parallel')){
\parallel\bootstrap(\pocketmine\COMPOSER_AUTOLOADER_PATH);
}
ErrorToExceptionHandler::set();
$opts = getopt("", ["data:", "plugins:", "no-wizard", "enable-ansi", "disable-ansi"]);
$dataPath = isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : realpath(getcwd()) . DIRECTORY_SEPARATOR;
$pluginPath = isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : realpath(getcwd()) . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR;
Filesystem::addCleanedPath($pluginPath, Filesystem::CLEAN_PATH_PLUGINS_PREFIX);
if(!file_exists($dataPath)){
mkdir($dataPath, 0777, true);
}
$lockFilePath = Path::join($dataPath, 'server.lock');
if(($pid = Filesystem::createLockFile($lockFilePath)) !== null){
critical_error("Another " . VersionInfo::NAME . " instance (PID $pid) is already using this folder (" . realpath($dataPath) . ").");
critical_error("Please stop the other server first before running a new one.");
exit(1);
}
//Logger has a dependency on timezone
Timezone::init();
if(isset($opts["enable-ansi"])){
Terminal::init(true);
}elseif(isset($opts["disable-ansi"])){
Terminal::init(false);
}else{
Terminal::init();
}
$logger = new MainLogger(Path::join($dataPath, "server.log"), Terminal::hasFormattingCodes(), "Server", new \DateTimeZone(Timezone::get()));
\GlobalLogger::set($logger);
emit_performance_warnings($logger);
$exitCode = 0;
do{
if(!file_exists(Path::join($dataPath, "server.properties")) and !isset($opts["no-wizard"])){
$installer = new SetupWizard($dataPath);
if(!$installer->run()){
$exitCode = -1;
break;
}
}
/*
* We now use the Composer autoloader, but this autoloader is still for loading plugins.
*/
$autoloader = new \BaseClassLoader();
$autoloader->register(false);
new Server($autoloader, $logger, $dataPath, $pluginPath);
$logger->info("Stopping other threads");
$killer = new ServerKiller(8);
$killer->start(PTHREADS_INHERIT_NONE);
usleep(10000); //Fixes ServerKiller not being able to start on single-core machines
if(ThreadManager::getInstance()->stopAll() > 0){
$logger->debug("Some threads could not be stopped, performing a force-kill");
Process::kill(Process::pid(), true);
}
}while(false);
$logger->shutdownLogWriterThread();
echo Terminal::$FORMAT_RESET . PHP_EOL;
Filesystem::releaseLockFile($lockFilePath);
exit($exitCode);
}
\pocketmine\server();
}

1828
src/Server.php Normal file

File diff suppressed because it is too large Load Diff

146
src/ServerConfigGroup.php Normal file
View File

@ -0,0 +1,146 @@
<?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;
use pocketmine\utils\Config;
use function array_key_exists;
use function getopt;
use function is_bool;
use function is_int;
use function is_string;
use function strtolower;
final class ServerConfigGroup{
/** @var Config */
private $pocketmineYml;
/** @var Config */
private $serverProperties;
/**
* @var mixed[]
* @phpstan-var array<string, mixed>
*/
private $propertyCache = [];
public function __construct(Config $pocketmineYml, Config $serverProperties){
$this->pocketmineYml = $pocketmineYml;
$this->serverProperties = $serverProperties;
}
/**
* @param mixed $defaultValue
*
* @return mixed
*/
public function getProperty(string $variable, $defaultValue = null){
if(!array_key_exists($variable, $this->propertyCache)){
$v = getopt("", ["$variable::"]);
if(isset($v[$variable])){
$this->propertyCache[$variable] = $v[$variable];
}else{
$this->propertyCache[$variable] = $this->pocketmineYml->getNested($variable);
}
}
return $this->propertyCache[$variable] ?? $defaultValue;
}
public function getPropertyBool(string $variable, bool $defaultValue) : bool{
return (bool) $this->getProperty($variable, $defaultValue);
}
public function getPropertyInt(string $variable, int $defaultValue) : int{
return (int) $this->getProperty($variable, $defaultValue);
}
public function getPropertyString(string $variable, string $defaultValue) : string{
return (string) $this->getProperty($variable, $defaultValue);
}
public function getConfigString(string $variable, string $defaultValue = "") : string{
$v = getopt("", ["$variable::"]);
if(isset($v[$variable])){
return (string) $v[$variable];
}
return $this->serverProperties->exists($variable) ? (string) $this->serverProperties->get($variable) : $defaultValue;
}
public function setConfigString(string $variable, string $value) : void{
$this->serverProperties->set($variable, $value);
}
public function getConfigInt(string $variable, int $defaultValue = 0) : int{
$v = getopt("", ["$variable::"]);
if(isset($v[$variable])){
return (int) $v[$variable];
}
return $this->serverProperties->exists($variable) ? (int) $this->serverProperties->get($variable) : $defaultValue;
}
public function setConfigInt(string $variable, int $value) : void{
$this->serverProperties->set($variable, $value);
}
public function getConfigBool(string $variable, bool $defaultValue = false) : bool{
$v = getopt("", ["$variable::"]);
if(isset($v[$variable])){
$value = $v[$variable];
}else{
$value = $this->serverProperties->exists($variable) ? $this->serverProperties->get($variable) : $defaultValue;
}
if(is_bool($value)){
return $value;
}
if(is_int($value)){
return $value !== 0;
}
if(is_string($value)){
switch(strtolower($value)){
case "on":
case "true":
case "1":
case "yes":
return true;
}
}
return false;
}
public function setConfigBool(string $variable, bool $value) : void{
$this->serverProperties->set($variable, $value ? "1" : "0");
}
public function save() : void{
if($this->serverProperties->hasChanged()){
$this->serverProperties->save();
}
if($this->pocketmineYml->hasChanged()){
$this->pocketmineYml->save();
}
}
}

91
src/VersionInfo.php Normal file
View File

@ -0,0 +1,91 @@
<?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;
use pocketmine\utils\Git;
use pocketmine\utils\VersionString;
use function is_array;
use function is_int;
use function str_repeat;
final class VersionInfo{
public const NAME = "PocketMine-MP";
public const BASE_VERSION = "4.0.4";
public const IS_DEVELOPMENT_BUILD = false;
public const BUILD_CHANNEL = "stable";
private function __construct(){
//NOOP
}
/** @var string|null */
private static $gitHash = null;
public static function GIT_HASH() : string{
if(self::$gitHash === null){
$gitHash = str_repeat("00", 20);
if(\Phar::running(true) === ""){
$gitHash = Git::getRepositoryStatePretty(\pocketmine\PATH);
}else{
$phar = new \Phar(\Phar::running(false));
$meta = $phar->getMetadata();
if(isset($meta["git"])){
$gitHash = $meta["git"];
}
}
self::$gitHash = $gitHash;
}
return self::$gitHash;
}
private static ?int $buildNumber = null;
public static function BUILD_NUMBER() : int{
if(self::$buildNumber === null){
self::$buildNumber = 0;
if(\Phar::running(true) !== ""){
$phar = new \Phar(\Phar::running(false));
$meta = $phar->getMetadata();
if(is_array($meta) && isset($meta["build"]) && is_int($meta["build"])){
self::$buildNumber = $meta["build"];
}
}
}
return self::$buildNumber;
}
/** @var VersionString|null */
private static $fullVersion = null;
public static function VERSION() : VersionString{
if(self::$fullVersion === null){
self::$fullVersion = new VersionString(self::BASE_VERSION, self::IS_DEVELOPMENT_BUILD, self::BUILD_NUMBER());
}
return self::$fullVersion;
}
}

View File

@ -23,13 +23,10 @@ declare(strict_types=1);
namespace pocketmine\block;
class ActivatorRail extends RedstoneRail{
use pocketmine\block\utils\RailPoweredByRedstoneTrait;
protected $id = self::ACTIVATOR_RAIL;
public function getName() : string{
return "Activator Rail";
}
class ActivatorRail extends StraightOnlyRail{
use RailPoweredByRedstoneTrait;
//TODO
}

View File

@ -23,29 +23,33 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
class Bedrock extends Solid{
/**
* Air block
*/
class Air extends Transparent{
protected $id = self::BEDROCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
public function canBeFlowedInto() : bool{
return true;
}
public function getName() : string{
return "Bedrock";
public function canBeReplaced() : bool{
return true;
}
public function getHardness() : float{
return -1;
}
public function getBlastResistance() : float{
return 18000000;
}
public function isBreakable(Item $item) : bool{
public function canBePlaced() : bool{
return false;
}
public function isSolid() : bool{
return false;
}
/**
* @return AxisAlignedBB[]
*/
protected function recalculateCollisionBoxes() : array{
return [];
}
}

97
src/block/Anvil.php Normal file
View File

@ -0,0 +1,97 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\inventory\AnvilInventory;
use pocketmine\block\utils\BlockDataSerializer;
use pocketmine\block\utils\Fallable;
use pocketmine\block\utils\FallableTrait;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
class Anvil extends Transparent implements Fallable{
use FallableTrait;
use HorizontalFacingTrait;
private int $damage = 0;
protected function writeStateToMeta() : int{
return BlockDataSerializer::writeLegacyHorizontalFacing($this->facing) | ($this->damage << 2);
}
public function readStateFromData(int $id, int $stateMeta) : void{
$this->facing = BlockDataSerializer::readLegacyHorizontalFacing($stateMeta & 0x3);
$this->damage = BlockDataSerializer::readBoundedInt("damage", $stateMeta >> 2, 0, 2);
}
public function getStateBitmask() : int{
return 0b1111;
}
protected function writeStateToItemMeta() : int{
return $this->damage << 2;
}
public function getDamage() : int{ return $this->damage; }
/** @return $this */
public function setDamage(int $damage) : self{
if($damage < 0 || $damage > 2){
throw new \InvalidArgumentException("Damage must be in range 0-2");
}
$this->damage = $damage;
return $this;
}
/**
* @return AxisAlignedBB[]
*/
protected function recalculateCollisionBoxes() : array{
return [AxisAlignedBB::one()->squash(Facing::axis(Facing::rotateY($this->facing, false)), 1 / 8)];
}
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($player instanceof Player){
$player->setCurrentWindow(new AnvilInventory($this->position));
}
return true;
}
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($player !== null){
$this->facing = Facing::rotateY($player->getHorizontalFacing(), true);
}
return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
}
public function tickFalling() : ?Block{
return null;
}
}

240
src/block/Bamboo.php Normal file
View File

@ -0,0 +1,240 @@
<?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\block;
use pocketmine\block\utils\BlockDataSerializer;
use pocketmine\event\block\StructureGrowEvent;
use pocketmine\item\Bamboo as ItemBamboo;
use pocketmine\item\Fertilizer;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
use function count;
use function gmp_add;
use function gmp_and;
use function gmp_intval;
use function gmp_mul;
use function gmp_xor;
use function min;
use function mt_rand;
use const PHP_INT_MAX;
class Bamboo extends Transparent{
public const NO_LEAVES = 0;
public const SMALL_LEAVES = 1;
public const LARGE_LEAVES = 2;
protected bool $thick = false; //age in PC, but this is 0/1
protected bool $ready = false;
protected int $leafSize = self::NO_LEAVES;
public function readStateFromData(int $id, int $stateMeta) : void{
$this->thick = ($stateMeta & BlockLegacyMetadata::BAMBOO_FLAG_THICK) !== 0;
$this->leafSize = BlockDataSerializer::readBoundedInt("leafSize", ($stateMeta >> BlockLegacyMetadata::BAMBOO_LEAF_SIZE_SHIFT) & BlockLegacyMetadata::BAMBOO_LEAF_SIZE_MASK, self::NO_LEAVES, self::LARGE_LEAVES);
$this->ready = ($stateMeta & BlockLegacyMetadata::BAMBOO_FLAG_READY) !== 0;
}
public function writeStateToMeta() : int{
return ($this->thick ? BlockLegacyMetadata::BAMBOO_FLAG_THICK : 0) | ($this->leafSize << BlockLegacyMetadata::BAMBOO_LEAF_SIZE_SHIFT) | ($this->ready ? BlockLegacyMetadata::BAMBOO_FLAG_READY : 0);
}
public function getStateBitmask() : int{
return 0b1111;
}
public function isThick() : bool{ return $this->thick; }
/** @return $this */
public function setThick(bool $thick) : self{
$this->thick = $thick;
return $this;
}
public function isReady() : bool{ return $this->ready; }
/** @return $this */
public function setReady(bool $ready) : self{
$this->ready = $ready;
return $this;
}
public function getLeafSize() : int{ return $this->leafSize; }
/** @return $this */
public function setLeafSize(int $leafSize) : self{
$this->leafSize = $leafSize;
return $this;
}
/**
* @return AxisAlignedBB[]
*/
protected function recalculateCollisionBoxes() : array{
//this places the BB at the northwest corner, not the center
$inset = 1 - (($this->thick ? 3 : 2) / 16);
return [AxisAlignedBB::one()->trim(Facing::SOUTH, $inset)->trim(Facing::EAST, $inset)];
}
private static function getOffsetSeed(int $x, int $y, int $z) : int{
$p1 = gmp_mul($z, 0x6ebfff5);
$p2 = gmp_mul($x, 0x2fc20f);
$p3 = $y;
$xord = gmp_xor(gmp_xor($p1, $p2), $p3);
$fullResult = gmp_mul(gmp_add(gmp_mul($xord, 0x285b825), 0xb), $xord);
return gmp_intval(gmp_and($fullResult, 0xffffffff));
}
private static function getMaxHeight(int $x, int $z) : int{
return 12 + (self::getOffsetSeed($x, 0, $z) % 5);
}
public function getModelPositionOffset() : ?Vector3{
$seed = self::getOffsetSeed($this->position->getFloorX(), 0, $this->position->getFloorZ());
$retX = (($seed % 12) + 1) / 16;
$retZ = ((($seed >> 8) % 12) + 1) / 16;
return new Vector3($retX, 0, $retZ);
}
private function canBeSupportedBy(Block $block) : bool{
//TODO: tags would be better for this
return
$block instanceof Dirt ||
$block instanceof Grass ||
$block instanceof Gravel ||
$block instanceof Sand ||
$block instanceof Mycelium ||
$block instanceof Podzol;
}
private function seekToTop() : Bamboo{
$world = $this->position->getWorld();
$top = $this;
while(($next = $world->getBlock($top->position->up())) instanceof Bamboo && $next->isSameType($this)){
$top = $next;
}
return $top;
}
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($item instanceof Fertilizer){
$top = $this->seekToTop();
if($top->grow(self::getMaxHeight($top->position->getFloorX(), $top->position->getFloorZ()), mt_rand(1, 2), $player)){
$item->pop();
return true;
}
}elseif($item instanceof ItemBamboo){
if($this->seekToTop()->grow(PHP_INT_MAX, 1, $player)){
$item->pop();
return true;
}
}
return false;
}
public function onNearbyBlockChange() : void{
$below = $this->position->getWorld()->getBlock($this->position->down());
if(!$this->canBeSupportedBy($below) and !$below->isSameType($this)){
$this->position->getWorld()->useBreakOn($this->position);
}
}
private function grow(int $maxHeight, int $growAmount, ?Player $player) : bool{
$world = $this->position->getWorld();
if(!$world->getBlock($this->position->up())->canBeReplaced()){
return false;
}
$height = 1;
while($world->getBlock($this->position->subtract(0, $height, 0))->isSameType($this)){
if(++$height >= $maxHeight){
return false;
}
}
$newHeight = $height + $growAmount;
$stemBlock = (clone $this)->setReady(false)->setLeafSize(self::NO_LEAVES);
if($newHeight >= 4 && !$stemBlock->isThick()){ //don't change it to false if height is less, because it might have been chopped
$stemBlock = $stemBlock->setThick(true);
}
$smallLeavesBlock = (clone $stemBlock)->setLeafSize(self::SMALL_LEAVES);
$bigLeavesBlock = (clone $stemBlock)->setLeafSize(self::LARGE_LEAVES);
$newBlocks = [];
if($newHeight === 2){
$newBlocks[] = $smallLeavesBlock;
}elseif($newHeight === 3){
$newBlocks[] = $smallLeavesBlock;
$newBlocks[] = $smallLeavesBlock;
}elseif($newHeight === 4){
$newBlocks[] = $bigLeavesBlock;
$newBlocks[] = $smallLeavesBlock;
$newBlocks[] = $stemBlock;
$newBlocks[] = $stemBlock;
}elseif($newHeight > 4){
$newBlocks[] = $bigLeavesBlock;
$newBlocks[] = $bigLeavesBlock;
$newBlocks[] = $smallLeavesBlock;
for($i = 0, $max = min($growAmount, $newHeight - count($newBlocks)); $i < $max; ++$i){
$newBlocks[] = $stemBlock; //to replace the bottom blocks that currently have leaves
}
}
$tx = new BlockTransaction($this->position->getWorld());
foreach($newBlocks as $idx => $newBlock){
$tx->addBlock($this->position->subtract(0, $idx - $growAmount, 0), $newBlock);
}
$ev = new StructureGrowEvent($this, $tx, $player);
$ev->call();
if($ev->isCancelled()){
return false;
}
return $tx->apply();
}
public function ticksRandomly() : bool{
return true;
}
public function onRandomTick() : void{
$world = $this->position->getWorld();
if($this->ready){
$this->ready = false;
if($world->getFullLight($this->position) < 9 || !$this->grow(self::getMaxHeight($this->position->getFloorX(), $this->position->getFloorZ()), 1, null)){
$world->setBlock($this->position, $this);
}
}elseif($world->getBlock($this->position->up())->canBeReplaced()){
$this->ready = true;
$world->setBlock($this->position, $this);
}
}
}

130
src/block/BambooSapling.php Normal file
View File

@ -0,0 +1,130 @@
<?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\block;
use pocketmine\event\block\StructureGrowEvent;
use pocketmine\item\Bamboo as ItemBamboo;
use pocketmine\item\Fertilizer;
use pocketmine\item\Item;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
final class BambooSapling extends Flowable{
private bool $ready = false;
public function readStateFromData(int $id, int $stateMeta) : void{
$this->ready = ($stateMeta & BlockLegacyMetadata::SAPLING_FLAG_READY) !== 0;
}
protected function writeStateToMeta() : int{
return $this->ready ? BlockLegacyMetadata::SAPLING_FLAG_READY : 0;
}
public function getStateBitmask() : int{ return 0b1000; }
public function isReady() : bool{ return $this->ready; }
/** @return $this */
public function setReady(bool $ready) : self{
$this->ready = $ready;
return $this;
}
private function canBeSupportedBy(Block $block) : bool{
//TODO: tags would be better for this
return
$block instanceof Dirt ||
$block instanceof Grass ||
$block instanceof Gravel ||
$block instanceof Sand ||
$block instanceof Mycelium ||
$block instanceof Podzol;
}
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if(!$this->canBeSupportedBy($blockReplace->position->getWorld()->getBlock($blockReplace->position->down()))){
return false;
}
return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
}
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($item instanceof Fertilizer || $item instanceof ItemBamboo){
if($this->grow($player)){
$item->pop();
return true;
}
}
return false;
}
public function onNearbyBlockChange() : void{
if(!$this->canBeSupportedBy($this->position->getWorld()->getBlock($this->position->down()))){
$this->position->getWorld()->useBreakOn($this->position);
}
}
private function grow(?Player $player) : bool{
$world = $this->position->getWorld();
if(!$world->getBlock($this->position->up())->canBeReplaced()){
return false;
}
$tx = new BlockTransaction($world);
$bamboo = VanillaBlocks::BAMBOO();
$tx->addBlock($this->position, $bamboo)
->addBlock($this->position->up(), (clone $bamboo)->setLeafSize(Bamboo::SMALL_LEAVES));
$ev = new StructureGrowEvent($this, $tx, $player);
$ev->call();
if($ev->isCancelled()){
return false;
}
return $tx->apply();
}
public function ticksRandomly() : bool{
return true;
}
public function onRandomTick() : void{
$world = $this->position->getWorld();
if($this->ready){
$this->ready = false;
if($world->getFullLight($this->position) < 9 || !$this->grow(null)){
$world->setBlock($this->position, $this);
}
}elseif($world->getBlock($this->position->up())->canBeReplaced()){
$this->ready = true;
$world->setBlock($this->position, $this);
}
}
public function asItem() : Item{
return VanillaBlocks::BAMBOO()->asItem();
}
}

102
src/block/Barrel.php Normal file
View File

@ -0,0 +1,102 @@
<?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\block;
use pocketmine\block\tile\Barrel as TileBarrel;
use pocketmine\block\utils\AnyFacingTrait;
use pocketmine\block\utils\BlockDataSerializer;
use pocketmine\item\Item;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
use function abs;
class Barrel extends Opaque{
use AnyFacingTrait;
protected bool $open = false;
protected function writeStateToMeta() : int{
return BlockDataSerializer::writeFacing($this->facing) | ($this->open ? BlockLegacyMetadata::BARREL_FLAG_OPEN : 0);
}
public function readStateFromData(int $id, int $stateMeta) : void{
$this->facing = BlockDataSerializer::readFacing($stateMeta & 0x07);
$this->open = ($stateMeta & BlockLegacyMetadata::BARREL_FLAG_OPEN) === BlockLegacyMetadata::BARREL_FLAG_OPEN;
}
public function getStateBitmask() : int{
return 0b1111;
}
public function isOpen() : bool{
return $this->open;
}
/** @return $this */
public function setOpen(bool $open) : Barrel{
$this->open = $open;
return $this;
}
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($player !== null){
if(abs($player->getPosition()->getX() - $this->position->getX()) < 2 && abs($player->getPosition()->getZ() - $this->position->getZ()) < 2){
$y = $player->getEyePos()->getY();
if($y - $this->position->getY() > 2){
$this->facing = Facing::UP;
}elseif($this->position->getY() - $y > 0){
$this->facing = Facing::DOWN;
}else{
$this->facing = Facing::opposite($player->getHorizontalFacing());
}
}else{
$this->facing = Facing::opposite($player->getHorizontalFacing());
}
}
return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
}
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($player instanceof Player){
$barrel = $this->position->getWorld()->getTile($this->position);
if($barrel instanceof TileBarrel){
if(!$barrel->canOpenWith($item->getCustomName())){
return true;
}
$player->setCurrentWindow($barrel->getInventory());
}
}
return true;
}
public function getFuelTime() : int{
return 300;
}
}

147
src/block/BaseBanner.php Normal file
View File

@ -0,0 +1,147 @@
<?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\block;
use pocketmine\block\tile\Banner as TileBanner;
use pocketmine\block\utils\BannerPatternLayer;
use pocketmine\block\utils\ColoredTrait;
use pocketmine\block\utils\DyeColor;
use pocketmine\data\bedrock\DyeColorIdMap;
use pocketmine\item\Banner as ItemBanner;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
use function array_filter;
use function assert;
use function count;
abstract class BaseBanner extends Transparent{
use ColoredTrait;
/**
* @var BannerPatternLayer[]
* @phpstan-var list<BannerPatternLayer>
*/
protected array $patterns = [];
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->color = DyeColor::BLACK();
parent::__construct($idInfo, $name, $breakInfo);
}
public function readStateFromWorld() : void{
parent::readStateFromWorld();
$tile = $this->position->getWorld()->getTile($this->position);
if($tile instanceof TileBanner){
$this->color = $tile->getBaseColor();
$this->setPatterns($tile->getPatterns());
}
}
public function writeStateToWorld() : void{
parent::writeStateToWorld();
$tile = $this->position->getWorld()->getTile($this->position);
assert($tile instanceof TileBanner);
$tile->setBaseColor($this->color);
$tile->setPatterns($this->patterns);
}
public function isSolid() : bool{
return false;
}
public function getMaxStackSize() : int{
return 16;
}
/**
* @return BannerPatternLayer[]
* @phpstan-return list<BannerPatternLayer>
*/
public function getPatterns() : array{
return $this->patterns;
}
/**
* @param BannerPatternLayer[] $patterns
*
* @phpstan-param list<BannerPatternLayer> $patterns
* @return $this
*/
public function setPatterns(array $patterns) : self{
$checked = array_filter($patterns, fn($v) => $v instanceof BannerPatternLayer);
if(count($checked) !== count($patterns)){
throw new \TypeError("Deque must only contain " . BannerPatternLayer::class . " objects");
}
$this->patterns = $checked;
return $this;
}
/**
* @return AxisAlignedBB[]
*/
protected function recalculateCollisionBoxes() : array{
return [];
}
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($item instanceof ItemBanner){
$this->color = $item->getColor();
$this->setPatterns($item->getPatterns());
}
return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
}
abstract protected function getSupportingFace() : int;
public function onNearbyBlockChange() : void{
if($this->getSide($this->getSupportingFace())->getId() === BlockLegacyIds::AIR){
$this->position->getWorld()->useBreakOn($this->position);
}
}
protected function writeStateToItemMeta() : int{
return DyeColorIdMap::getInstance()->toInvertedId($this->color);
}
public function getDropsForCompatibleTool(Item $item) : array{
$drop = $this->asItem();
if($drop instanceof ItemBanner and count($this->patterns) > 0){
$drop->setPatterns($this->patterns);
}
return [$drop];
}
public function getPickedItem(bool $addUserData = false) : Item{
$result = $this->asItem();
if($addUserData and $result instanceof ItemBanner and count($this->patterns) > 0){
$result->setPatterns($this->patterns);
}
return $result;
}
}

Some files were not shown because too many files have changed in this diff Show More