Compare commits

...

5411 Commits

Author SHA1 Message Date
15645759e9 Release 4.9.1 2022-10-11 22:47:54 +01:00
7df2719fce Update Composer dependencies 2022-10-11 21:57:22 +01:00
10b8dcfdd1 Bump phpstan/phpstan from 1.8.6 to 1.8.8 (#5324)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.8.6 to 1.8.8.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.9.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.8.6...1.8.8)

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

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-07 11:43:39 +01:00
c1fbac412e event: ensure that modifications to items expected to be readonly have no effect
this isn't a very glorious fix, but it's the best I have for now.
2022-10-07 11:33:14 +01:00
cd4bb91676 Living: alter eye height so the player doesn't drown on the surface of water when swimming
fixes #4989
2022-09-29 00:15:07 +01:00
2be527060f Sign: Fixed desync of colour and glowing state when using dye on signs
fixes #4932
2022-09-28 23:34:08 +01:00
6f68c6d8a0 Melon: extend Solid instead of Transparent, fixes #5050 2022-09-28 23:07:53 +01:00
ac16378410 Silence pre-spawn PlayerAuthInputPacket debug spam 2022-09-28 21:58:23 +01:00
1f9dfa77bf PreSpawnPacketHandler: emit a separate debug message for sending creative data 2022-09-28 21:58:23 +01:00
fc56c041f3 Correct knockback from explosions (#5161) 2022-09-28 21:09:07 +01:00
22486dd75e Mushroom: check the light for placement, unless placed on mycelium or podzol (#5054)
The previous behaviour was inconsistent with vanilla.
2022-09-28 18:41:23 +01:00
37ec1193ea Update PHPStan baselines 2022-09-28 18:34:01 +01:00
def2f8c145 InventoryManager: ensure the windowID is valid before attempting to remove any window
this is currently a harmless bug, since remove() isn't currently doing any heavy lifting.
2022-09-28 01:01:42 +01:00
ed7c95549d PreSpawnPacketHandler: add a bunch of debug messages
this is useful for observing timings during first spawn, so that performance issues can be more easily spotted.
2022-09-27 21:08:31 +01:00
4650a3bb22 CONTRIBUTING: added a table of what types of changes are accepted by what branches 2022-09-27 18:13:59 +01:00
5e5661de75 Play burp sound when consuming a FoodSource (#5158) 2022-09-27 17:21:55 +01:00
e2f1b10165 Bump phpunit/phpunit from 9.5.24 to 9.5.25 (#5308)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.24 to 9.5.25.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.24...9.5.25)

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

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-27 17:18:58 +01:00
455f9fa92e Bump tests/plugins/DevTools from bd0fa04 to 95921c6 (#5307)
Bumps [tests/plugins/DevTools](https://github.com/pmmp/DevTools) from `bd0fa04` to `95921c6`.
- [Release notes](https://github.com/pmmp/DevTools/releases)
- [Commits](bd0fa048da...95921c6d87)

---
updated-dependencies:
- dependency-name: tests/plugins/DevTools
  dependency-type: direct:production
...

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-27 17:18:47 +01:00
dec188d4ad TaskHandler: mark some public methods as @internal (#5310)
closes #5309
2022-09-27 17:17:29 +01:00
2db3498891 Updated DevTools submodule to pmmp/DevTools@bd0fa048da 2022-09-24 21:26:42 +01:00
f448b2e685 Block: Improve documentation for a whole bunch of methods 2022-09-24 18:06:46 +01:00
6a0c54f850 Block: Relocate and document addVelocityToEntity()
maybe we should consider merging this with onEntityInside(), since they are both called for the same reasons? ...
2022-09-24 17:32:02 +01:00
77a18d0aea Block: add documentation for getFrictionFactor()
has no one ever questioned the fact that a higher _friction_ factor _reduces_ the block's friction???
2022-09-24 17:05:38 +01:00
140a809c40 Block: improve documentation of hasEntityCollision() and onEntityInside() 2022-09-24 17:04:42 +01:00
cb7c136035 Added documentation for some base Block classes 2022-09-24 16:54:21 +01:00
3f7d8a3777 Bump phpstan/phpstan-strict-rules from 1.4.3 to 1.4.4 (#5300)
Bumps [phpstan/phpstan-strict-rules](https://github.com/phpstan/phpstan-strict-rules) from 1.4.3 to 1.4.4.
- [Release notes](https://github.com/phpstan/phpstan-strict-rules/releases)
- [Commits](https://github.com/phpstan/phpstan-strict-rules/compare/1.4.3...1.4.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-24 13:45:39 +01:00
Ali
3c55db531d HealthBoostEffect: Ensure that current health is within limits after reducing max health on removal(#5303) 2022-09-24 13:45:12 +01:00
93d4475111 Bump phpstan/phpstan from 1.8.5 to 1.8.6 (#5299)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.8.5 to 1.8.6.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.8.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.8.5...1.8.6)

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

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-23 11:42:50 +01:00
7804172846 Player: added API documentation for some functions 2022-09-21 14:46:04 +01:00
481bda8cd5 Bump build/php from cf79c01 to 50062b5 (#5293)
Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `cf79c01` to `50062b5`.
- [Release notes](https://github.com/pmmp/php-build-scripts/releases)
- [Commits](cf79c01722...50062b5861)

---
updated-dependencies:
- dependency-name: build/php
  dependency-type: direct:production
...

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-21 12:43:06 +01:00
d1c75da14b Player: lock flight state in spectator mode
players should not be able to stop flying in spectator mode
2022-09-20 21:53:51 +01:00
66e70e5b0e 4.9.1 is next 2022-09-20 20:09:38 +01:00
785dc71256 Release 4.9.0 2022-09-20 20:09:38 +01:00
d459afaa54 fix CS 2022-09-20 20:00:40 +01:00
db586233da Changes for 1.19.30 support 2022-09-20 19:50:27 +01:00
23e98a30f5 ItemEntity: don't ignore parent's savable state 2022-09-20 14:50:35 +01:00
5bc7ca6569 ItemEntity: disable saving if the contained item is air or has a zero count 2022-09-20 14:45:10 +01:00
f39d2a9be3 bootstrap: update JIT warning 2022-09-20 14:43:05 +01:00
47d98af6ac Bump ramsey/uuid from 4.5.0 to 4.5.1 (#5292)
Bumps [ramsey/uuid](https://github.com/ramsey/uuid) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/ramsey/uuid/releases)
- [Changelog](https://github.com/ramsey/uuid/blob/4.x/CHANGELOG.md)
- [Commits](https://github.com/ramsey/uuid/compare/4.5.0...4.5.1)

---
updated-dependencies:
- dependency-name: ramsey/uuid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-16 12:53:46 +01:00
82ba7903c8 Fixed wrong key being used for entity type ID in save data (#5288)
closes #5260
2022-09-15 13:40:48 +01:00
112974758e Updated PHPStan to 1.8.5 2022-09-15 12:13:50 +01:00
313850eec4 Updated composer dependencies 2022-09-15 12:08:36 +01:00
a82923acb4 Updated Actions PHP versions 2022-09-15 12:03:36 +01:00
67887afd6b Updated php-cs-fixer version for Actions 2022-09-15 12:03:04 +01:00
3d03bb1301 Fix CS 2022-09-15 12:01:26 +01:00
c063198b89 Fixed incorrect array key type in BrewingStandTest 2022-09-02 20:01:52 +01:00
f3ca6de1eb shut 2022-09-02 20:00:52 +01:00
88eafdd614 Improve type info for RegistryTrait::getAll() and its users 2022-09-02 19:57:22 +01:00
6dd5fec4ea ExperienceManager: remove superfluous doc comment 2022-09-02 19:38:23 +01:00
6866c86d39 BaseInventory: fix CS 2022-09-02 19:36:45 +01:00
a735a69870 BaseInventory: improve type info available to setContents() and internalSetContents() 2022-09-02 19:36:08 +01:00
a0ea74c08f Inventory: Improve quality of type info of arrays 2022-09-02 19:34:12 +01:00
ca4b8a5827 World: remove local static recursion guard variable, closes #3125 2022-09-02 19:24:09 +01:00
f88c4d9a8c Remove more unnecessary local static variable usages
these are never mutated. Local constants would be better, if we had those.
2022-09-02 19:19:04 +01:00
66cd156d80 Utils: use static property for core count cache, instead of local static variable 2022-09-02 19:18:01 +01:00
222049927a Language: fixed bogus callable reference in array_map
for some reason phpstan only reports this under checkImplicitMixed.
2022-09-02 19:15:05 +01:00
d72e947d15 BlockFactory: avoid unnecessary local static variable usage
phpstan treats these as always mixed, because it can't be sure what their types will be.
2022-09-02 19:14:35 +01:00
770cca2efa Server: harden response handling for crash report submission
this eliminates some checkImplicitMixed errors in phpstan.
2022-09-02 19:13:54 +01:00
033dac3d16 Server: be explicit about the player promise resolver type
since there's no way for phpstan to infer the type of this, it becomes implicit mixed, which can conceal bugs.
2022-09-02 19:13:16 +01:00
1ee02d7e02 Do not install pocketmine/locale-data 2.8.9 (it's incorrectly versioned)
the changes made in 2.8.9 should have been released as a new minor version, not a patch.
2022-09-02 18:43:39 +01:00
85678aa356 phpstan 1.8.3 2022-09-02 18:28:33 +01:00
1d253bc8c2 Utils: remove 32-bit specific code from javaStringHash()
this was necessary in the days of 32-bit, but for 64-bit, the 0xffffffff mask is sufficient and produces the exact same result.
2022-09-02 18:23:49 +01:00
973a56ab28 Update composer dependencies 2022-09-02 18:02:16 +01:00
9e0b4621be Fixed languages-not-found bug (#5272)
* Fixed languages-not-found bug

* Update Language.php

Co-authored-by: Dylan T <odigiman@gmail.com>
2022-09-02 03:51:31 +01:00
b7a15b6e01 Bump phpunit/phpunit from 9.5.23 to 9.5.24 (#5266)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.23 to 9.5.24.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.23...9.5.24)

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

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-31 02:11:18 +01:00
456439566b Language: treat empty translation files the same as missing ones 2022-08-31 01:53:15 +01:00
fb25e05416 InventoryManager: fixed current window getting removed in race conditions with close window ACK
this could be observed by pressing E and immediately clicking a chest, which, if timed correctly, would lead to the chest lid closing, but the inventory being opened anyway.
2022-08-27 17:26:43 +01:00
78b5be8dd0 4.8.2 is next 2022-08-26 19:16:39 +01:00
0a92e91a30 Release 4.8.1 2022-08-26 19:16:39 +01:00
b3a13a2f21 in future, do not allow Copilot to write changelogs ... 2022-08-26 19:13:13 +01:00
08b9495bce DyeColorIdMap: fixed uninitialized offset error on invalid dye colours 2022-08-26 18:58:00 +01:00
5779622235 Bump phpunit/phpunit from 9.5.22 to 9.5.23 (#5252)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.22 to 9.5.23.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.22...9.5.23)

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

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-25 19:29:25 +01:00
7f175b47e6 Fix CS 2022-08-25 18:19:22 +01:00
0e73ffe555 CrashDump: Added JIT mode to data
this is necessary for identifying JIT-specific bugs, which, unfortunately, are very common.
2022-08-25 17:39:40 +01:00
1ffd38b37b Utils: fixed currentTrace() when xdebug is loaded, but not in develop mode
this is really dumb... why does it register the functions at all if they aren't usable ???
2022-08-25 16:56:26 +01:00
bd13f39156 Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2022-08-24 20:04:15 +01:00
0c446c276c 4.8.1 is next 2022-08-24 20:03:57 +01:00
0284e65f60 Release 4.8.0 2022-08-24 20:03:56 +01:00
b0d787b3d3 Update BedrockProtocol for 1.19.21 2022-08-24 19:54:41 +01:00
65e3ed43d5 Bump build/php from e90ff50 to cf79c01 (#5248)
Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `e90ff50` to `cf79c01`.
- [Release notes](https://github.com/pmmp/php-build-scripts/releases)
- [Commits](e90ff50310...cf79c01722)

---
updated-dependencies:
- dependency-name: build/php
  dependency-type: direct:production
...

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-24 18:47:04 +01:00
75eba9c9ed 4.7.4 is next 2022-08-22 19:28:47 +01:00
b5a049d1fe Release 4.7.3 2022-08-22 19:28:43 +01:00
bd9fcffe62 Bump build/php from f292501 to e90ff50 (#5242)
Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `f292501` to `e90ff50`.
- [Release notes](https://github.com/pmmp/php-build-scripts/releases)
- [Commits](f292501a70...e90ff50310)

---
updated-dependencies:
- dependency-name: build/php
  dependency-type: direct:production
...

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-22 14:42:17 +01:00
feffbc2c5b Bump phpunit/phpunit from 9.5.21 to 9.5.22 (#5243)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.21 to 9.5.22.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.21...9.5.22)

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

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-22 14:33:16 +01:00
53b51c99b4 Bump pocketmine/locale-data from 2.8.6 to 2.8.7 (#5244)
Bumps [pocketmine/locale-data](https://github.com/pmmp/Language) from 2.8.6 to 2.8.7.
- [Release notes](https://github.com/pmmp/Language/releases)
- [Commits](https://github.com/pmmp/Language/compare/2.8.6...2.8.7)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-22 14:32:50 +01:00
5cb77c8365 GiveCommand: fix CS 2022-08-22 00:55:17 +01:00
bf8befc40b Remove dead comment on GiveCommand (#5241) 2022-08-22 00:49:22 +01:00
f75ca312cc Worker: Unstack tasks in a synchronized block
this prevents any tasks still left in the queue on shutdown getting pulled out by the worker when we're attempting to shut it down.
This led to various race conditions, most notably weird cases where PopulationTask would inexplicably find its expected generator state had not been correctly set up.
2022-08-21 21:57:11 +01:00
d144832928 GiveCommand: limit max amount in line with vanilla 2022-08-21 21:19:16 +01:00
709a869045 Vines can now only be placed on full cube blocks (#5053)
fixes #2673
2022-08-21 21:04:24 +01:00
ac056044ce Updated PHPStan baseline 2022-08-21 20:46:38 +01:00
fc8434308b SignText: changed misleading documentation
this looks like a leftover from the days when sign text was handled by the tile directly
2022-08-21 20:45:23 +01:00
5426b41447 InventoryTransaction: prevent client-authoritative item overstacking
this cheat is often used to carry more items in the inventory, wear multiple pieces of armour in one slot, and more.
2022-08-21 20:35:23 +01:00
af2babec23 GiveCommand: do not accept negative amounts 2022-08-21 20:28:39 +01:00
717ab1989a Update setup-php-action to pmmp/setup-php-action@82a44d659b 2022-08-21 18:14:07 +01:00
83db186b6a Updated setup-php-action to pmmp/setup-php-action@e128aee02f 2022-08-20 18:53:08 +01:00
6a4e5aba8b Update setup-php-action to pmmp/setup-php-action@330b4c2940 2022-08-20 18:03:30 +01:00
c13170a00b Avoid implicit integer cast in Normal::pickBiome()
this throws deprecation warnings on PHP 8.1.
2022-08-20 17:16:38 +01:00
98778052bb actions: start building on 8.1 2022-08-20 16:32:36 +01:00
e86e8254a8 Workaround PHPStan "feature" phpstan/phpstan#7701 2022-08-20 16:29:26 +01:00
1b852ac290 bootstrap: do not complain about xdebug if mode is 'off'
if xdebug.mode=off, the performance impact is the same as if xdebug wasn't loaded.
2022-08-19 16:45:40 +01:00
10b799fadb Bump shivammathur/setup-php from 2.21.1 to 2.21.2 (#5238)
Bumps [shivammathur/setup-php](https://github.com/shivammathur/setup-php) from 2.21.1 to 2.21.2.
- [Release notes](https://github.com/shivammathur/setup-php/releases)
- [Commits](https://github.com/shivammathur/setup-php/compare/2.21.1...2.21.2)

---
updated-dependencies:
- dependency-name: shivammathur/setup-php
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-19 15:51:44 +01:00
bc5008334a Bump pocketmine/locale-data from 2.8.3 to 2.8.6 (#5239)
Bumps [pocketmine/locale-data](https://github.com/pmmp/Language) from 2.8.3 to 2.8.6.
- [Release notes](https://github.com/pmmp/Language/releases)
- [Commits](https://github.com/pmmp/Language/compare/2.8.3...2.8.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-19 15:51:04 +01:00
575dd47db7 4.7.3 is next 2022-08-16 17:51:26 +01:00
e4a5defabb Release 4.7.2 2022-08-16 17:51:26 +01:00
c9626c610b Skin: Correctly handle errors produced by commented JSON decoder 2022-08-16 17:35:23 +01:00
8fb7fff6b9 Update SECURITY.md 2022-08-16 17:22:22 +01:00
5c8d8ff61f Update SECURITY.md 2022-08-16 17:04:25 +01:00
99b55f7427 actions: use newer php-cs-fixer 2022-08-15 17:26:42 +01:00
dce8bd6d21 CS: Standardize new with braces 2022-08-15 17:16:23 +01:00
8fa81242d6 Sugarcane: fixed support conditions (#5052) 2022-08-15 17:08:26 +01:00
2f4a9469b6 Player: spectator shouldn't able to pick blocks they don't have (#5111)
Jury is out on whether they should be able to pick blocks at all, or be considered to have infinite resources, but this solution has been used in a few other places already anyway, so it can be cleaned up another time.
2022-08-15 16:48:37 +01:00
c5b2488fc1 oh come on... 2022-08-14 20:02:07 +01:00
d62df585f2 4.7.2 is next 2022-08-14 19:56:00 +01:00
19d7c2b552 Release 4.7.1 2022-08-14 19:55:56 +01:00
036e06e889 Revert "Workaround items in blockentity NBT not being processed correctly in 1.19.10"
This reverts commit 2b61c025c2.
2022-08-14 17:25:55 +01:00
9343a0b800 Added build log link to Discord release embed 2022-08-14 17:20:01 +01:00
14b4644b03 Added build_log_url to build_info.json 2022-08-14 17:20:01 +01:00
464b65b25c Bump docker/build-push-action from 3.1.0 to 3.1.1 (#5213)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.1.0...v3.1.1)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-12 21:11:11 +01:00
15586ed80e Fix CS 2022-08-12 21:09:15 +01:00
0f8ad8ecf7 Update permission doc output format 2022-08-12 20:47:38 +01:00
82b9afef77 Allow generating RST permission summaries, to be used on doc.pmmp.io 2022-08-12 18:00:52 +01:00
2fc84f6c67 ItemFactory: treat durables with negative meta as unknown items
fixes #5117
2022-08-12 17:24:43 +01:00
566f5935a3 CraftingManagerFromDataHelper: do not register recipes with unknown outputs
fixes #5093

we don't need to check the inputs, since unknown input items shouldn't be obtainable anyway.
2022-08-12 17:19:47 +01:00
44e4dabf6e Fixed Turtle Master potions giving no effects 2022-08-12 17:05:08 +01:00
8acc535218 ffs 2022-08-09 19:27:54 +01:00
e9a1cb7ce5 4.7.1 is next 2022-08-09 19:24:02 +01:00
a21419d120 Release 4.7.0 2022-08-09 19:24:01 +01:00
c2b599166c Added new shiny webhook for Discord release notifications 2022-08-09 19:21:36 +01:00
df7a1fcba6 Changes for 1.19.20 2022-08-09 19:06:05 +01:00
d77a95e4af actions/draft-release: bake the full changelog blob URL into the release notes, to ensure it works properly in emails and embeds 2022-08-06 15:49:04 +01:00
5c72807b16 Bump shivammathur/setup-php from 2.21.0 to 2.21.1 (#5199)
Bumps [shivammathur/setup-php](https://github.com/shivammathur/setup-php) from 2.21.0 to 2.21.1.
- [Release notes](https://github.com/shivammathur/setup-php/releases)
- [Commits](https://github.com/shivammathur/setup-php/compare/2.21.0...2.21.1)

---
updated-dependencies:
- dependency-name: shivammathur/setup-php
  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>
2022-08-06 15:39:36 +01:00
5c6927e16c 4.6.3 is next 2022-08-06 15:35:47 +01:00
9abbb85a93 Release 4.6.2 2022-08-06 15:35:47 +01:00
554182b2cb Update composer dependencies 2022-08-06 15:27:11 +01:00
d669a6f0c7 ReversePriorityQueue: add ReturnTypeWillChange attribute
it's doubtful any plugin dev is extending this, but nonetheless, we can't change it in a patch.
2022-07-27 03:51:06 +01:00
5d9f783037 InGamePacketHandler: do not update player rotation if it didn't change
setRotation() does an alarmingly large amount of work...
2022-07-24 21:07:35 +01:00
01ca14c314 InGamePacketHandler: avoid processing movement if position is unchanged since last tick 2022-07-24 21:00:12 +01:00
608c6ed6db Improved suboptimal code in Player::handleMovement() 2022-07-24 20:51:28 +01:00
c26631d06d InGamePacketHandler: avoid useless object allocations when forceMoveSync=false (99.9% of the time) 2022-07-24 20:44:27 +01:00
b75bc61a64 InGamePacketHandler: don't bother checking for flag changes if the flag fields are identical
we don't need to check this on a bit by bit level if the integers are the same.

this saves 2-3 microseconds per packet on my machine, which doesn't sound like much, but it adds up when there are lots of players.
2022-07-24 20:35:49 +01:00
3724479be3 InGamePacketHandler: improve performance of input flag resolving 2022-07-24 20:33:35 +01:00
eb916fe43d Use a falling block entity to improve client side performance of FloatingTextParticle (#4714)
Performance tests show that this has a considerable client-side performance advantage over using players. In my local tests, using 1000 floating texts in a 10x10x10 area, I observed an FPS increase from 1.5 to 8.0.
2022-07-24 18:22:21 +01:00
5e3b3a0700 Fix assert spam on debug clients 2022-07-24 17:51:02 +01:00
e10a624444 4.6.2 is next 2022-07-22 19:35:10 +01:00
b20e04539d Release 4.6.1 2022-07-22 19:34:57 +01:00
4852f8029a AsyncTask: update documentation 2022-07-21 23:26:46 +01:00
c4f85e526b Bump shivammathur/setup-php from 2.20.0 to 2.21.0 (#5181)
Bumps [shivammathur/setup-php](https://github.com/shivammathur/setup-php) from 2.20.0 to 2.21.0.
- [Release notes](https://github.com/shivammathur/setup-php/releases)
- [Commits](https://github.com/shivammathur/setup-php/compare/2.20.0...2.21.0)

---
updated-dependencies:
- dependency-name: shivammathur/setup-php
  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>
2022-07-20 15:19:21 +01:00
6cee428287 Bump docker/build-push-action from 3.0.0 to 3.1.0 (#5182)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.0.0...v3.1.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  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>
2022-07-20 15:18:38 +01:00
bcba064d69 Bump build/php from 1110349 to f292501 (#5180)
Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `1110349` to `f292501`.
- [Release notes](https://github.com/pmmp/php-build-scripts/releases)
- [Commits](11103498ca...f292501a70)

---
updated-dependencies:
- dependency-name: build/php
  dependency-type: direct:production
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-20 15:16:34 +01:00
86647683bc fix CS again 2022-07-19 20:35:34 +01:00
64f0e58e60 Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2022-07-19 20:17:15 +01:00
62f21516d1 build/generate-registry-annotations.php: allow processing a single file
this is useful for automatically invoking the script via a PhpStorm file watcher.
2022-07-19 20:17:07 +01:00
c553f7cf06 build/generate-registry-annotations.php: write to stderr on error 2022-07-19 20:15:44 +01:00
fec89b7803 Lava burns entities for only 8 seconds in Bedrock (#5173) 2022-07-17 20:50:15 +01:00
2b61c025c2 Workaround items in blockentity NBT not being processed correctly in 1.19.10
closes #5154

this hack sends only the bare essential data to create the tiles in LevelChunkPacket,
and then separately sending the full tile data using BlockActorDataPacket afterwards.

This is necessary because the client doesn't handle items correctly in NBT when chunks are sent without using the SubChunkRequest system.
In 4.6 this is observed with incorrect items shown in item frames; in 5.0 it's seen with items simply not showing up at all (difference due to modernization of the serialization format in 5.0).
2022-07-14 21:54:01 +01:00
c7133bc2e6 InGamePacketHandler: don't kick the player out of inventory windows on actor events
this is sent when the player crafts something using an anvil.
2022-07-14 20:36:11 +01:00
baf75089f5 Entity: cancel fire damage for fireproof entities 2022-07-14 19:53:25 +01:00
Ali
705df7d508 EffectManager: remove redundant check (#5153) 2022-07-14 17:56:18 +01:00
75d7adfb2d WitherEffect: fixed incorrect damage interval 2022-07-14 16:05:35 +01:00
9d535e2917 4.6.1 is next 2022-07-13 01:28:42 +01:00
3ccd288afd Release 4.6.0 2022-07-13 01:28:37 +01:00
06655bee78 Updated to 1.19.10 2022-07-13 00:59:49 +01:00
0ad2985247 Update documentation for Item::__construct() 2022-07-06 23:54:29 +01:00
269b6ed16a FallableTrait: fixed logic for block replacement
closes #5126

I don't know why it wasn't done this way to begin with. FallingBlock always used canBeReplaced()...
2022-07-06 16:16:49 +01:00
f031c3c602 Updated NBT dependency 2022-07-06 15:19:19 +01:00
f3e09dd7d5 Bump shivammathur/setup-php from 2.19.1 to 2.20.0 (#5135)
Bumps [shivammathur/setup-php](https://github.com/shivammathur/setup-php) from 2.19.1 to 2.20.0.
- [Release notes](https://github.com/shivammathur/setup-php/releases)
- [Commits](https://github.com/shivammathur/setup-php/compare/2.19.1...2.20.0)

---
updated-dependencies:
- dependency-name: shivammathur/setup-php
  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>
2022-07-06 13:28:46 +01:00
68e704bf97 Bump shivammathur/setup-php from 2.19.0 to 2.19.1 (#5098)
Bumps [shivammathur/setup-php](https://github.com/shivammathur/setup-php) from 2.19.0 to 2.19.1.
- [Release notes](https://github.com/shivammathur/setup-php/releases)
- [Commits](https://github.com/shivammathur/setup-php/compare/2.19.0...2.19.1)

---
updated-dependencies:
- dependency-name: shivammathur/setup-php
  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>
2022-07-04 15:15:17 +01:00
9898577135 Bump phpstan/phpstan from 1.7.15 to 1.8.0 (#5120)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.7.15 to 1.8.0.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.8.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.7.15...1.8.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>
2022-06-30 16:09:03 +01:00
784d602600 Fixed ItemBreakParticle using untranslated internal ID/meta for network data
this caused it to display particles for incorrect items. It may also have been possibly responsible for client crashes.
2022-06-29 14:01:39 +01:00
15c99cfe77 4.5.3 is next 2022-06-29 02:18:50 +01:00
d5fa0a2fc5 Release 4.5.2 2022-06-29 02:18:50 +01:00
0da9260994 Updated composer dependencies 2022-06-29 02:13:32 +01:00
df2d1fd4f9 of course there were two bugs on one line ... 2022-06-24 01:40:26 +01:00
9f65fb5f90 Fixed top-side skulls with no-drop flag set being treated as unknown blocks 2022-06-24 01:31:11 +01:00
caa4b78a3f Update composer dependencies 2022-06-21 20:21:02 +01:00
14352a05bc reword support bot message 2022-06-11 15:54:44 +01:00
bb5b52d998 Player: fix terrain getting redrawn when moving in noclip mode 2022-06-09 13:48:29 +01:00
5e22b70b6d this is a joke ... 2022-06-08 14:56:25 +01:00
02513818a9 4.5.2 is next 2022-06-08 02:50:34 +01:00
d641812c52 Release 4.5.1 2022-06-08 02:50:33 +01:00
a851496293 Updated BedrockProtocol 2022-06-08 02:46:01 +01:00
01a8bce2dd Fix whitespace error in support.yml workflow 2022-06-07 19:54:51 +01:00
becbd562d6 FormattedCommandAlias: fixed incorrect arguments array being passed to the target 2022-06-07 19:47:45 +01:00
82edb20e0c 4.5.1 is next 2022-06-07 17:57:39 +01:00
64a8c462f9 Release 4.5.0 2022-06-07 17:57:39 +01:00
4ec97d0f7a InGamePacketHandler: added missing break
I'm getting sloppy ...
2022-06-07 17:52:59 +01:00
016a80bb70 1.19.0 changes 2022-06-07 17:47:13 +01:00
ce66a400a7 Updated composer dependencies 2022-06-07 17:44:06 +01:00
50776875bb 4.4.3 is next 2022-06-07 15:54:55 +01:00
bcb0e2ff1f Release 4.4.2 2022-06-07 15:54:55 +01:00
1584768c80 PaintingMotive: fixed botched painting fix from 0ea3861d43
I knew I should have used a singleton for this ...
2022-06-07 15:48:20 +01:00
5fd685e07d TypeConverter: fix crash on arbitrary out-of-bounds item IDs
I don't know why I didn't consider this fix necessary when the item meta bug was originally discovered.
2022-06-06 19:29:44 +01:00
6ecfbd1bde FishingRod: make class less useless 2022-06-05 20:20:16 +01:00
b661097c51 changelog: fix mistake
[ci skip]
2022-06-05 17:59:36 +01:00
0771295899 4.4.2 is next 2022-06-05 16:15:38 +01:00
702816458c Release 4.4.1 2022-06-05 16:15:34 +01:00
e040c2b281 InventoryManager: fixed windows not opening when the server removes windows
closes #5094
2022-06-05 16:03:24 +01:00
e12e4e8fb8 StatusCommand: fixed output of global memory limit (#5090)
Fix incorrect "Maximum memory (manager)" output
2022-06-04 17:41:55 +01:00
d15a90899e build fix 2022-06-04 17:38:45 +01:00
237c2866e0 Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2022-06-04 17:35:18 +01:00
38d6284671 Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
7355798e77 Exit with error code if the server failed to start
this ensures that external tools such as start.cmd actually see an error if there is one
2022-06-03 18:34:54 +01:00
4b662d65b3 PluginManager: check graylist before doing any loadability checks
fixes #5087
2022-06-02 16:29:22 +01:00
c87a3b054c composer.json: fix make-devtools command 2022-06-01 20:04:47 +01:00
8b86e43d51 Update support.yml 2022-06-01 15:56:47 +01:00
eade2d2af0 4.4.1 is next 2022-06-01 15:37:48 +01:00
f2299a562f Release 4.4.0 2022-06-01 15:37:48 +01:00
3fcf6372e0 Merge branch 'stable' into next-minor 2022-06-01 15:32:37 +01:00
533cb77c50 Updated dependencies 2022-06-01 15:29:39 +01:00
681a9bb0e1 Bump build/php from 8138c6a to 1110349 (#5075)
Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `8138c6a` to `1110349`.
- [Release notes](https://github.com/pmmp/php-build-scripts/releases)
- [Commits](8138c6a4a4...11103498ca)

---
updated-dependencies:
- dependency-name: build/php
  dependency-type: direct:production
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-31 17:18:47 +01:00
6c080dae55 Bump shivammathur/setup-php from 2.18.1 to 2.19.0 (#5076)
Bumps [shivammathur/setup-php](https://github.com/shivammathur/setup-php) from 2.18.1 to 2.19.0.
- [Release notes](https://github.com/shivammathur/setup-php/releases)
- [Commits](https://github.com/shivammathur/setup-php/compare/2.18.1...2.19.0)

---
updated-dependencies:
- dependency-name: shivammathur/setup-php
  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>
2022-05-31 17:18:27 +01:00
670fb4de74 Bump phpstan/phpstan from 1.7.1 to 1.7.4 (#5074)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.7.1 to 1.7.4.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.7.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.7.1...1.7.4)

---
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>
2022-05-30 16:09:30 +01:00
6d7318af43 Liquid: fixed merge regression 2022-05-26 18:48:45 +01:00
97c0d72e28 ItemFactory: use import aliases to reduce code width 2022-05-26 15:55:33 +01:00
4ccae2d1de BlockFactory: use import aliases to reduce code width 2022-05-26 15:50:29 +01:00
b36c6ea13b StringToItemParser: Use import aliases to reduce code width 2022-05-26 15:40:18 +01:00
39b8daeeec Living: fixed a usage of hardcoded numeric ID 2022-05-25 22:23:14 +01:00
c492352d50 changelog: fix typo
[ci skip]
2022-05-25 17:09:29 +01:00
8f1452acd1 4.4.0-BETA2 is next 2022-05-25 16:44:32 +01:00
8a2ba584ab Release 4.4.0-BETA1 2022-05-25 16:44:17 +01:00
227f28a6d2 Use VanillaItems::AIR() instead of ItemFactory 2022-05-24 15:47:27 +01:00
812d5c3f58 Merge branch 'stable' into next-minor 2022-05-24 14:17:53 +01:00
9a5a03ef83 Bump phpstan/phpstan from 1.6.8 to 1.7.1 (#5067)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.6.8 to 1.7.1.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.7.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.6.8...1.7.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>
2022-05-24 13:46:09 +01:00
38d75f3aab Player: Be more explicit about not parsing chat messages when messageCounter is zero
the length check technically accounts for this, but future readers might not realize this
2022-05-22 16:46:53 +01:00
179cac45f5 Merge branch 'stable' into next-minor 2022-05-22 16:21:05 +01:00
1591881bf2 4.3.5 is next 2022-05-22 16:12:24 +01:00
7bbb2617c8 Release 4.3.4 2022-05-22 16:12:12 +01:00
2ec65ba799 ExplosionPrimeEvent: require a positive explosion radius 2022-05-21 23:22:04 +01:00
3dd7c09351 Improve documentation of ExplosionPrimeEvent and EntityExplodeEvent 2022-05-21 23:00:34 +01:00
afc6e8878d EntityExplodeEvent: clamp yield in range 0-100 2022-05-21 22:44:45 +01:00
7eaf1246a0 Explosion: cap yield at 100%
this could overflow if the explosion size is less than 1.
While this currently doesn't have any negative effects, if we decided to support >100% yield, this would cause some issues.
2022-05-21 22:43:26 +01:00
645c44ae9c Explosion: remove unused variables 2022-05-21 22:41:28 +01:00
331b05c681 Improve documentation of EntitySpawnEvent and EntityDespawnEvent 2022-05-21 22:11:37 +01:00
3abe80184a Update ItemSpawnEvent doc (#5059) 2022-05-21 22:09:21 +01:00
7618b13c6e ItemDespawnEvent: improve documentation 2022-05-21 21:57:14 +01:00
351cd4bfd7 Improve documentation of world-related events 2022-05-21 21:46:53 +01:00
1154c7c1ab PlayerQuitEvent: improve documentation 2022-05-21 21:23:13 +01:00
4a3e42f82e PlayerTransferEvent: add documentation 2022-05-21 21:21:51 +01:00
8ecf9717d6 PlayerItemHeldEvent: add documentation
since some nuances of the intended behaviour were previously unclear...
2022-05-21 21:21:13 +01:00
3ca80b353b InventoryTransactionEvent: rewrite documentation 2022-05-21 21:20:11 +01:00
7d172e2211 PlayerCommandPreprocessEvent: updated documentation 2022-05-21 21:07:29 +01:00
e934e2bd26 PlayerDropItemEvent: updated documentation
this can be triggered by dropping an item outside of the inventory menu while the inventory window is open.
2022-05-21 21:05:27 +01:00
3177d19730 PlayerKickEvent: improved woefully inadequate documentation 2022-05-21 21:03:56 +01:00
82104a8251 UpdateNotifyEvent: updated documentation 2022-05-21 20:32:30 +01:00
e9a17374d1 Rewrite documentation of CommandEvent
no wonder people get the idea to use this shit for banning commands ...
2022-05-21 20:29:25 +01:00
a31bd19b5a Deprecated PlayerCommandPreProcessEvent
to be removed in PM5

see #4284
2022-05-21 20:20:09 +01:00
c82dfef9b0 Player: fix weird behaviour when teleporting sleeping players
closes #4672
2022-05-21 20:08:12 +01:00
1181b13b5d Player: call InventoryCloseEvent after doing the necessary business
closes #4626

this does change the behaviour of getCurrentWindow() during InventoryCloseEvent, but no one should be using that anyway, since InventoryCloseEvent->getInventory() exists.
2022-05-21 19:23:59 +01:00
688be0a404 Server: apply server.properties difficulty to newly generated worlds
see #5057

jury is out on whether or not this should override difficulty on preexisting worlds, but it's non-controversial that it should apply at least to newly generated worlds.
2022-05-21 18:46:38 +01:00
33e6b63fe5 Explosion: remove unused local variable in explodeB() 2022-05-21 17:39:11 +01:00
5d92eddc82 InventoryTransaction: provide object ID of failed action for debugging identification
closes #3235
2022-05-21 17:35:21 +01:00
0324392cd8 Clean PHPStan baseline 2022-05-21 17:12:47 +01:00
01b0742bd4 LightUpdate: account for virtual nodes in prepareNodes()
fixes #3959
2022-05-21 17:07:49 +01:00
02cf6ae46c Added PlayerDeathEvent->setKeepXp(), closes #4002 (#4015) 2022-05-21 16:41:14 +01:00
fcb2ccab99 NetworkSession: Sync all attributes on respawn 2022-05-21 16:22:35 +01:00
a38a5c67f1 GiveCommand: show the search term in audit message, instead of the ID
this is more useful in the longer term.
2022-05-21 15:49:17 +01:00
a45a96b3ee ShulkerBoxInventory: fixed inappropriate usage of BlockLegacyIds when comparing item IDS 2022-05-21 15:40:25 +01:00
86efa0aae6 Merge remote-tracking branch 'origin/stable' into next-minor 2022-05-20 17:49:04 +01:00
2b84cb7be4 DisablePluginException now can be used to disable plugins (#4780)
closes #2671
2022-05-20 17:01:34 +01:00
26df37e6ef Minecart: fixed max stack size to match vanilla (#5051) 2022-05-20 16:57:48 +01:00
554f96bc24 InventoryManager: Defer opening new windows to the client until the window close handshake has been completed
fixes #5021 and probably a bunch of other inventory related glitches

When the server initiates a window close, it does so by sending a ContainerClose to the client, which causes the
client to behave as if it initiated the close itself. It responds by sending a ContainerClose back to the server,
which the server is then expected to respond to.

Sending the client a new window before sending this final response creates buggy behaviour on the client, which
is problematic when switching windows. Therefore, we defer sending any new windows until after the client
responds to our window close instruction, so that we can complete the window handshake correctly.

This is a pile of complicated garbage that only exists because Mojang overengineered the process of opening and
closing inventory windows.
2022-05-20 16:54:15 +01:00
6482aa7c64 Block: introduce logic for face support types (#4886)
fixes #4856
fixes #458
fixes #4529
fixes #3299

Added API method Block::getSupportType(Facing) : SupportType
Added SupportType enum
fixes torch, lantern, door etc. placement on slabs and upside-down stairs
2022-05-20 15:18:34 +01:00
6d941640a9 Merge branch 'stable' into next-minor 2022-05-20 11:14:59 +01:00
0ea3861d43 Fixed paintings not working in newly generated worlds
Paintings would not work unless at least one entity was loaded from disk
(or saved).
2022-05-20 11:13:14 +01:00
a323a5e56d Bump docker/login-action from 1 to 2 (#5048)
Bumps [docker/login-action](https://github.com/docker/login-action) from 1 to 2.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-18 13:30:39 +01:00
79caba22a7 Bump docker/build-push-action from 2.10.0 to 3.0.0 (#5046)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2.10.0 to 3.0.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v2.10.0...v3.0.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-18 13:29:44 +01:00
30815bc8a2 Bump actions/upload-artifact from 2 to 3 (#5047)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-18 13:29:19 +01:00
df3a69dcb7 Modernize private property declarations in Threaded classes
I previously avoided this due to being unsure of the effects; however, it's clear that we already use typed properties on Threaded things in other places anyway, and the only known issues are with uninit properties, and arrays.
2022-05-17 22:42:18 +01:00
d4b7f66e15 Promote some constructors 2022-05-17 22:34:58 +01:00
8e767da29e Modernize some final remaining private property declarations 2022-05-17 21:55:57 +01:00
c0b15de504 Modernize private static property declarations 2022-05-17 21:55:16 +01:00
1d5430937f Modernize private property declarations in src/timings 2022-05-17 21:54:45 +01:00
9de88aa734 Modernize private property declarations in src/scheduler 2022-05-17 21:53:38 +01:00
9e59819f06 Modernize private property declarations in src/resourcepacks 2022-05-17 21:52:07 +01:00
c60311617d Modernize private property declarations in src/plugin 2022-05-17 21:37:45 +01:00
7bc3dcdefd Modernize private property declarations in src/player 2022-05-17 21:36:51 +01:00
22edca610c Modernize private property declarations in src/permission 2022-05-17 21:28:42 +01:00
6eac2ea7a5 Modernize private property declarations in src/network 2022-05-17 21:22:33 +01:00
cd016bedce Network: Improve typeinfo for PHPStan on bannedIps 2022-05-17 21:19:48 +01:00
95ad3f16e1 Modernize private property declarations in src/item 2022-05-17 20:59:24 +01:00
fb4d332d1a Modernize private property declarations in src/inventory/transaction 2022-05-17 20:51:22 +01:00
a06b9294df Modernize private property declarations in src/inventory 2022-05-17 20:49:12 +01:00
221c6b8570 Remove useless @var 2022-05-17 20:46:24 +01:00
eb95e2a97e Modernize private property declarations in src/event 2022-05-17 20:45:50 +01:00
ec6769a6fc Modernize private property declarations in src/entity 2022-05-17 20:42:17 +01:00
343a12626e Modernize private property declarations in src/data 2022-05-17 20:35:59 +01:00
d11d77d328 Modernize private property declarations in src/crash 2022-05-17 20:35:24 +01:00
20eb80fc9a Modernize private property declarations in src/console 2022-05-17 20:34:55 +01:00
071067effb Fixed flower pot accepting any block 2022-05-17 20:30:02 +01:00
89cc449808 Update exhaustion values for 1.18.30 (#5034) 2022-05-17 18:28:19 +01:00
1e59679ec2 Implemented Stonecutter (#4732) 2022-05-17 16:01:03 +01:00
8b8560a701 Added PlayerPostChunkSendEvent (#4937)
this is primarily useful for debugging plugins, but could also be useful for other things, such as spawning fake blocks, particles, etc.
2022-05-17 15:40:01 +01:00
161ab5af16 Bump docker/setup-buildx-action from 1 to 2 (#5042)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 1 to 2.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-17 15:24:47 +01:00
ab41594da2 Bump actions/checkout from 2 to 3 (#5041)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-17 15:24:23 +01:00
80d4c11061 Bump ncipollo/release-action from 1.8.6 to 1.10.0 (#5040)
Bumps [ncipollo/release-action](https://github.com/ncipollo/release-action) from 1.8.6 to 1.10.0.
- [Release notes](https://github.com/ncipollo/release-action/releases)
- [Commits](https://github.com/ncipollo/release-action/compare/v1.8.6...v1.10.0)

---
updated-dependencies:
- dependency-name: ncipollo/release-action
  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>
2022-05-17 15:17:33 +01:00
e767796986 Bump shivammathur/setup-php from 2.12.0 to 2.18.1 (#5043)
Bumps [shivammathur/setup-php](https://github.com/shivammathur/setup-php) from 2.12.0 to 2.18.1.
- [Release notes](https://github.com/shivammathur/setup-php/releases)
- [Commits](https://github.com/shivammathur/setup-php/compare/2.12.0...2.18.1)

---
updated-dependencies:
- dependency-name: shivammathur/setup-php
  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>
2022-05-17 15:16:08 +01:00
dea7031b86 Bump actions/cache from 2 to 3 (#5044)
Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-17 15:15:52 +01:00
7e3d099d5b Update dependabot.yml 2022-05-17 15:08:52 +01:00
8b1bd5b7ff World: do not hardcode length of day in computeSunAnglePercentage() 2022-05-16 18:17:32 +01:00
4dbac79e86 Merge branch 'stable' into next-minor 2022-05-16 18:02:25 +01:00
5abc7f866a 4.3.4 is next 2022-05-16 17:50:41 +01:00
9dc2a01c2e Release 4.3.3 2022-05-16 17:50:29 +01:00
6f0aa360d1 Bump build/php from 19222cf to 8138c6a (#5039)
Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `19222cf` to `8138c6a`.
- [Release notes](https://github.com/pmmp/php-build-scripts/releases)
- [Commits](19222cfb28...8138c6a4a4)

---
updated-dependencies:
- dependency-name: build/php
  dependency-type: direct:production
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-16 17:20:24 +01:00
7c3b78b0a0 ItemFactory: fix missing registration for dead coral fans
closes #5032

this is evidently not an ideal solution, and something more dynamic would be preferred so that we don't have to manually register an item for every permutation.
2022-05-13 13:53:28 +01:00
12e4724b19 Merge remote-tracking branch 'origin/stable' into next-minor 2022-05-11 20:45:16 +01:00
52e74296de Stop the server if any plugin failed to load or enable (#4951)
closes #3080 

If plugins fail to load for some reason, it's highly likely that some critical functionality of the server is compromised. For example:
- if an NPC plugin fails to load, all custom entities added by that plugin will be deleted from worlds
- if a world protection plugin fails, players will be able to grief your otherwise immutable lobby map
- if a worldgen plugin fails, worlds using custom generators won't load
- if a permission plugin fails, players might have access to commands and features they aren't supposed to have
- the list goes on...

This change makes the server commit graceful suicide if any plugin fails to load for error-related reasons, including (but not limited to):
- Incompatible API version
- Missing dependencies
- Invalid plugin.yml
- Invalid main class

Plugins prevented from loading by `plugin_list.yml` are not considered errors and **are not** included in this change. If a plugin is disallowed from loading due to the `plugin_list`, the server will continue to run as if the plugin was not present.
2022-05-11 20:43:38 +01:00
3b7e274c34 Server: localize 'forcing server shutdown' message 2022-05-11 14:54:29 +01:00
db6abfb227 Stop the server if generators specified for new worlds are not valid
I thought I did this already in eff856d8e5, but it looks like my brain slipped a gear.

Without this change, it's possible to crash the server by specifying an invalid generator for the default world if it doesn't yet exist.
2022-05-11 14:35:20 +01:00
2adaca2521 README: remove unnecessary things
[ci skip]
2022-05-11 13:53:52 +01:00
b6f39035f8 README: fix logo URLs
[ci skip]
2022-05-11 13:52:00 +01:00
cfd550451f Added dark mode variant of the logo (#5014)
Since the text is barely visible on dark mode (black on black), i added an inverted version that only shows with dark mode using the [picture](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture) tag.
The tag is supported in all browsers except IE since ~2015
I added an exception block for old IE versions, new versions dropped support for `[if IE]` though
2022-05-11 13:44:20 +01:00
9ff1bf6deb Merge remote-tracking branch 'origin/stable' into next-minor 2022-05-11 13:12:45 +01:00
212c94ce98 PluginManager: Log an error message when a plugin disables itself during enabling 2022-05-11 13:07:45 +01:00
77530b0c24 Bump build/php from 0b5760b to 19222cf (#5027)
Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `0b5760b` to `19222cf`.
- [Release notes](https://github.com/pmmp/php-build-scripts/releases)
- [Commits](0b5760bb3b...19222cfb28)

---
updated-dependencies:
- dependency-name: build/php
  dependency-type: direct:production
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-11 12:55:36 +01:00
3e1246acff FormattedCommandAlias: Invoke commands directly with pre-parsed arguments
this resolves a range of issues with quoted arguments when using placeholders, as well as improving performance (no redundant combine -> re-parse needed).
2022-05-10 16:03:09 +01:00
4c29f98292 "Fix CS" are going to be my final words ... 2022-05-10 15:39:44 +01:00
5cc0d92eff Fixed PHPStan errors 2022-05-10 15:38:26 +01:00
b875b68fc7 Fix PHPStan error in CommandStringHelperTest 2022-05-10 15:24:14 +01:00
a5ebbf8adb Fix CS again 2022-05-10 15:23:55 +01:00
217385efb9 CommandStringHelper::parse() returns a non-empty list of strings 2022-05-10 15:22:46 +01:00
f70c36baf9 SimpleCommandMap: parse config-defined commands according to the same rules as manually typed commands 2022-05-10 15:21:39 +01:00
eda4ae9181 Added unit tests for CommandStringHelper 2022-05-10 15:11:29 +01:00
d2e421c424 CommandStringHelper: fixed backslashes not being removed from escaped quotes
this time, without breaking eval commands ... stripslashes likes to strip ALL backslashes, whether they are actually escaping something or not, which is super annoying.
2022-05-10 15:09:57 +01:00
6da53536ca Merge branch 'next-minor' of github.com:pmmp/PocketMine-MP into next-minor 2022-05-10 14:30:21 +01:00
1da6aa40f8 Leaves: drop sticks with a 2% chance (#5019)
as per vanilla
2022-05-10 14:17:18 +01:00
a913736235 fix CS 2022-05-10 14:13:01 +01:00
124edeacaf fix build 2022-05-10 14:11:46 +01:00
a216f4d089 Utils: improve representation of int, float and null in stack trace parameters 2022-05-10 14:07:07 +01:00
17b0e0be84 Utils: use match to clean up stringifyValueForTrace() 2022-05-10 14:04:52 +01:00
81d8aed2e2 Utils: account for named variadic arguments in printableTrace() 2022-05-10 13:59:42 +01:00
69418084bc Boat: fixed max stack size to match vanilla (#5018) 2022-05-10 13:16:04 +01:00
593a4b65ea World: fixed crash when using unloadChunk() during ChunkPopulateEvent, ChunkLoadEvent or when using ChunkListeners
I sure hope there isn't any other cases where this edge case can appear ...

closes #5022
2022-05-10 13:09:26 +01:00
869d340f10 Regenerate PHPStan baselines 2022-05-10 12:38:20 +01:00
5d64d4a1e3 Updated phpstan-strict-rules 2022-05-10 12:34:27 +01:00
cc3c5bdb8d Bump phpstan/phpstan from 1.6.7 to 1.6.8 (#5025)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.6.7 to 1.6.8.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.7.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.6.7...1.6.8)

---
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>
2022-05-10 12:32:22 +01:00
e1c4150dff 4.3.3 is next 2022-05-10 00:57:50 +01:00
755ca1af9b Release 4.3.2 2022-05-10 00:57:50 +01:00
7d78b9cb2c Bump build/php from f5d7b45 to 0b5760b (#5023)
Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `f5d7b45` to `0b5760b`.
- [Release notes](https://github.com/pmmp/php-build-scripts/releases)
- [Commits](f5d7b45990...0b5760bb3b)

---
updated-dependencies:
- dependency-name: build/php
  dependency-type: direct:production
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-10 00:55:07 +01:00
91f802ac7a Bump phpstan/phpstan from 1.6.3 to 1.6.7 (#5015)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.6.3 to 1.6.7.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.7.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.6.3...1.6.7)

---
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>
2022-05-05 11:49:27 +01:00
72cfea3a63 SimpleCommandMap: extract command string parsing code into its own unit 2022-05-01 22:05:38 +01:00
a353872327 FormattedCommandAlias: match placeholders using regex 2022-05-01 21:16:13 +01:00
f4d71d0b48 FormattedCommandAlias: reduce complexity of buildCommand() 2022-05-01 21:04:38 +01:00
a6299b0927 pocketmine.yml: moar docs for command aliases hidden features 2022-05-01 16:16:32 +01:00
6e372d9e36 Entity: fixed setNameTagVisible not having immediately visible effect 2022-05-01 14:54:41 +01:00
ad8132ae11 Bump build/php from 7b357f8 to f5d7b45 (#5004)
Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `7b357f8` to `f5d7b45`.
- [Release notes](https://github.com/pmmp/php-build-scripts/releases)
- [Commits](7b357f8cf9...f5d7b45990)

---
updated-dependencies:
- dependency-name: build/php
  dependency-type: direct:production
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-01 14:04:38 +01:00
5d39d7a1c8 Version bump to 4.4 2022-04-28 21:00:49 +01:00
937bb4c6ce Merge branch 'stable' into next-minor 2022-04-28 21:00:23 +01:00
cf15a0913d World: fixed a corner case assertion failure in generation system
This required the following:
- A generation task (taskA) to already be running for any chunk (chunkA)
- A chunk (chunkB) is requested for generation, and the task (taskB) to do the generation
  is commenced immediately
- chunkB generation promise is aborted (e.g. due to chunk unload) and
  taskB is orphaned
- chunkB is subsequently re-requested, but ends up in the generation
  queue because taskB is still running
- taskA completes and drains the generation queue
- chunkB attempts to be populated a second time, but taskB has not yet
  been collected, resulting in an assertion failure.

This bug has been appearing intermittently ever since PM 4.0 release.
For most users there is no obvious effect since production servers don't
have assertions enabled; however, it's unclear what kind of weird side
effects this bug may have had.
2022-04-28 20:23:23 +01:00
33cf085692 PHPStan 1.6.3 2022-04-28 16:06:20 +01:00
3752225ed5 World: fix CS 2022-04-28 16:00:34 +01:00
5cf572892f WorldManager: fixed missing initializer for $defaultWorld 2022-04-28 15:38:20 +01:00
20ff5d5a3d Modernize property declarations in src/entity/animation 2022-04-28 15:33:13 +01:00
b88a47929f Modernize property declarations in src/world/* 2022-04-28 15:06:17 +01:00
159392e738 wtf is this shitbox code 2022-04-28 14:57:57 +01:00
2f03af51dd Modernize property declarations in src/world/sound 2022-04-28 14:57:01 +01:00
cb76c149e1 Modernize property declarations in src/world/particle 2022-04-28 14:55:53 +01:00
6d7bf1c5d8 Utils: fixed missing property initializer 2022-04-28 14:52:21 +01:00
ed2a239334 Modernize property declarations in src/world/generator 2022-04-28 13:16:21 +01:00
46c504e529 Modernize property declarations in src/ 2022-04-28 13:14:23 +01:00
0e7e776862 Modernize property declarations in src/utils 2022-04-28 13:12:12 +01:00
de12b701ac Modernize type declarations in src/world/format 2022-04-28 13:07:58 +01:00
b402df8b91 Modernize property declarations in pocketmine\crafting namespace 2022-04-25 13:15:48 +01:00
dca457b1e0 Modernize property declarations in pocketmine\command namespace 2022-04-25 13:09:14 +01:00
72cff0ee11 Modernize property declarations in pocketmine\block namespace 2022-04-25 13:00:29 +01:00
09778e3f1b Fixed build failure 2022-04-25 12:56:16 +01:00
9f5d4180c9 Spawnable: remove dead code, deprecate isDirty() and setDirty() 2022-04-25 12:46:01 +01:00
c8a7a53d70 event: modernize property declarations where possible
only private fields are modified; protected ones can't be changed in case someone extended the classes
2022-04-25 00:06:26 +01:00
223893fd5c PlayerChangeSkinEvent: remove obsolete doc comment 2022-04-24 21:56:49 +01:00
a58551af5b 4.3.2 is next 2022-04-23 16:03:15 +01:00
f7dce4af88 Release 4.3.1 2022-04-23 16:03:14 +01:00
dff5c30172 Updated BedrockProtocol to 9.0.1 2022-04-23 16:01:08 +01:00
e8994dbc17 Bump build/php from 1fae6b8 to 7b357f8 (#4987)
Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `1fae6b8` to `7b357f8`.
- [Release notes](https://github.com/pmmp/php-build-scripts/releases)
- [Commits](1fae6b8d4a...7b357f8cf9)

---
updated-dependencies:
- dependency-name: build/php
  dependency-type: direct:production
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-23 14:20:47 +01:00
aaba8a2a9a Bump phpstan/phpstan from 1.5.6 to 1.5.7 (#4975)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.5.6 to 1.5.7.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.6.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.5.6...1.5.7)

---
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>
2022-04-21 16:45:16 +01:00
27056b6c37 Player: creative players should not be damaged by the void (#4978) 2022-04-21 16:39:36 +01:00
9930de01b9 Bump phpstan/phpstan-phpunit from 1.1.0 to 1.1.1 (#4979)
Bumps [phpstan/phpstan-phpunit](https://github.com/phpstan/phpstan-phpunit) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/phpstan/phpstan-phpunit/releases)
- [Commits](https://github.com/phpstan/phpstan-phpunit/compare/1.1.0...1.1.1)

---
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>
2022-04-21 16:38:36 +01:00
cd021f49cd 4.3.1 is next 2022-04-20 14:15:12 +01:00
e4ce467c0b Release 4.3.0 2022-04-20 14:15:06 +01:00
6b4687a36b RuntimeBlockMapping: unseal constructor to facilitate easier testing of new versions 2022-04-20 14:00:20 +01:00
c085bf0db4 Changes for 1.18.30 2022-04-20 13:59:50 +01:00
e0d4bd985e 4.2.11 is next 2022-04-20 13:03:25 +01:00
3339225fe8 Release 4.2.10 2022-04-20 13:03:25 +01:00
df33e179e5 Player: fixed chat newlines denial-of-service vulnerability
irresponsibly reported in #4974

closes #4974
2022-04-20 13:01:05 +01:00
624a7dff16 4.2.10 is next 2022-04-19 16:53:12 +01:00
1d314ad4ce Release 4.2.9 2022-04-19 16:53:11 +01:00
5a98b08ee8 Fixed several crashes on bad data due to inadequate TAG_List type checks 2022-04-19 16:48:18 +01:00
ded7e24f67 Merge branch 'stable' into next-minor 2022-04-19 15:27:55 +01:00
e73bb07da0 Updated locale data 2022-04-19 15:27:00 +01:00
d9d02d526a Updated PHP versions for GitHub Actions 2022-04-19 15:06:00 +01:00
f272986903 4.2.9 is next 2022-04-17 20:45:32 +01:00
988da8eaab Release 4.2.8 2022-04-17 20:45:32 +01:00
ea7f706aed RakLib 0.14.4 2022-04-17 20:41:18 +01:00
52e3f1e269 ZippedResourcePack: ensure non-empty file
ZipArchive raises deprecation errors on empty files for some reason
2022-04-17 20:32:23 +01:00
4c9d2a989e cs again 2022-04-17 19:32:30 +01:00
022db5cbe3 NetworkSession: compare usernames case-insensitively
the current data management system uses case-insensitive names, so we can't allow different players with the same name in different cases to join, or we will have duplication exploits.

This typically only applies to offline servers, since Xbox Live doesn't permit reuse of a username, same case or otherwise.

closes #4965
2022-04-17 19:28:10 +01:00
3bbf558883 4.2.8 is next 2022-04-15 16:36:47 +01:00
1d68d9f71a Release 4.2.7 2022-04-15 16:36:42 +01:00
f2e8824242 fix CS 2022-04-15 16:24:15 +01:00
a0e47b5a64 phpstan 1.5.6 2022-04-15 16:21:05 +01:00
f7465f55e7 Update transient composer dependencies 2022-04-15 16:17:33 +01:00
453bf6d73b fix build 2022-04-10 21:37:10 +01:00
3353a00641 List command aliases in /help <commandName> 2022-04-10 21:32:46 +01:00
e388cb1643 Merge branch 'stable' into next-minor 2022-04-10 21:23:04 +01:00
741182c55f InGamePacketHandler: skip processing movement if the player's position
was changed during processing other properties (#4913)

fixes #4952
2022-04-10 21:02:45 +01:00
2efce35331 PluginManager: fixed updating disabled scheduler when plugins cause other plugins to be disabled from within scheduled tasks 2022-04-10 21:00:16 +01:00
d1dfbd95e2 Entity: workaround teleport client bug #4394 by despawning and respawning the entity (#4870)
this is a sucky solution but it works well enough for this scenario.

From my research it appears that while the client-side MovementInterpolator is active on the client and hasn't yet reached its target, any teleport sent during the lerp will get overridden by the lerp.
This appears to last 3-4 ticks (about 150-200 ms) which explains why this can be reproduced by stopping movement just before the ender pearl lands (human reaction times would make the reproduction unreliable otherwise).

Things to note:
- All entities are affected by this bug.
- MovePlayerPacket appears not to have the problem, but we can't use it because it doesn't work for non-players.
- MoveActorAbsolute and MoveActorDelta are both handled by the same code and will have the same lerping bug.

This is the cleanest solution I could come up with.
2022-04-08 23:12:01 +01:00
4fc712119f FlowerPot: allow removing the planted item
closes #4896
closes #4898

this is not completely consistent with client-side predictions due to a bug in the client, which I believe is a problem limited to the legacy transaction system.
2022-04-08 23:07:08 +01:00
1aee5b1ed8 Bump ramsey/uuid from 4.2.3 to 4.3.1 (#4929)
Bumps [ramsey/uuid](https://github.com/ramsey/uuid) from 4.2.3 to 4.3.1.
- [Release notes](https://github.com/ramsey/uuid/releases)
- [Changelog](https://github.com/ramsey/uuid/blob/5.x/CHANGELOG.md)
- [Commits](https://github.com/ramsey/uuid/compare/4.2.3...4.3.1)

---
updated-dependencies:
- dependency-name: ramsey/uuid
  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>
Co-authored-by: Dylan T <dktapps@pmmp.io>
2022-04-08 22:22:51 +01:00
fefd3e6b29 Document how to passthru arguments to aliased commands 2022-04-07 23:36:04 +01:00
9b43be9d9c Improved documentation of pocketmine.yml aliases 2022-04-07 23:10:18 +01:00
ea677154cb InGamePacketHandler: rely exclusively on prediction mismatch checking to re-sync slots during bad transactions
fixes #4894
closes #4926
relying on the core code to guess which slots should be synced is unreliable at best.
2022-04-04 21:58:19 +01:00
7f2802e75f Bump phpstan/phpstan from 1.5.3 to 1.5.4 (#4942)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.5.3 to 1.5.4.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.6.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.5.3...1.5.4)

---
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>
2022-04-04 14:03:07 +01:00
f924208881 Update PlayerPreLoginEvent documentation (#4940)
Removed outdated documentation that was very misleading. Replaced with better documentation that accurately describes how to cancel the event.
2022-04-03 17:59:07 +01:00
6bea2961d9 Bump phpunit/phpunit from 9.5.19 to 9.5.20 (#4939)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.19 to 9.5.20.
- [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.19...9.5.20)

---
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>
2022-04-01 23:52:55 +01:00
ac3a6033b9 PluginManager: account for possible abstract main classes
idk why anyone does this, but it shouldn't cause a core crash ...
2022-04-01 23:42:37 +01:00
d7e6b01216 4.2.7 is next 2022-04-01 23:01:15 +01:00
26aee7ff73 Release 4.2.6 2022-04-01 23:01:15 +01:00
319c8fe32c Updated BedrockProtocol 2022-04-01 22:59:43 +01:00
ce121ccea9 Bump phpstan/phpstan from 1.5.2 to 1.5.3 (#4935)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.5.2 to 1.5.3.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.6.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.5.2...1.5.3)

---
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>
2022-03-31 13:37:32 +01:00
7f1a4185b5 Bump phpstan/phpstan from 1.5.1 to 1.5.2 (#4933)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.5.1 to 1.5.2.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.6.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.5.1...1.5.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>
2022-03-29 12:41:54 +01:00
7d1464f0a1 Merge branch 'stable' into next-minor 2022-03-28 17:18:54 +01:00
8cc7fb9dd9 fix CS 2022-03-28 17:16:35 +01:00
194cb1fb84 phpstan 1.5.1 2022-03-28 17:12:00 +01:00
8ea106c091 4.2.6 is next 2022-03-28 16:35:10 +01:00
a6cb3313b0 Release 4.2.5 2022-03-28 16:34:57 +01:00
c6374b79b0 Improve crashdump ergonomics
hopefully this will result in less people making useless pastes that don't contain backtraces ...
2022-03-24 19:46:11 +00:00
f25beab6cb Use constants for compound meta values 2022-03-23 15:58:27 +00:00
901449b0b1 Player: simplify PlayerItemHeldEvent calling on content change
the second parameter to this callback is the OLD slots, not the changed slots. This means that ALL slots are included, including empty and unchanged slots.
2022-03-23 13:47:01 +00:00
a9f2766a8b Merge branch 'stable' into next-minor 2022-03-23 13:39:41 +00:00
4e777572c9 fix CS 2022-03-23 13:28:21 +00:00
90a8595a40 Check for mismatched inventory slot predictions in transactions
this should limit the problems caused by mismatched gameplay features that result in ghost items, such as #4896.
2022-03-22 17:42:19 +00:00
bf71eb448a Reduce chaos in inventory classes 2022-03-22 17:19:55 +00:00
2c29d272ad BaseInventory: move setMaxStackSize() to a more sensible place 2022-03-22 17:11:48 +00:00
98aa2b9ff9 Inventory: move removeItem() next to remove()
this should hopefully be more attention grabbing and a bit less misleading, since people will wonder why there are 'remove' and 'removeItem' both.

we really need to rename one of these...
2022-03-22 17:08:30 +00:00
ea33a04d00 Player: ensure that PlayerItemHeldEvent is called when the contents of the held slot changes
in PM3, this was done by implicitly relying on the client to send a MobEquipmentPacket selecting the same hotbar slot when the slot contents changes.
In PM4, we avoid relying on this, and fire the event directly when the listener detects a held slot change.
This ensures that the behaviour remains consistent regardless of what the client starts doing in the future.

closes #4905
2022-03-22 16:53:02 +00:00
9963fcf849 PluginManager: return the created RegisteredListener from registerEvent()
this allows the handler to be later unregistered when used with a plain closure instead of a magic `Listener`.
2022-03-22 16:20:37 +00:00
ab93135b84 Merge branch 'stable' into next-minor 2022-03-22 15:49:58 +00:00
4a94cb85a2 fix CS 2022-03-22 15:44:11 +00:00
b7e6854189 RegistryTrait: enforce name validation rules on everything, not just enums
fixes #4916
2022-03-22 15:41:17 +00:00
2b8a54f8ff Entity: added a guard to prevent __construct() from running multiple times
this typically happens due to flawed logic in child classes in plugins which causes parent::__construct() to get called multiple times.
2022-03-22 15:33:31 +00:00
a5dab0f61e Bump build/php from b6bb711 to 1fae6b8 (#4918)
Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `b6bb711` to `1fae6b8`.
- [Release notes](https://github.com/pmmp/php-build-scripts/releases)
- [Commits](b6bb7114b3...1fae6b8d4a)

---
updated-dependencies:
- dependency-name: build/php
  dependency-type: direct:production
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-21 21:05:13 +00:00
824f1f24ff Build release Docker images on GitHub Actions (#4891)
this has been tested on a fork using GitHub Container Registry, but we'll have to do an actual release to test if it will work with Docker Hub. However, I don't expect there to be any problems.

This is one of two remaining jobs to be migrated off Jenkins.
2022-03-20 01:03:27 +00:00
f4f5c3128f EnumTrait: fixed regex not accepting member names with 1 character
this also fixes EnumTrait accepting invalid non-numeric characters for the first character, such as @.
2022-03-19 16:47:36 +00:00
fdd42fd15f 4.2.5 is next 2022-03-18 20:20:47 +00:00
05a5e5eac1 Release 4.2.4 2022-03-18 20:20:32 +00:00
c8e1cfcbee TypeConverter: account for possible out-of-range meta in items 2022-03-18 19:34:51 +00:00
869dda9a45 Bump phpunit/phpunit from 9.5.18 to 9.5.19 (#4900)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.18 to 9.5.19.
- [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.18...9.5.19)

---
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>
2022-03-15 19:39:49 +00:00
e2c647ef91 Bump phpstan/phpstan from 1.4.9 to 1.4.10 (#4899)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.4.9 to 1.4.10.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.5.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.4.9...1.4.10)

---
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>
2022-03-15 12:04:50 +00:00
05fdd94754 fix CS 2022-03-12 00:57:32 +00:00
4a599b58ff Bump phpstan/phpstan from 1.4.8 to 1.4.9 (#4893)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.4.8 to 1.4.9.
- [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.4.8...1.4.9)

---
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>
2022-03-10 20:18:53 +00:00
05792826bc EntityFactory: use import aliases to improve readability slightly 2022-03-09 23:39:45 +00:00
fbf7ad4295 4.2.4 is next 2022-03-09 22:52:42 +00:00
6c1c0c867e Release 4.2.3 2022-03-09 22:52:38 +00:00
5c0eb92d81 Entity: harden setRotation(), setMotion(), addMotion() and teleport() against NaN/INF values 2022-03-09 22:36:44 +00:00
1e88412a8f Entity: harden constructor against dodgy locations containing NaN/INF components 2022-03-09 22:31:24 +00:00
f97ce6afef Harden APIs which accept Vector3/Position/Location in event namespace 2022-03-09 22:22:37 +00:00
879476d8e0 ItemFrame: added missing bounds check for setItemDropChance() 2022-03-09 22:20:04 +00:00
6d584cf008 EntityDataHelper: prevent INF/NaN being loaded from disk to come back and break things after the fact 2022-03-09 22:16:07 +00:00
8efa299c65 phpstan 1.4.8 2022-03-09 18:30:54 +00:00
b6e7ad187a Updated composer dependencies 2022-03-09 18:07:28 +00:00
5ef73ca9aa Entity: Remove outdated comment 2022-03-09 18:02:57 +00:00
c50518a4ca build/generate-registry-annotations: specify type that PHPStan can't infer 2022-03-09 17:53:10 +00:00
4c98780bdb Fixed PHPStan iterable types for LevelDBIterator 2022-03-09 17:28:59 +00:00
856fd2a33b fix PHPStan failures 2022-03-09 17:26:05 +00:00
581bbfe255 DiskResourceProvider: add @var for type that PHPStan can't infer 2022-03-09 17:18:40 +00:00
b4e1edaa64 CommandSender: provide more detailed types for getScreenLineHeight() and setScreenLineHeight() 2022-03-09 17:17:51 +00:00
025f6407e2 Fire: fixed sticking to transparent top-sides of blocks
closes #4879
closes #2819
2022-03-09 16:59:26 +00:00
10c0d83fa5 ShulkerBox: Allow opening unless the lid is obstructed by a solid block (#4885)
fixes #4884
2022-03-09 16:37:23 +00:00
9a6ec14cbf Bump phpunit/phpunit from 9.5.16 to 9.5.18 (#4892)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.16 to 9.5.18.
- [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.16...9.5.18)

---
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>
2022-03-09 16:32:47 +00:00
f77fec0c3c doxygen -u doxygen/doxygen.conf 2022-03-09 16:28:38 +00:00
5d970cf5bd Fire: do not overwrite blocks during burning unless they were unchanged by onIncinerate()
onIncinerate() by custom blocks might produce custom results which aren't supposed to be burned away (e.g. wood could turn into charred wood, or something of that nature).
closes #4764
2022-03-03 19:19:59 +00:00
58e186440b Bump build/php from d110b60 to b6bb711 (#4871)
Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `d110b60` to `b6bb711`.
- [Release notes](https://github.com/pmmp/php-build-scripts/releases)
- [Commits](d110b60bef...b6bb7114b3)

---
updated-dependencies:
- dependency-name: build/php
  dependency-type: direct:production
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-03 19:02:30 +00:00
6a39caa204 Fixed mycelium spreading onto coarse dirt (#4816) 2022-03-03 19:02:13 +00:00
91f81d4c8e Sweet Berry Bush now absorbs fall damage (#4876) 2022-03-03 19:00:44 +00:00
2b81b53dfa Merge branch 'stable' into next-minor 2022-03-03 18:50:12 +00:00
dfd8c4e4b8 TaskScheduler: throw an exception if attempting to heartbeat a disabled scheduler 2022-03-03 18:49:17 +00:00
c9c50e16ec PluginManager: fixed mishandling of self-disabling plugins in enablePlugins()
this caused a leak of the plugin context, PluginEnableEvent to be called with a disabled plugin, and the plugin's scheduler to get ticked.
2022-03-03 18:48:52 +00:00
eff856d8e5 Stop the server if any world listed by config fails to load or be generated during startup
closes #3162

this does not affect worlds loaded by plugins; they may continue to handle errors as they see fit
2022-03-03 18:40:11 +00:00
90a369f0b6 Humans can now do emotes (#4610)
added the following API methods:
- Human::emote()
2022-03-03 18:19:30 +00:00
ba05b4f024 Whitelist command now kicks non-whitelisted online players (#4774)
closes #3868
2022-03-03 18:15:21 +00:00
3e90c3072a 4.2.3 is next 2022-03-02 23:00:33 +00:00
12946fbe46 Release 4.2.2 2022-03-02 23:00:29 +00:00
70f923714c Merge branch 'stable' into next-minor 2022-03-02 18:43:34 +00:00
7cd394b0fb Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2022-03-02 18:30:38 +00:00
0bca098707 doxygen: remove footer timestamp 2022-03-02 18:30:26 +00:00
d47a7f48bd BrewingStand: avoid duplicate method call (#4874) 2022-03-02 17:32:56 +00:00
f181c60209 Fixed typo (occured => occurred) (#4873)
[ci skip]
2022-03-02 16:28:02 +00:00
784c34f784 Update README.md 2022-03-02 02:29:04 +00:00
03fa5387ac StringToItemParser: recognize cod, raw_cod and cooked_cod 2022-03-01 21:49:36 +00:00
1ea0b8a9df VanillaBlocks generator now reverse-lookups ID constants instead of baking numeric IDs into the code
this makes it easier to spot errors.
similar treatment as VanillaItems received in the previous commit
2022-02-26 16:17:23 +00:00
566e4a4196 VanillaItems generator now reverse-lookups ID constants instead of baking numeric IDs into the code
this makes it easier to spot errors.
there's nothing we can do about the metadata values, but IDs can be quite easily constified.
there might be some weird artifacts where constants are aliased (e.g. appleenchanted) , but this is inarguably better than baking numeric IDs.
2022-02-26 16:10:34 +00:00
61265604fb Bump phpunit/phpunit from 9.5.15 to 9.5.16 (#4863)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.15 to 9.5.16.
- [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/commits/9.5.16)

---
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>
2022-02-24 14:20:19 +00:00
29909e7f44 Bump phpunit/phpunit from 9.5.14 to 9.5.15 (#4859)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.14 to 9.5.15.
- [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.14...9.5.15)

---
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>
2022-02-23 13:13:51 +00:00
3232a83965 InventoryManager: beware possible crash due to invalid items 2022-02-22 16:50:36 +00:00
c816bbdb6e Remove unused import that php-cs-fixer doesn't see 2022-02-22 16:46:23 +00:00
4f25ab10e9 InventoryManager: Do not sync slots the client correctly predicted during using items
closes #4825
2022-02-22 16:46:23 +00:00
f04099c5de Bump phpunit/phpunit from 9.5.13 to 9.5.14 (#4854)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.13 to 9.5.14.
- [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.13...9.5.14)

---
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>
2022-02-21 15:46:51 +00:00
fdb82f5fb8 Bump build/php from 30eed13 to d110b60 (#4852)
Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `30eed13` to `d110b60`.
- [Release notes](https://github.com/pmmp/php-build-scripts/releases)
- [Commits](30eed13faa...d110b60bef)

---
updated-dependencies:
- dependency-name: build/php
  dependency-type: direct:production
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-21 04:14:08 +00:00
75d4c47384 LevelDB: fixed incorrectly writing always newest protocol version in world saves
this made it impossible to tell the difference between PM worlds and bedrock worlds modified post-1.12.
2022-02-20 21:08:31 +00:00
bd4c2b5245 MemoryManager: scrub string keys for dumping
fixes crashes such as https://crash.pmmp.io/view/5986490
this also ensures that the order of elements is maintained when decoded by another software.
2022-02-20 20:54:03 +00:00
d60dba2de0 DumpMemoryCommand: fixed memory dump dir 2022-02-20 20:39:53 +00:00
51a3043dfd PlayerInventory: fixed isHotbarSlot() returning bogus result for 9 2022-02-20 20:29:51 +00:00
7098bcec8c 4.2.2 is next 2022-02-19 20:20:58 +00:00
6d65512531 Release 4.2.1 2022-02-19 20:20:58 +00:00
3ed336fa0e Merge branch 'stable' into next-minor 2022-02-19 20:16:49 +00:00
b26b1cd32f Fixed swimming hitbox glitch
fixes #4815
relates to Sandertv/gophertunnel#88
2022-02-19 20:14:17 +00:00
54db842d16 Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2022-02-19 19:26:39 +00:00
31a0085efb Update setup-php-action to pmmp/setup-php-action@aa636a4fe0 2022-02-19 19:26:30 +00:00
715355e148 Update GitHub Actions to PHP 8.0.16. 2022-02-19 19:20:08 +00:00
55dfacea8d Item: Improve performance of nbtSerialize() (#4831)
Replace hasNamedTag() with $nbt->count() > 0
This avoids a duplicate indirect call to Item::serializeCompoundTag() method call when serializing items with namedtags.
2022-02-16 00:32:12 +00:00
55c744cc00 Added missing changes to the 4.0 changelog (#4820) 2022-02-11 17:39:45 +00:00
7e903fde5b Fixed multiple players being able to sleep in the same bed 2022-02-10 00:57:43 +00:00
d702113fb5 Merge branch 'stable' into next-minor 2022-02-08 22:23:00 +00:00
4f44a067b0 4.2.1 is next 2022-02-08 20:14:19 +00:00
44818e6d14 Release 4.2.0 2022-02-08 20:14:19 +00:00
325131dd30 Protocol changes for 1.18.10 2022-02-08 20:08:15 +00:00
38eeda6e8b Merge branch 'stable' into next-minor 2022-02-07 19:32:07 +00:00
1eb59fb9b5 4.1.1 is next 2022-02-07 19:22:54 +00:00
1c60aa9769 Release 4.1.0 2022-02-07 19:22:53 +00:00
735e4cc3bc Merge branch 'staging/4.1' into next-minor 2022-02-07 17:22:42 +00:00
e9dd9df0a0 Merge remote-tracking branch 'origin/stable' into staging/4.1 2022-02-07 17:22:18 +00:00
032b15efe0 fix BlockFactory consistency check 2022-02-07 15:49:32 +00:00
256826d9c7 Fixed uninitialized color fields of stained glass, stained clay and stained hardened glass 2022-02-07 15:39:54 +00:00
c273b29dec BambooSapling: fixed wrong bit being used for readiness
closes #4809
2022-02-07 15:38:05 +00:00
c19a038d47 LevelDB: Added a whole bunch of constants 2022-02-07 00:54:00 +00:00
95bc013e97 Merge branch 'staging/4.1' into next-minor 2022-02-06 23:56:47 +00:00
7ddd547190 Merge remote-tracking branch 'origin/stable' into staging/4.1 2022-02-06 23:55:52 +00:00
38e34093cf ResourcePackManifest: Stop throwing exceptions on extra properties (#4804)
This code currently throws errors when properties other than the base required ones are added. This can be from resource packs created by "bridge.", where the IDE adds a "generated_with" property to the manifest. This leads to resource packs created by bridge., which are otherwise completely valid, not being loaded.
2022-02-06 23:22:22 +00:00
dd1ebb5915 4.0.10 is next 2022-02-05 16:08:23 +00:00
df1cdbe921 Release 4.0.9 2022-02-05 16:08:10 +00:00
7846ea8acc LevelDB: do not barf on chunk version 8
this covers a wide range from 1.2.13 to 1.8.
2022-02-05 04:18:37 +00:00
1dc0d5f96a WorldManager: do not calculate safe spawn if there are no players in the unloaded world 2022-02-04 19:24:51 +00:00
712ffb3e31 WorldManager: fixed loading the default world's spawn chunk when unloading the default world
yo dawg
I heard you like loading and unloading
so I put some loading inside your unloading
so you can load while you unload
2022-02-04 19:22:37 +00:00
2a4111868c Fixed incorrect doc for EncryptionContext (#4791)
* Fixed incorrect doc for EncryptionContext

* Update src/network/mcpe/encryption/EncryptionContext.php

Co-authored-by: Dylan T <odigiman@gmail.com>
2022-02-02 13:12:33 +00:00
123701ed76 Bump tests/plugins/DevTools from 39510af to e884a4c (#4788)
Bumps [tests/plugins/DevTools](https://github.com/pmmp/DevTools) from `39510af` to `e884a4c`.
- [Release notes](https://github.com/pmmp/DevTools/releases)
- [Commits](39510af5bc...e884a4c234)

---
updated-dependencies:
- dependency-name: tests/plugins/DevTools
  dependency-type: direct:production
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-02 00:05:33 +00:00
28dce8783f Bump build/php from bd329db to 30eed13 (#4787)
Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `bd329db` to `30eed13`.
- [Release notes](https://github.com/pmmp/php-build-scripts/releases)
- [Commits](bd329dba08...30eed13faa)

---
updated-dependencies:
- dependency-name: build/php
  dependency-type: direct:production
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-02 00:05:17 +00:00
3781b62d35 Update dependabot.yml 2022-02-01 23:58:49 +00:00
859f062267 StringToItemParser: fixed *_concrete_powder giving concrete instead of concrete powder 2022-02-01 23:29:47 +00:00
15425d01bc BanEntry: clean up getString() 2022-01-28 21:53:28 +00:00
0642364a44 block: added constants for various integer property bounds 2022-01-28 21:27:30 +00:00
cfdbfa3d58 Liquid: fixed implicit assumption of 0 == air 2022-01-28 21:07:41 +00:00
e9a6c0ba58 Liquid: added missing bounds check for setDecay() 2022-01-28 21:03:44 +00:00
466b018319 Merge branch 'staging/4.1' into next-minor 2022-01-28 20:40:20 +00:00
d16b6fe61e Merge branch 'stable' into staging/4.1 2022-01-28 20:40:07 +00:00
7a75fcda44 Merge branch 'bell-4745' into stable 2022-01-28 20:21:28 +00:00
8d289ab01d Bell: fixed collision boxes
closes #4745
2022-01-28 20:20:41 +00:00
363a9689b4 Prepare 4.2.0+dev 2022-01-28 15:10:19 +00:00
40c7497efe Updated BedrockProtocol to 7.3.1 2022-01-28 15:06:56 +00:00
6ccb1ff114 4.1.0-BETA3 is next 2022-01-27 00:55:09 +00:00
1d2593208a Release 4.1.0-BETA2 2022-01-27 00:55:02 +00:00
a7bdef69e2 Merge remote-tracking branch 'origin/stable' into next-minor 2022-01-27 00:40:34 +00:00
d9ea647925 InGamePacketHandler: add a hack for swimming AABB client bug 2022-01-27 00:28:54 +00:00
6673289c33 Fixed spectator players being able to drop items (#4775)
closes #4765
2022-01-27 00:03:19 +00:00
822af4f7f5 Bump pocketmine/locale-data from 2.4.2 to 2.4.3 (#4773)
Bumps [pocketmine/locale-data](https://github.com/pmmp/Language) from 2.4.2 to 2.4.3.
- [Release notes](https://github.com/pmmp/Language/releases)
- [Commits](https://github.com/pmmp/Language/compare/2.4.2...2.4.3)

---
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>
2022-01-26 00:45:05 +00:00
3155c90396 Fixed incorrect drops for Cobweb (#4759) 2022-01-26 00:25:00 +00:00
1dbfedce4c Bump pocketmine/locale-data from 2.3.33 to 2.4.2 (#4769)
Bumps [pocketmine/locale-data](https://github.com/pmmp/Language) from 2.3.33 to 2.4.2.
- [Release notes](https://github.com/pmmp/Language/releases)
- [Commits](https://github.com/pmmp/Language/compare/2.3.33...2.4.2)

---
updated-dependencies:
- dependency-name: pocketmine/locale-data
  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>
2022-01-26 00:19:02 +00:00
3ab5b5a79d 4.0.9 is next 2022-01-25 23:33:24 +00:00
8a4bc72b34 Release 4.0.8 2022-01-25 23:33:20 +00:00
6cbc14f2b2 World: fixed block update bug introduced by 3faeb5a556 2022-01-25 21:53:15 +00:00
75d0fc4749 BlockFactory: Make stone slab registration a little less unpleasant to read 2022-01-25 19:23:04 +00:00
ea161af4e5 Added FurnaceType->getCookSound() 2022-01-25 19:01:49 +00:00
0bf5f97fe9 Implement furnace sound (#4755)
closes #4363 

The following classes have been added:
- BlastFurnaceSound
- SmokerSound
- FurnaceSound
2022-01-25 18:52:31 +00:00
b9f1bcf0e4 Implement PlayerViewDistanceChangeEvent (#4749)
closes #4550
2022-01-25 18:00:26 +00:00
32b07e0940 World: avoid repeated getInstance() calls in hot paths 2022-01-24 21:08:12 +00:00
99f087e5e1 Bump phpunit/phpunit from 9.5.12 to 9.5.13 (#4767)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.12 to 9.5.13.
- [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.12...9.5.13)

---
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>
2022-01-24 14:21:49 +00:00
22a4117109 Merge remote-tracking branch 'origin/stable' into next-minor 2022-01-23 15:47:13 +00:00
aaf7a88de7 HayBale: fixed fall damage 2022-01-22 21:26:44 +00:00
e0da99a973 feat: Implement Brewing (#4413)
The following API constants have been added:
- tile\BrewingStand::BREW_TIME_TICKS
The following public API methods have been added:
- utils\BrewingStandSlot->getSlotNumber() : int
- CraftingManager->getPotionTypeRecipes() : array<string, array<string, PotionTypeRecipe>>
- CraftingManager->getPotionContainerChangeRecipes() : array<int, array<string, PotionContainerChangeRecipe>>
- CraftingManager->registerPotionTypeRecipe(PotionTypeRecipe $recipe) : void
- CraftingManager->registerPotionContainerChangeRecipe(PotionContainerChangeRecipe $recipe) : void
The following classes have been added:
- BrewingRecipe
- PotionTypeRecipe
- PotionContainerChangeRecipe
- BrewItemEvent
- BrewingFuelUseEvent
- PotionFinishBrewingSound
2022-01-22 16:54:58 +00:00
b2630a0920 Merge remote-tracking branch 'origin/stable' into next-minor 2022-01-22 14:46:55 +00:00
67a0ae0246 Fixed incorrect drops for ender chest (#4751) 2022-01-22 14:01:56 +00:00
5ae20459dd 4.1.0-BETA2 is next 2022-01-22 02:23:09 +00:00
587da478a6 Release 4.1.0-BETA1 2022-01-22 02:23:06 +00:00
419bb9eba6 Player: fixed parameter name inconsistency 2022-01-22 01:33:31 +00:00
82f1c2766c Merge branch 'stable' into next-minor 2022-01-22 01:00:40 +00:00
b3fec3d86f Merge branch 'legacy/pm3' into stable 2022-01-22 00:54:46 +00:00
60ef2db892 3.27.1 is next 2022-01-22 00:36:48 +00:00
e21446e583 Release 3.27.0 2022-01-22 00:36:47 +00:00
7bf0bc2ca7 Merge commit 'b33a75a6d121bdbdd23765795a375f1ec1a5f7c9' into stable 2022-01-22 00:32:49 +00:00
e5a9123522 PocketMine.php: require ext-crypto 2022-01-22 00:30:05 +00:00
09201ac14b Fixed chunk sending
we can't cache the encapsulated stuff anymore because of encryption.
2022-01-22 00:24:31 +00:00
0697c7d316 Clean up according to newer php-cs-fixer 2022-01-21 23:45:49 +00:00
1eae133118 fixed PHPStan build 2022-01-21 23:39:37 +00:00
d28be4eaf2 Quick and dirty backport of encryption, preserving BC 2022-01-21 23:05:21 +00:00
b33a75a6d1 Updated transient dependency junk 2022-01-21 20:45:36 +00:00
f9c8c0e34d 4.0.8 is next 2022-01-21 19:39:31 +00:00
58ba4f680f Release 4.0.7 2022-01-21 19:39:30 +00:00
8c5cc67e07 Updated baseline 2022-01-21 19:38:59 +00:00
ab8b24bcd2 Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2022-01-21 19:15:59 +00:00
94c4f58667 Fixed bogus test 2022-01-21 19:13:36 +00:00
c10eda5eae InGamePacketHandler: limit depth of form responses to 2
form responses should only contain string|int|float|bool|null. Arrays or objects appearing in here are likely malicious.
2022-01-21 19:11:58 +00:00
ed312863a7 ignore phpstan bug 2022-01-21 18:43:53 +00:00
387c13beff InGamePacketHandler: fixed invalid JSON being treated as form close 2022-01-21 18:32:58 +00:00
56fe71d939 InGamePacketHandler: fixed crash in form handling when invalid JSON is given 2022-01-21 17:34:13 +00:00
73d8c87b76 Bump phpunit/phpunit from 9.5.11 to 9.5.12 (#4748)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.11 to 9.5.12.
- [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.11...9.5.12)

---
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>
2022-01-21 14:53:03 +00:00
fc53f3721a Avoid direct mutations of Entity->location 2022-01-20 21:49:14 +00:00
345ac75aac Remove PHPStan rules (no longer needed)
this is enforced by php-cs-fixer now instead.
2022-01-20 19:25:34 +00:00
32db27af78 php-cs-fixer: add logical_operators rule 2022-01-20 19:23:33 +00:00
4e956d5d1d Replace remaining disallowed operators 2022-01-20 19:23:19 +00:00
61f8144280 Replace disallowed operators in src/updater/ 2022-01-20 19:21:04 +00:00
ae03c70dfc Replace disallowed operators in src/permission/ 2022-01-20 19:20:51 +00:00
e986a0a4f2 Replace disallowed operators in src/inventory/ 2022-01-20 19:20:32 +00:00
b85fe0e72a Replace disallowed operators in src/scheduler/ 2022-01-20 19:20:03 +00:00
03f47d0a78 Replace disallowed operators in src/plugin/ 2022-01-20 19:19:20 +00:00
3f8f5cd200 Replace disallowed operators in src/crafting/ 2022-01-20 19:18:26 +00:00
aa6bd4438a Replace disallowed operators in src/event/ 2022-01-20 19:17:17 +00:00
22fb02c4e6 Replace disallowed operators in src/item/ 2022-01-20 19:16:50 +00:00
373880e582 Replace disallowed operators in src/player/ 2022-01-20 19:16:00 +00:00
8f525ab399 Replace disallowed operators in src/entity/ 2022-01-20 19:14:28 +00:00
be1996752a Replace disallowed operators in src/network/ 2022-01-20 19:11:32 +00:00
2bcb629d78 Scrub baseline 2022-01-20 19:08:44 +00:00
aae5962f6a Replace disallowed operators in src/world/ 2022-01-20 19:05:23 +00:00
282b430b1f Replace disallowed operators in src/utils/ 2022-01-20 19:02:26 +00:00
c47dfa1fb8 Replace disallowed operators in build/ 2022-01-20 19:00:54 +00:00
8db137882c Scrub baseline 2022-01-20 16:58:38 +00:00
79d1feff9c Replace disallowed operators in src/block/ 2022-01-20 16:57:09 +00:00
2f32bd877a Replace disallowed operators in src/command/ 2022-01-20 16:49:58 +00:00
22bc3bc3f9 Replace disallowed operators in src/console/ 2022-01-20 16:49:04 +00:00
6846f1e78a Replace disallowed operators in tests/ 2022-01-20 16:48:36 +00:00
4d55935bd8 Replace disallowed operators in tools/ 2022-01-20 16:48:06 +00:00
9c328690f8 Baseline for new rules (for now) 2022-01-20 16:46:41 +00:00
b60dd1e9b4 Ban 'and' and 'or' operators via PHPStan 2022-01-20 16:44:59 +00:00
86bcc49972 Merge branch 'stable' into next-minor 2022-01-20 16:30:49 +00:00
061d851fbd World: do not update entities which have been flagged for despawn
fixes #4718
2022-01-20 16:27:21 +00:00
a67aef0477 PlayerInteractEvent: updated documentation 2022-01-20 16:10:37 +00:00
088745cf3b Implemented ChestPairEvent
closes #2829
2022-01-19 22:08:06 +00:00
8cdfef7861 Added missing sound for creating grass path and farmland
closes #2776
2022-01-19 21:49:05 +00:00
a0bb7059c1 Merge remote-tracking branch 'origin/stable' into next-minor 2022-01-19 19:48:51 +00:00
858024afb7 Remove useless docs noticed by php-cs-fixer 3.5 2022-01-18 00:24:12 +00:00
eaaf00ca2b Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2022-01-18 00:23:39 +00:00
f1723acfd3 UnsafeForeachArrayOfStringRule: use statically analysable function reference
this will ensure that it get automatically updated during refactors.
2022-01-18 00:23:29 +00:00
8da27ea0aa UnsafeForeachArrayOfStringRule: fixed outdated function name 2022-01-18 00:15:44 +00:00
388622d55d Bump pocketmine/locale-data from 2.3.0 to 2.3.33 (#4735)
Bumps [pocketmine/locale-data](https://github.com/pmmp/Language) from 2.3.0 to 2.3.33.
- [Release notes](https://github.com/pmmp/Language/releases)
- [Commits](https://github.com/pmmp/Language/compare/2.3.0...2.3.33)

---
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>
2022-01-17 20:46:38 +00:00
bac6a2a1eb cs: enable fully_qualified_strict_types rule 2022-01-16 22:12:51 +00:00
b9b76eaed2 Server: add notice about obsoletion 2022-01-16 22:11:50 +00:00
9f4fcfafdb Fixed some incorrect block breaking times (#4723) 2022-01-16 20:57:16 +00:00
853ecd2408 InGamePacketHandler: fix function ordering 2022-01-16 16:16:42 +00:00
33421258b6 Silence MovePlayerPacket debug spam 2022-01-16 15:40:18 +00:00
c221484fc3 fixed CS 2022-01-15 22:27:06 +00:00
d9deb571ed Added LecternPlaceBookSound 2022-01-15 22:26:56 +00:00
42d07c74d7 added missing redstone power flag logic 2022-01-15 22:19:47 +00:00
1366c49f1f Implemented Lectern (#4708)
Co-authored-by: Covered123 <58715544+JavierLeon9966@users.noreply.github.com>
Co-authored-by: Dylan K. Taylor <dktapps@pmmp.io>
2022-01-15 21:21:29 +00:00
6679c53e56 BrewingStand: fixed collision box 2022-01-15 16:41:27 +00:00
ee6548aa50 Merge branch 'stable' into next-minor 2022-01-14 00:45:49 +00:00
9d061e86af 4.0.7 is next 2022-01-13 21:46:30 +00:00
f7d25f251e Release 4.0.6 2022-01-13 21:46:30 +00:00
0ccb47fb07 make-release: trap more errors 2022-01-13 21:46:06 +00:00
0973472842 actions: bump to 8.0.14 2022-01-13 21:23:23 +00:00
f126479c37 InGamePacketHandler: check the validity of facing values given by the client 2022-01-13 21:21:15 +00:00
d34f4b28b3 Bump pocketmine/binaryutils from 0.2.3 to 0.2.4 (#4726)
Bumps [pocketmine/binaryutils](https://github.com/pmmp/BinaryUtils) from 0.2.3 to 0.2.4.
- [Release notes](https://github.com/pmmp/BinaryUtils/releases)
- [Commits](https://github.com/pmmp/BinaryUtils/compare/0.2.3...0.2.4)

---
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>
2022-01-13 14:21:32 +00:00
8a65fd273a Updated RakLib to 0.14.3 2022-01-10 22:29:38 +00:00
248cc0ef49 actions: colorize diff output on CS failure 2022-01-10 22:06:07 +00:00
d1726aa20c CS: use fully_qualified_strict_types 2022-01-10 21:41:56 +00:00
58e1e7bd6f Worker: fixed missing AsyncTask import for documentation (#4719)
OCD from f5c9c02e09
2022-01-10 15:12:37 +00:00
a5c0958adf Filesystem::safeFilePutContents() now consistently throws RuntimeException in all expected failure cases
unexpected cases may still throw ErrorException (such as undefined variables) but we don't want to capture those.
2022-01-09 16:33:31 +00:00
fd880d8465 Filesystem: Use ErrorToExceptionHandler to improve error output 2022-01-09 16:26:42 +00:00
a323fb7bb5 Updated pocketmine/errorhandler to 0.6.0 2022-01-09 16:22:59 +00:00
0a5b146189 substr() returns an empty string instead of false in 8.0
an empty string will pass through preg_match_all() without any harmful effects, so we don't need to check for it.
2022-01-07 22:38:00 +00:00
1948b00008 Merge branch 'stable' into next-minor 2022-01-07 21:51:05 +00:00
b4e1871899 Updated PHPStan baseline 2022-01-07 21:49:49 +00:00
78eaa0993d Merge branch 'legacy/pm3' into stable 2022-01-07 21:48:28 +00:00
bee2aba813 Updated PHPStan baseline 2022-01-07 21:46:35 +00:00
af81f80cf3 Updated PHPStan 2022-01-07 21:45:35 +00:00
dbbbc4f9c9 updated phpstan baseline 2022-01-07 21:39:19 +00:00
51f2a78dcf World: break random tick blocks initializing out of constructor
and fix a variable clobber by foreach as a side effect
2022-01-07 21:36:49 +00:00
5128bc02bb Reduce code duplication between BaseCoral and CoralBlock 2022-01-07 21:32:44 +00:00
4f4aa62479 ConcretePowder: call BlockFormEvent when coming in contact with water 2022-01-07 21:19:08 +00:00
c267e7b3c2 Call BlockMeltEvent when frosted ice melts 2022-01-07 21:15:05 +00:00
3faeb5a556 disable-block-ticking directive now supports names a la /give 2022-01-07 21:06:06 +00:00
0bc578b8fc Block: added getTypeId() 2022-01-07 21:03:19 +00:00
661848c5e7 fix more EOF newlines 2022-01-07 20:39:43 +00:00
75fc7a2d1f Merge branch 'stable' into next-minor 2022-01-07 20:16:35 +00:00
43c5d08042 Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2022-01-07 20:15:30 +00:00
6d249026cc Merge branch 'legacy/pm3' into stable 2022-01-07 20:15:15 +00:00
ed2145b6a4 php-cs-fixer: enforce EOF newlines 2022-01-07 20:12:21 +00:00
3e6c157217 Bump phpstan/phpstan from 1.3.1 to 1.3.3 (#4712)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.3.1 to 1.3.3.
- [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.3.1...1.3.3)

---
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>
2022-01-07 15:20:33 +00:00
4f8a0bad25 RegistryTrait: avoid overwriting parameter variables 2022-01-06 23:54:54 +00:00
fb29653ed7 Merge remote-tracking branch 'origin/stable' into next-minor 2022-01-06 22:43:57 +00:00
ffa8cf3ec3 Update to BedrockProtocol 7.3.0 2022-01-06 22:42:16 +00:00
86beeb8255 readme: update badge links
[ci skip]
2022-01-06 17:11:03 +00:00
230a3c9839 Bump phpstan/phpstan from 1.2.0 to 1.3.1 (#4702)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.2.0 to 1.3.1.
- [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.2.0...1.3.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>
2022-01-05 13:49:29 +00:00
35f205b476 4.0.6 is next 2022-01-04 20:51:37 +00:00
e7d17eb4d3 Release 4.0.5 2022-01-04 20:51:36 +00:00
73168a0e39 Merge branch 'legacy/pm3' into stable 2022-01-04 20:49:32 +00:00
e8893dd91f 3.26.6 is next 2022-01-04 20:47:31 +00:00
a4af1609ea Release 3.26.5 2022-01-04 20:47:31 +00:00
8c4b8a9042 CS 2022-01-04 20:44:10 +00:00
6492cac5c1 Merge pull request from GHSA-c6fg-99pr-25m9 2022-01-04 20:40:55 +00:00
958a9dbf0f Merge pull request from GHSA-c6fg-99pr-25m9
* Skin: impose length limits on skinID, geometryName and geometryData fields

* Skin: remove extra newline
2022-01-04 20:40:55 +00:00
3ed57ce49a Merge pull request from GHSA-p62j-hrxm-xcxf
This checks the following things:
- Validity of UTF-8 encoding of title, author, and page content
- Maximum soft and hard lengths of title, author, and page content (soft
  limits may be bypassed by uncancelling PlayerEditBookEvent; hard
  limits may not be bypassed)
- Maximum number of pages. Books with more than 50 pages may still be
  edited, but may not have new pages added.
2022-01-04 20:39:02 +00:00
68f3399cfd Merge pull request from GHSA-p62j-hrxm-xcxf
This checks the following things:
- Validity of UTF-8 encoding of title, author, and page content
- Maximum soft and hard lengths of title, author, and page content (soft
  limits may be bypassed by uncancelling PlayerEditBookEvent; hard
  limits may not be bypassed)
- Maximum number of pages. Books with more than 50 pages may still be
  edited, but may not have new pages added.
2022-01-04 20:39:02 +00:00
aeab19a616 Fixed world spawn point not updating to players (#4699)
closes #4383
2022-01-04 20:31:27 +00:00
8532e9c8e0 Merge remote-tracking branch 'origin/stable' into next-minor 2022-01-04 14:38:15 +00:00
7bee72ef2d Use ~ instead of ^ for constraints on BedrockData and BedrockProtocol
I got these two mixed up - they are exactly the opposite of what I thought. ~ is the stricter operator.
2022-01-04 00:54:09 +00:00
0d595e4324 Update Language dependency 2022-01-04 00:47:04 +00:00
e43e0189df InGamePacketHandler: do not pass bare integers from BookEditPacket directly into event
while these currently happen to be identical, they may not be in the future.

Really this should be represented by an enum.
2022-01-03 20:20:32 +00:00
decd1da2d0 BaseSign: remove dead TODO comment 2022-01-03 19:33:03 +00:00
bcc0f1e733 Fixed desynchronization of hunger when cancelling food-related events (#4691) 2022-01-03 19:11:32 +00:00
e04dfe96af Merge branch 'stable' into next-minor 2022-01-01 17:55:17 +00:00
f62cfe8ae3 4.0.5 is next 2022-01-01 16:50:03 +00:00
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
193a1b3f4e TextFormat: Added MINECOIN_GOLD (§g) color code support (#4670) 2021-12-30 23:53:05 +00:00
62afa2f28d Entity: extract getBlocksIntersected() from getBlocksAroundWithEntityInsideActions() 2021-12-29 23:04:54 +00:00
207f7ec309 Player: avoid unnecessary network updates on repeated calls to setAllowFLight(), setHasBlockCollision() and setAutoJump() 2021-12-29 20:22:16 +00:00
e0a6bc1d4a Lava: remove useless code, closes #4678 2021-12-29 20:13:07 +00:00
5c994e4a24 Player: removed an old hack for setFlying() feedback loop
this is no longer a concern, since we now check if the sent state matches the current state before doing anything, at multiple layers.
2021-12-29 18:41:11 +00:00
d94578a420 Player: remove dead TODO comment 2021-12-29 18:32:53 +00:00
0a0de018a5 InGamePacketHandler: fixed player jump handling 2021-12-29 18:28:22 +00:00
a1d217e12b InGamePacketHandler: fixed missing synchronization of metadata when plugins cancel PlayerToggle*Event 2021-12-29 18:23:05 +00:00
e102339637 InGamePacketHandler: remove dead code from PlayerActionPacket handling 2021-12-29 17:29:19 +00:00
7124d44b92 Player: prevent PlayerToggle(Sprint|Sneak|Fly|Glide|Swim)Events from firing multiple times with the same value
this happens with swimming due to bugs in the client.
2021-12-29 17:24:49 +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
767dfd9947 Merge branch 'stable' into next-minor 2021-12-27 21:55:13 +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
87170ab067 Player: move reach distances to constants 2021-12-27 17:32:04 +00:00
74ac0f5862 Player: move max chat length to constant 2021-12-27 17:06:19 +00:00
f5144d49b1 Merge branch 'stable' into next-minor 2021-12-27 16:52:22 +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
95b6cb21f2 Implement BlockMeltEvent (#4666) 2021-12-27 16:36:59 +00:00
c858c0dc79 Merge remote-tracking branch 'origin/stable' into next-minor 2021-12-27 16:09:20 +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
18e26d975b Fixed swimming and gliding for PlayerAuthInputPacket 2021-12-19 17:31:47 +00:00
d41f933e7b Implement swimming/gliding including AABB recalculation (#4446)
- The following events have been added:
  - PlayerToggleGlideEvent
  - PlayerToggleSwimEvent
- The following API methods have been added:
  - Entity->getSize()
  - Living->isSwimming()
  - Living->setSwimming()
  - Living->isGliding()
  - Living->setSwimming()
  - Player->toggleSwim()
  - Player->toggleGlide()
2021-12-19 17:10:41 +00:00
65dabefa3b Config: improve config loading and parsing error handling
closes #4654
closes #3454
2021-12-19 16:53:29 +00:00
44e8603a6d InGamePacketHandler: fixed borked sneak/sprint after switch to PlayerAuthInputPacket
closes #4659
2021-12-19 00:52:53 +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
16fd5456aa Merge branch 'stable' into next-minor 2021-12-18 00:39:58 +00:00
93caf72f34 KickCommand: Add missing space
closes #4660
closes #4661
2021-12-17 21:09:14 +00:00
089f22d903 Merge branch 'next-minor' of github.com:pmmp/PocketMine-MP into next-minor 2021-12-16 23:39:14 +00:00
fc3a6c6984 Implemented fire spread (#4617) 2021-12-16 23:36:34 +00:00
1ab285f573 PrepareEncryptionTask: remove usage of no-op function 2021-12-16 18:47:50 +00:00
aa56c66a3c ProcessLoginTask: drop usage of no-op method
this is no longer useful since 8.0.
2021-12-16 18:46:34 +00:00
920462bdcc Merge branch 'stable' into next-minor 2021-12-16 01:46:52 +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
482bc462d3 VersionString: Use multiplication instead of bitshift for version IDs
this makes them more recognizable, and also fixes #4630.

This is technically a BC break (behavioural change), but since nothing appears to use this functionality anyway except PM itself, I don't think it matters.
2021-12-15 14:32:50 +00:00
de82424fb2 XpManager: add APIs to prevent owning Human from attracting XP orbs (#4623)
Fixes #4589

The following API methods are added:

- `XpManager->canAttractXpOrbs()`
- `XpManager->setCanAttractXpOrbs()`

Possible future scope: flip this on its head to allow spectator players to attract XP orbs, in case someone wants that for some reason ???

Co-authored-by: Dylan K. Taylor <dktapps@pmmp.io>
2021-12-15 04:40:46 +00:00
d487e43766 InGamePacketHandler: fixed block breaking borked by enabling PlayerAuthInputPacket 2021-12-15 04:01:40 +00:00
57e1509c3a Updated translation APIs 2021-12-15 03:24:13 +00:00
6494375a53 SetupWizard: ask for max view distance 2021-12-15 03:15:04 +00:00
4466166f8b Merge branch 'stable' into next-minor 2021-12-15 03:12:41 +00:00
0da1810aaa Updated composer dependencies 2021-12-15 03:12:26 +00:00
3aa34b59a5 Ask for IPv6 port in setup wizard 2021-12-15 02:22:04 +00:00
c04b00d09d Updated Language to 2.2.0 2021-12-15 02:15:24 +00:00
6e67c7532a Bump default max render radius to 16 chunks
It's 2021, this is making PM look bad to new users (as if we need something else to make PM look bad...)
2021-12-15 01:46:50 +00:00
5f8ebd81d7 it's MAX view distance, not fixed 2021-12-15 01:42:29 +00:00
79b5109953 Move some configuration constants to .. well .. constants 2021-12-15 01:40:29 +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
60938c8c9d Random: fixed nextSignedInt() not actually returning signed ints
closes #4646
closes #4645

Impact assessment by core usage search and poggit suggests that the impact of this change will be close to zero.
However, since it changes behaviour which plugins might be unknowingly relying on, it's going into 4.1 rather than a patch release.
2021-12-15 00:59:10 +00:00
49a8afd126 Merge branch 'next-minor' of github.com:pmmp/PocketMine-MP into next-minor 2021-12-14 23:16:40 +00:00
dbad5dd611 Merge branch 'stable' into next-minor 2021-12-14 23:16:01 +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
a41404bd8a Allow gamemode strings for gamemode property in server.properties (#4638)
closes #2692
2021-12-14 22:56:22 +00:00
4b06fe73f2 Merge branch 'stable' into next-minor 2021-12-14 22:54: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
1c6907c636 Merge branch 'stable' into next-minor 2021-12-14 01:27:21 +00:00
7e6bbcc393 Sync composer deps 2021-12-14 01:27:11 +00:00
7184c02bb6 Merge branch 'next-minor' of github.com:pmmp/PocketMine-MP into next-minor 2021-12-14 00:35:04 +00:00
8a94aa10a4 Merge branch 'stable' into next-minor 2021-12-14 00:34:54 +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
9e75c1463a Implement carving pumpkin (#4637) 2021-12-10 19:45:15 +00:00
a94b88424e Merge branch 'stable' into next-minor 2021-12-10 19:15:57 +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
7ad1afee89 Merge branch 'next-minor' of github.com:pmmp/PocketMine-MP into next-minor 2021-12-09 13:54:06 +00:00
292827a311 Switch to PlayerAuthInputPacket for movement handling
sticking with the non-rewind version for now, for simplicity's sake.

We do want the rewind version at some point for server side knockback, but that's a job for later.

For now, using this packet fixes various problems with slightly-incorrect positions and rotations (e.g. AimTP no longer requires you to jump to get the exact correct rotation; previously it would hit the wrong block at long distances due to errors of a fraction of a degree due to the client not sending its position.

Note that this might cause some performance degradation since the packet is sent every tick. This has yet to be assessed, but the advantages offered are undeniable in any case.
2021-12-09 13:53:53 +00:00
f8ed23cc1e ClearCommand: Add OffHandInventory to $inventories (#4631) 2021-12-09 11:19:33 +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
922ce2e312 Merge branch 'stable' into next-minor 2021-12-08 20:10:23 +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
7a385ddc8b simulate-chunk-selector: remove unused colour allocation 2021-12-08 20:04:03 +00:00
2254f31bec Use Utils::assumeNotFalse() in tools/ 2021-12-08 20:01:19 +00:00
77a74d84e2 CrashDump: phpversion() could return false for a loaded extension
if the extension wrote NULL into the zend_module_entry->version field, phpversion() will return false.
2021-12-08 19:58:28 +00:00
5b868e6d5e Merge branch 'stable' into next-minor 2021-12-08 19:40:25 +00:00
889d048ca3 Make use of Utils::assumeNotFalse() in a bunch of places
I've stuck to only doing this in the places where I'm sure we should never get false back. Other places I'm less sure of (and I found more bugs along the way).
2021-12-08 19:39:04 +00:00
8b73549355 Use JSON_THROW_ON_ERROR for json_encode() and json_decode() 2021-12-08 19:14:07 +00:00
c6466a6da9 Utils: added crutch assumeNotFalse()
this can be used to get PHPStan to shut up about stuff that will never return false in normal contexts.
It's more fine-grained than @phpstan-ignore-line and less hassle than ignoreErrors (and works in PhpStorm too).
In addition, it's easy to search for references.
2021-12-08 18:58:39 +00:00
3d9e19546f EntityShootBowEvent: fixed incorrect field type 2021-12-07 23:35:45 +00:00
45b4fa0e96 Server: improve confusing condition in crashDump() 2021-12-07 23:08:06 +00:00
bf29409a45 Server: fixed PHPStan level 7 error in crashDump() 2021-12-07 23:06:10 +00:00
503c888838 bootstrap: use phpversion() for checking extension presence
fixes 2 PHPStan errors on level 7
2021-12-07 22:50:16 +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
1d14c8cb6b Merge branch 'stable' into next-minor 2021-12-07 00:41:48 +00:00
49d0d01f9f Merge branch 'next-minor' of github.com:pmmp/PocketMine-MP into next-minor 2021-12-07 00:41:17 +00:00
ed4978c31b Added VanillaItems::AIR()
we don't usually add VanillaItems entries for blocks since they already exist in VanillaBlocks, but air has a special use case specifically as an itemstack, so we make an exception for this case.
2021-12-07 00:41:07 +00:00
3728ddbf24 ClearCommand: Cleanup logic & fix vanilla disparities (#4619) 2021-12-06 23:57:07 +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
8f2ca92f02 Implement dropped item merging (#4419)
- The following classes have been added:
  - `ItemMergeEvent`
  - `ItemEntityStackSizeChangeAnimation`
- The following API methods have been added:
  - `ItemEntity->isMergeable()`
  - `ItemEntity->tryMergeInto()`
  - `ItemEntity->setStackSize()`
2021-12-06 22:23:18 +00:00
ce54d268f2 Player: allow controlling client-sided block collisions irrespective of Spectator Mode (#4563)
- Added the following API methods:
  - `Player::hasBlockCollision()`
  - `Player::setHasBlockCollision()`

This enables spectator-like noclip behaviour in other gamemodes (could be useful for builders).
2021-12-06 21:14:22 +00:00
cd850b111d SplashPotion: added getType() (#4613) 2021-12-06 20:29:01 +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
2486dabd8a Fire: extract more unrelated changes from #4617 2021-12-06 01:04:59 +00:00
4d2d0f1d35 changelog: mention removal of Player->getLowerCaseName()
closes #4618
2021-12-06 00:58:21 +00:00
4f3a60ac90 Merge branch 'stable' into next-minor 2021-12-05 16:07:23 +00:00
98c31cf07b Update version number 2021-12-05 16:07:20 +00:00
9256afd439 Call BlockSpreadEvent when spreading fire to incinerated blocks 2021-12-05 16:06:29 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
9d0ac297bb Improved documentation for CancellableTrait 2020-09-10 16:49:20 +08: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
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
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
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
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
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
6920deac2c BlockFactory: regenerated TODO lists 2020-08-15 19:47:38 +01: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
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
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
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
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
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
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
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
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
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
d9c3ec5f91 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
2020-07-11 20:14:42 +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
91b028c208 WorldManager: use ChunkSelector to find stuff to pre-generate 2020-07-10 20:06:26 +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
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
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
1d18662d9b InventoryAction: replace isValid() with validate() which throws TransactionValidationException 2020-07-04 19:38:34 +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
ff00595a48 Remove some more Vector3 mutations 2020-06-27 20:58:02 +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
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
d8a8f5b77a phpstan: ignore a new error caused by 52fd1a8c1d 2020-06-26 13:54:30 +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
a920baa295 resource packs: use JsonMapper for manifest parsing 2020-06-21 18:47:27 +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
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
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
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
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
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
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
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
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
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
a381fc8848 sync composer dependencies 2020-06-15 22:24:44 +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
a39fbe600d Merge branch 'stable'
# Conflicts:
#	phpstan.neon.dist
#	resources/vanilla
2020-06-14 20:03:02 +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
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
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
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
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
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
bbf3f4c476 Merge branch 'next-minor' 2020-05-31 18:40:19 +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
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
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
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
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
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
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
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
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
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
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
65f82f5cdf Task::onRun() and Task::onCancel() now require :void return typehints 2020-05-17 13:58:01 +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
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
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
955b23cc8e Merge branch 'stable'
# Conflicts:
#	resources/vanilla
2020-05-14 00:23:36 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
a95426c373 Merge branch 'stable' 2020-03-18 13:17:38 +00:00
af3f22efd6 Merge commit '310de5a2b211d31cf775d42c38a3e70cf251554c' 2020-03-18 13:09:55 +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
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
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
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
af53c85e6a Merge branch 'next-minor' 2020-03-12 11:48:26 +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
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
12e4e92894 Inventory: Pass old item(s) to inventory change listeners, closes #3323 (#3337) 2020-03-09 13:52:15 +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
2ca10bf84b Merge branch 'next-minor' 2020-02-27 17:08:59 +00:00
78394a336c Merge branch 'stable' 2020-02-25 20:45:39 +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
8a770d837e Merge branch 'stable' 2020-02-24 20:32:43 +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
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
e8bb6b8625 Command: fix output translation regression caused by 4c51f1dda3 2020-02-10 11:42:21 +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
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
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
e1eb9186fe Merge branch 'stable' 2020-02-03 19:57:21 +00:00
092933105a Merge branch 'stable' 2020-02-02 18:14:51 +00:00
afeb9838e4 Merge branch 'stable' 2020-02-02 16:47:19 +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
3df9aaa916 Merge branch 'stable' 2020-02-01 22:19:34 +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
fed03fd535 Merge branch 'submodule-conflict-stable' into submodule-conflict-master 2020-02-01 22:02:44 +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
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
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
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
a604176ac2 Merge branch 'stable' 2020-01-29 16:11:51 +00:00
9a5d3e3d4f Merge branch 'stable' 2020-01-28 14:35:50 +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
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
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
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
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
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
757f5b2fbf Merge branch 'stable' 2020-01-20 18:12:58 +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
01016d7e17 Merge branch 'stable' 2020-01-19 19:59:56 +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
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
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
00869e81ba NetworkBinaryStream: fix server crash on wrong skindata size, close #3276 2020-01-15 19:48:25 +00: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
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
9c8095b0b4 Merge branch 'stable' 2020-01-11 21:51:17 +00:00
96b91af66a Merge branch 'stable' 2020-01-11 21:41:38 +00:00
43601e57bf Merge branch 'stable' 2020-01-09 21:08:16 +00:00
05a450df87 Merge branch 'stable' 2020-01-09 20:16:17 +00:00
715a5c55f4 Merge branch 'stable' 2020-01-09 20:02:22 +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
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
e76cc8eb33 RakLibPacketSender: fixed session leak on server-side disconnect 2020-01-07 11:32:23 +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
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
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
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
f7eea9bebb Merge branch 'stable' 2019-12-13 18:23:01 +00:00
7c15fd6b00 Merge commit '9e1f6a24868823ad06edb6a79d0cb391e637bcb8' 2019-12-13 18:21:57 +00:00
bcc3e20c31 DiskResourceProvider: do not arbitrarily suffix /resources/ 2019-12-13 17:58:53 +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
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
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
0e1321933f ScriptCustomEventPacket: added missing interfaces 2019-12-10 10:41:36 +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
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
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
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
0e3ce7ff39 Merge branch 'next-minor' 2019-12-04 19:59:57 +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
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
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
02c1dabc3d update pocketmine/nbt dependency 2019-12-02 19:24:00 +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
8ee3d4486a update build/php submodule to pmmp/php-build-scripts@7e985c932a 2019-11-29 11:56:36 +00: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
cbef2bbc51 move ThreadException to pocketmine\thread namespace 2019-10-29 12:42:38 +00:00
2e446e4df3 added pocketmine/classloader dependency (extracted from pocketmine/spl) 2019-10-28 12:29:48 +00: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
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
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
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
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
b7665fd906 remove unused imports 2019-10-20 21:26:22 +01:00
6d24760174 Merge branch 'stable' 2019-10-20 21:25:39 +01:00
d456cb2419 Filesystem: added some documentation for createLockFile() and releaseLockFile()
[ci skip]
2019-10-07 10:03:29 +01:00
37763685aa LiquidBucket: add getLiquid() (#3123) 2019-10-04 09:34:14 +01:00
b1de973d96 changelog: world save performance is improved
[ci skip]
2019-10-03 10:51:33 +01:00
464b2116a6 Merge remote-tracking branch 'origin/stable' 2019-10-01 14:41:54 +01:00
735efeaa13 Merge branch 'stable' 2019-09-26 11:30:36 +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
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
9321eef683 Merge branch 'stable' 2019-08-16 16:49:24 +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
200bcb485e Merge branch 'stable' 2019-08-14 18:20:55 +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
2b38098243 Explosion: fix pos refactor mess 2019-08-12 19:05:21 +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
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
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
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
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
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
34ed2980e5 Merge branch 'next-minor' 2019-07-27 14:59:38 +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
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
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
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
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
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
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
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
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
6a93eb8361 Merge branch 'stable' 2019-07-13 18:08:45 +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
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
2cab22fd38 Merge branch 'stable' 2019-07-07 18:10:19 +01:00
f9bfaa0c6a Merge branch 'stable' 2019-07-06 19:41:00 +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
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
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
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
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
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
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
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
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
6db2a3a0fb Merge branch 'next-minor' 2019-06-22 19:49:18 +01:00
0273bd4f53 Merge branch 'next-minor' 2019-06-22 16:05:17 +01:00
ce74549ba3 Use 10 bits for Y coordinate in blockhash
fixes #2553
2019-06-22 15:53:56 +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
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
5d3b4f23a3 Merge branch 'next-minor' 2019-06-16 14:52:37 +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
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
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
9765d78a5d Merge branch 'stable' 2019-06-11 19:19:32 +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
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
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
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
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
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
8e24e5655a Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/entity/Attribute.php
2019-06-03 17:45:25 +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
efe30ffb07 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
2019-05-31 15:31:32 +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
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
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
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
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
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
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
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
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
af07ffb292 Merge branch 'next-minor' 2019-05-02 16:44:50 +01:00
0317b0f22d Merge branch 'next-minor' 2019-05-02 15:07:38 +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
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
4ca40a21ae Merge remote-tracking branch 'origin/stable' 2019-04-26 06:24:07 -04:00
7ec926867f Merge branch 'stable' 2019-04-25 20:54:23 +01:00
7d712d68c4 Merge branch 'stable' 2019-04-25 18:31:22 +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
ffb0ed80a2 resync RakLib dependency 2019-04-22 22:29:54 +01:00
6af84caba6 Merge branch 'stable' 2019-04-21 17:52:57 +01:00
0dac982f16 Merge branch 'stable' 2019-04-21 16:56:53 +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
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
209ae51a67 Merge branch 'stable' 2019-04-15 16:11:49 +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
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
c310a0c50c Merge branch '3.7' 2019-04-06 15:35:58 +01:00
c49ead1a4c Merge branch '3.7' 2019-04-05 18:49:02 +01:00
e07b3f534b Merge branch '3.7' 2019-04-05 09:36:57 +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
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
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
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
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
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
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
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
cc78c9ef18 Merge branch '3.6' 2019-03-18 08:58:59 +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
4c10476b15 Empty merge 2019-03-10 11:43:31 +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
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
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
e31603fc45 Merge branch '3.6' 2019-03-05 11:21:55 +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
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
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
0573838be3 rename submodules 2019-03-03 11:47:00 +00:00
158f81b427 Merge branch '3.6' 2019-03-03 11:15:40 +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
440dd21550 Merge branch '3.6' 2019-02-26 19:59:24 +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
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
0daf695825 Merge branch '3.6' 2019-02-23 10:51:28 +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
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
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
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
9137eb0757 Added Dockerfile 2019-02-18 00:52:52 +08:00
c2735286ab Merge branch '3.6' 2019-02-17 11:35:07 +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
d8a25020f1 Merge branch '3.6' 2019-02-14 16:17:39 +00:00
6424dc9c82 Merge branch '3.6' 2019-02-14 16:04:32 +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
470879c9bf Merge branch '3.6' 2019-02-13 14:53:20 +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
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
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
0c89159cf2 Merge branch '3.6' 2019-02-09 19:22:00 +00:00
1a8a04eab8 Merge branch '3.5' 2019-02-07 17:12:49 +00:00
b7973ef782 Merge branch '3.5' 2019-02-05 16:58:34 +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
c124aae219 Merge branch '3.5' 2019-01-30 13:09:43 +00:00
5c24ac604a Merge branch '3.5' 2019-01-30 11:14:47 +00:00
90f3cb95d8 Merge branch '3.5' 2019-01-29 17:34:12 +00:00
c5f0665853 Merge branch '3.5' 2019-01-29 14:05:00 +00:00
b6ecab1d49 Merge remote-tracking branch 'origin/3.5' 2019-01-29 12:53:38 +00:00
ceddf6f5d8 Merge branch '3.5' 2019-01-28 17:52:11 +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
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
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
939f3efa3b Merge branch '3.5' 2019-01-25 19:44:08 +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
8a0f5cd7c9 Merge branch '3.5' 2019-01-25 13:19:40 +00:00
9d69154da5 Merge branch '3.5' 2019-01-24 18:45: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
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
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
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
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
f9c067db50 Merge branch '3.5' 2019-01-19 17:48:57 +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
1793 changed files with 93587 additions and 80647 deletions

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

View File

@ -20,8 +20,9 @@ assignees: ''
<!-- 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: PE/Win10 (delete as appropriate)
* Game version: Android/iOS/Win10/Xbox/PS4/Switch (delete as appropriate)
### Plugins
<!--- use the `plugins` command and paste the output below -->

View File

@ -9,6 +9,7 @@ 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 -->

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

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

BIN
.github/readme/pocketmine-dark.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
.github/readme/pocketmine.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

16
.github/support.yml vendored
View File

@ -1,16 +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: >
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)
# Whether to close issues marked as support requests
close: true
# Whether to lock issues marked as support requests
lock: false

View File

@ -0,0 +1,97 @@
name: Update Docker Hub images
on:
release:
types:
- published
jobs:
build:
name: Update Docker Hub images
runs-on: ubuntu-20.04
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Clone pmmp/PocketMine-Docker repository
uses: actions/checkout@v3
with:
repository: pmmp/PocketMine-Docker
fetch-depth: 1
- name: Get tag names
id: tag-name
run: |
VERSION=$(echo "${{ github.ref }}" | sed 's{^refs/tags/{{')
echo ::set-output name=TAG_NAME::$VERSION
echo ::set-output name=MAJOR::$(echo $VERSION | cut -d. -f1)
echo ::set-output name=MINOR::$(echo $VERSION | cut -d. -f1-2)
- 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: Get name of Docker repository name
id: docker-repo-name
run: echo ::set-output name=NAME::$(echo "${GITHUB_REPOSITORY,,}")
- name: Build image for tag
uses: docker/build-push-action@v3.1.1
with:
push: true
context: ./pocketmine-mp
tags: |
${{ steps.docker-repo-name.outputs.NAME }}:${{ steps.tag-name.outputs.TAG_NAME }}
# ghcr.io/${{ steps.docker-repo-name.outputs.NAME }}:${{ steps.tag-name.outputs.TAG_NAME }}
build-args: |
PMMP_TAG=${{ steps.tag-name.outputs.TAG_NAME }}
PMMP_REPO=${{ github.repository }}
- name: Build image for major tag
if: steps.channel.outputs.CHANNEL == 'stable'
uses: docker/build-push-action@v3.1.1
with:
push: true
context: ./pocketmine-mp
tags: |
${{ steps.docker-repo-name.outputs.NAME }}:${{ steps.tag-name.outputs.MAJOR }}
# ghcr.io/${{ steps.docker-repo-name.outputs.NAME }}:${{ steps.tag-name.outputs.MAJOR }}
build-args: |
PMMP_TAG=${{ steps.tag-name.outputs.TAG_NAME }}
PMMP_REPO=${{ github.repository }}
- name: Build image for minor tag
if: steps.channel.outputs.CHANNEL == 'stable'
uses: docker/build-push-action@v3.1.1
with:
push: true
context: ./pocketmine-mp
tags: |
${{ steps.docker-repo-name.outputs.NAME }}:${{ steps.tag-name.outputs.MINOR }}
# ghcr.io/${{ steps.docker-repo-name.outputs.NAME }}:${{ steps.tag-name.outputs.MINOR }}
build-args: |
PMMP_TAG=${{ steps.tag-name.outputs.TAG_NAME }}
PMMP_REPO=${{ github.repository }}
- name: Build image for latest tag
if: steps.channel.outputs.CHANNEL == 'stable'
uses: docker/build-push-action@v3.1.1
with:
push: true
context: ./pocketmine-mp
tags: |
${{ steps.docker-repo-name.outputs.NAME }}:latest
# ghcr.io/${{ steps.docker-repo-name.outputs.NAME }}:latest
build-args: |
PMMP_TAG=${{ steps.tag-name.outputs.TAG_NAME }}
PMMP_REPO=${{ github.repository }}

View File

@ -0,0 +1,100 @@
<?php
declare(strict_types=1);
namespace pocketmine;
use pocketmine\utils\Internet;
use function dirname;
use function fwrite;
use function is_array;
use function json_decode;
use function json_encode;
use const JSON_THROW_ON_ERROR;
use const STDERR;
require dirname(__DIR__, 2) . '/vendor/autoload.php';
/**
* @phpstan-return array<string, mixed>
*/
function generateDiscordEmbed(string $version, string $channel, string $description, string $detailsUrl, string $sourceUrl, string $pharDownloadUrl, string $buildLogUrl) : array{
return [
"embeds" => [
[
"title" => "New PocketMine-MP release: $version ($channel)",
"description" => <<<DESCRIPTION
$description
[Details]($detailsUrl) | [Source Code]($sourceUrl) | [Build Log]($buildLogUrl) | [Download]($pharDownloadUrl)
DESCRIPTION,
"url" => $detailsUrl,
"color" => $channel === "stable" ? 0x57ab5a : 0xc69026
]
]
];
}
if(count($argv) !== 5){
fwrite(STDERR, "Required arguments: github repo, version, API token\n");
exit(1);
}
[, $repo, $tagName, $token, $hookURL] = $argv;
$result = Internet::getURL('https://api.github.com/repos/' . $repo . '/releases/tags/' . $tagName, extraHeaders: [
'Authorization: token ' . $token
]);
if($result === null){
fwrite(STDERR, "failed to access GitHub API\n");
return;
}
if($result->getCode() !== 200){
fwrite(STDERR, "Error accessing GitHub API: " . $result->getCode() . "\n");
fwrite(STDERR, $result->getBody() . "\n");
exit(1);
}
$releaseInfoJson = json_decode($result->getBody(), true, JSON_THROW_ON_ERROR);
if(!is_array($releaseInfoJson)){
fwrite(STDERR, "Invalid release JSON returned from GitHub API\n");
exit(1);
}
$buildInfoPath = 'https://github.com/' . $repo . '/releases/download/' . $tagName . '/build_info.json';
$buildInfoResult = Internet::getURL($buildInfoPath, extraHeaders: [
'Authorization: token ' . $token
]);
if($buildInfoResult === null){
fwrite(STDERR, "missing build_info.json\n");
exit(1);
}
if($buildInfoResult->getCode() !== 200){
fwrite(STDERR, "error accessing build_info.json: " . $buildInfoResult->getCode() . "\n");
fwrite(STDERR, $buildInfoResult->getBody() . "\n");
exit(1);
}
$buildInfoJson = json_decode($buildInfoResult->getBody(), true, JSON_THROW_ON_ERROR);
if(!is_array($buildInfoJson)){
fwrite(STDERR, "invalid build_info.json\n");
exit(1);
}
$detailsUrl = $buildInfoJson["details_url"];
$sourceUrl = $buildInfoJson["source_url"];
$pharDownloadUrl = $buildInfoJson["download_url"];
$buildLogUrl = $buildInfoJson["build_log_url"];
$description = $releaseInfoJson["body"];
$discordPayload = generateDiscordEmbed($buildInfoJson["base_version"], $buildInfoJson["channel"], $description, $detailsUrl, $sourceUrl, $pharDownloadUrl, $buildLogUrl);
$response = Internet::postURL(
$hookURL,
json_encode($discordPayload, JSON_THROW_ON_ERROR),
extraHeaders: ['Content-Type: application/json']
);
if($response?->getCode() !== 204){
fwrite(STDERR, "failed to send Discord webhook\n");
fwrite(STDERR, $response?->getBody() ?? "no response body\n");
exit(1);
}

View File

@ -0,0 +1,38 @@
name: Notify Discord webhook of release
on:
release:
types:
- published
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup PHP and tools
uses: shivammathur/setup-php@2.21.2
with:
php-version: 8.0
- name: Restore Composer package cache
uses: actions/cache@v3
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: Get actual tag name
id: tag-name
run: echo ::set-output name=TAG_NAME::$(echo "${{ github.ref }}" | sed 's{^refs/tags/{{')
- name: Run webhook post script
run: php .github/workflows/discord-release-embed.php ${{ github.repository }} ${{ steps.tag-name.outputs.TAG_NAME }} ${{ github.token }} ${{ secrets.DISCORD_RELEASE_WEBHOOK }}

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@v3
with:
submodules: true
- name: Setup PHP
uses: shivammathur/setup-php@2.21.2
with:
php-version: 8.0
- name: Restore Composer package cache
uses: actions/cache@v3
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 }} ${{ github.run_id }} > build_info.json
- name: Upload release artifacts
uses: actions/upload-artifact@v3
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.10.0
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](${{ github.server_url }}/${{ github.repository }}/blob/${{ steps.get-pm-version.outputs.PM_VERSION }}/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.23, 8.1.10]
steps:
- name: Build and prepare PHP cache
uses: pmmp/setup-php-action@82a44d659bf5046612c69f036af3e14dc32e3fa8
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.23, 8.1.10]
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: pmmp/setup-php-action@82a44d659bf5046612c69f036af3e14dc32e3fa8
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@v3
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.23, 8.1.10]
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: pmmp/setup-php-action@82a44d659bf5046612c69f036af3e14dc32e3fa8
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@v3
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.23, 8.1.10]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup PHP
uses: pmmp/setup-php-action@82a44d659bf5046612c69f036af3e14dc32e3fa8
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@v3
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.23, 8.1.10]
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: pmmp/setup-php-action@82a44d659bf5046612c69f036af3e14dc32e3fa8
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@v3
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@v3
- name: Setup PHP and tools
uses: shivammathur/setup-php@2.21.2
with:
php-version: 8.0
tools: php-cs-fixer:3.11
- name: Run PHP-CS-Fixer
run: php-cs-fixer fix --dry-run --diff --ansi

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

@ -0,0 +1,29 @@
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: >
Hi, we only accept **bug reports** on this issue tracker, but this issue looks like a support request.
Instead of creating an issue, try the following:
- Check our [Documentation](https://doc.pmmp.io) to see if you can find answers there
- Ask the community on our [Discord server](https://discord.gg/bmSAZBG) or our [Forums](https://forums.pmmp.io)
[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,50 @@
<?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",
"8.1"
];
$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@v3
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

8
.gitignore vendored
View File

@ -1,5 +1,7 @@
players/*
worlds/*
world_conversion_backups/*
backups/*
plugin_data/*
plugins/*
bin*/*
@ -10,13 +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
@ -47,3 +52,4 @@ Documentation/*
# php-cs-fixer
/.php_cs.cache
/.php-cs-fixer.cache

9
.gitmodules vendored
View File

@ -1,15 +1,6 @@
[submodule "src/pocketmine/lang/locale"]
path = src/pocketmine/lang/locale
url = https://github.com/pmmp/Language.git
[submodule "tests/preprocessor"]
path = build/preprocessor
url = https://github.com/pmmp/preprocessor.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
[submodule "src/pocketmine/resources/vanilla"]
path = src/pocketmine/resources/vanilla
url = https://github.com/pmmp/BedrockData.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} {
}

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

@ -0,0 +1,112 @@
<?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,
'fully_qualified_strict_types' => true,
'global_namespace_import' => [
'import_constants' => true,
'import_functions' => true,
'import_classes' => null,
],
'header_comment' => [
'comment_type' => 'comment',
'header' => <<<BODY
____ _ _ __ __ _ __ __ ____
| _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
| |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
| __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
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/
BODY,
'location' => 'after_open'
],
'indentation_type' => true,
'logical_operators' => true,
'native_function_invocation' => [
'scope' => 'namespaced',
'include' => ['@all'],
],
'new_with_braces' => [
'named_class' => true,
'anonymous_class' => false,
],
'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_blank_line_at_eof' => true,
'single_import_per_statement' => true,
'strict_param' => true,
'unary_operator_spaces' => true,
])
->setFinder($finder)
->setIndent("\t")
->setLineEnding("\n");

View File

@ -1,21 +0,0 @@
import:
source: ./tests/travis/setup-php.yml
script:
- composer install --prefer-dist
- ./vendor/bin/phpstan analyze --no-progress --memory-limit=2G
- ./vendor/bin/phpunit --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit
- composer install --no-dev --prefer-dist
- ./tests/travis.sh -t4
cache:
directories:
- $HOME/.composer/cache/files
- $HOME/.composer/cache/vcs
notifications:
email:
recipients:
- team@pmmp.io
on_success: change
on_failure: always

View File

@ -2,37 +2,38 @@
## Pre-requisites
- A bash shell (git bash is sufficient for Windows)
- [`git`](https://git-scm.com) available in your shell
- PHP 7.3 or newer available in your shell
- PHP 8.0 or newer available in your shell
- [`composer`](https://getcomposer.org) available in your shell
## Custom PHP binaries
Because PocketMine-MP requires several non-standard PHP extensions and configuration, PMMP provides scripts to build custom binaries for running PocketMine-MP, as well as prebuilt binaries.
- [Prebuilt binaries](https://jenkins.pmmp.io/job/PHP-7.3-Aggregate)
- [Prebuilt binaries](https://jenkins.pmmp.io/job/PHP-8.0-Aggregate)
- [Compile scripts](https://github.com/pmmp/php-build-scripts) are provided as a submodule in the path `build/php`
If you use a custom binary, you'll need to replace `composer` usages in this guide with `path/to/your/php path/to/your/composer.phar`.
## Setting up environment
1. `git clone --recursive https://github.com/pmmp/PocketMine-MP.git`
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. `git submodule update --init`
3. Re-run `composer install` to synchronize dependencies.
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.
2. Preprocess the source code by running `build/preprocessor/PreProcessor.php`. Usage instructions are provided in `build/preprocessor/README.md`.
### Note
Preprocessor requires that the `cpp` (c preprocessor) is available in your PATH.
## Building `PocketMine-MP.phar`
Run `build/server-phar.php` using your preferred PHP binary. It'll drop a `PocketMine-MP.phar` into the current working directory.
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/PocketMine.php` using your preferred PHP binary.
Run `src/PocketMine.php` using your preferred PHP binary.

View File

@ -2,125 +2,128 @@
# 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.**
## Choosing a target branch
PocketMine-MP has three primary branches of development.
### Pull requests
- **Create a new branch for each pull request.** Do not create a pull request with commits that exist in another pull request.
| Type of change | `stable` | `next-minor` | `next-major` |
|:---------------|:--------:|:------------:|:------------:|
| Bug fixes | ✔️ | ✔️ | ✔️ |
| Improvements to API docs | ✔️ | ✔️ | ✔️ |
| Cleaning up code | ❌ | ✔️ | ✔️ |
| Changing code formatting or style | ❌ | ✔️ | ✔️ |
| Addition of new core features | ❌ | 🟡 Only if non-disruptive | ✔️ |
| Changing core behaviour (e.g. making something use threads) | ❌ | ✔️ | ✔️ |
| Addition of new configuration options | ❌ | 🟡 Only if optional | ✔️ |
| Addition of new API classes, methods or constants | ❌ | ✔️ | ✔️ |
| Deprecating API classes, methods or constants | ❌ | ✔️ | ✔️ |
| Adding optional parameters to an API method | ❌ | ✔️ | ✔️ |
| Changing API behaviour | ❌ | 🟡 Only if backwards-compatible | ✔️ |
| Removal of API | ❌ | ❌ | ✔️ |
| Backwards-incompatible API change (e.g. renaming a method) | ❌ | ❌ | ✔️ |
### Notes
- **Non-disruptive** means that usage should not be significantly altered by the change.
- Examples of **non-disruptive** changes include adding new commands, or gameplay features like blocks and items.
- Examples of **disruptive** changes include changing the way the server is run, world format changes (since those require downtime for the user to convert their world).
- **API** includes all public and protected classes, functions and constants (unless marked as `@internal`).
- Private members are not part of the API, **unless in a trait**.
## 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 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 *Type: Request For Comments* 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,9 +1,25 @@
<p align="center">
<a href="https://pmmp.io"><img src="http://cdn.pocketmine.net/img/PocketMine-MP-h.png"></img></a><br>
<a href="https://pmmp.io">
<!--[if IE]>
<img src="https://github.com/pmmp/PocketMine-MP/blob/stable/.github/readme/pocketmine.png" alt="The PocketMine-MP logo" title="PocketMine" loading="eager" />
<![endif]-->
<picture>
<source srcset="https://github.com/pmmp/PocketMine-MP/raw/stable/.github/readme/pocketmine-dark.png" media="(prefers-color-scheme: dark)">
<img src="https://github.com/pmmp/PocketMine-MP/raw/stable/.github/readme/pocketmine.png" loading="eager" />
</picture>
</a><br>
<b>A highly customisable, open source server software for Minecraft: Bedrock Edition written in PHP</b>
</p>
[![Build Status](https://travis-ci.com/pmmp/PocketMine-MP.svg?branch=master)](https://travis-ci.com/pmmp/PocketMine-MP)
<p align="center">
<a href="https://github.com/pmmp/PocketMine-MP/actions/workflows/main.yml"><img src="https://github.com/pmmp/PocketMine-MP/workflows/CI/badge.svg" alt="CI" /></a>
<a href="https://github.com/pmmp/PocketMine-MP/releases/latest"><img alt="GitHub release (latest SemVer)" src="https://img.shields.io/github/v/release/pmmp/PocketMine-MP?label=release&sort=semver"></a>
<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>
<a href="https://github.com/pmmp/PocketMine-MP/releases"><img alt="GitHub all releases" src="https://img.shields.io/github/downloads/pmmp/PocketMine-MP/total?label=downloads%40total"></a>
<a href="https://github.com/pmmp/PocketMine-MP/releases/latest"><img alt="GitHub release (latest by SemVer)" src="https://img.shields.io/github/downloads/pmmp/PocketMine-MP/latest/total?sort=semver"></a>
</p>
## Getting started
- [Documentation](http://pmmp.readthedocs.org/)
@ -18,7 +34,9 @@
## For developers
* [Building and running from source](BUILDING.md)
* [Latest API documentation](https://jenkins.pmmp.io/job/PocketMine-MP-doc/doxygen/) - Doxygen documentation generated from development
* [Developer documentation](https://devdoc.pmmp.io) - General documentation for PocketMine-MP plugin developers
* [Latest release API documentation](https://apidoc.pmmp.io) - Doxygen API documentation generated for each release
* [Latest bleeding-edge API documentation](https://apidoc-dev.pmmp.io) - Doxygen API documentation generated weekly from `next-major` branch
* [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)

View File

@ -1,13 +1,5 @@
# Security Policy
## Supported Versions
The following release lines are currently receiving active security updates and bug fixes:
| Version | Supported |
| -------- | ------------------ |
| 3.15.x | :white_check_mark: |
| < 3.15.0 | :x: |
## Reporting a Vulnerability
**DO NOT report vulnerabilities on the GitHub issue tracker.**
@ -15,10 +7,11 @@ GitHub is public and anyone can see the issues you post on the issue tracker, in
**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:
**Contact us** by sending an email to [**security@pmmp.io**](mailto:security@pmmp.io). Include the following information:
- Version of PocketMine-MP
- Detailed description of the vulnerability (e.g. how to exploit it, what the effects are)
- Your GitHub username, if you wish to be credited for reporting the problem in the security advisory
Please note that we can't guarantee a reply to every email.

View File

@ -0,0 +1,44 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
require dirname(__DIR__) . '/vendor/autoload.php';
if(count($argv) !== 6){
fwrite(STDERR, "required args: <git hash> <tag name> <github repo (owner/name)> <build number> <github actions run ID>\n");
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]",
"build_log_url" => "https://github.com/$argv[3]/actions/runs/$argv[5]",
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR) . "\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,131 @@
<?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 fwrite;
use function implode;
use function is_dir;
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){
fwrite(STDERR, "Provide a path to process\n");
exit(1);
}
/**
* @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 && $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);
}
function processFile(string $file) : void{
$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){
return;
}
$shortClassName = basename($file, ".php");
$className = $matches[1] . "\\" . $shortClassName;
if(!class_exists($className)){
return;
}
$reflect = new \ReflectionClass($className);
$docComment = $reflect->getDocComment();
if($docComment === false || preg_match("/(*ANYCRLF)^\s*\*\s*@generate-registry-docblock$/m", $docComment) !== 1){
return;
}
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";
}
}
require dirname(__DIR__) . '/vendor/autoload.php';
if(is_dir($argv[1])){
/** @var string $file */
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($argv[1], \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME)) as $file){
if(substr($file, -4) !== ".php"){
continue;
}
processFile($file);
}
}else{
processFile($argv[1]);
}

View File

@ -17,75 +17,129 @@
* @link http://www.pocketmine.net/
*
*
*/
*/
declare(strict_types=1);
namespace pocketmine\build\make_release;
use pocketmine\utils\Utils;
use pocketmine\utils\VersionString;
use function defined;
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 pocketmine\BASE_VERSION;
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) : void{
$versionInfo = file_get_contents($versionInfoPath);
function replaceVersion(string $versionInfoPath, string $newVersion, bool $isDev, string $channel) : void{
$versionInfo = Utils::assumeNotFalse(file_get_contents($versionInfoPath), $versionInfoPath . " should always exist");
$versionInfo = preg_replace(
$pattern = '/^const BASE_VERSION = "(\d+)\.(\d+)\.(\d+)(?:-(.*))?";$/m',
'const BASE_VERSION = "' . $newVersion . '";',
$pattern = '/^([\t ]*public )?const BASE_VERSION = "(\d+)\.(\d+)\.(\d+)(?:-(.*))?";$/m',
'$1const BASE_VERSION = "' . $newVersion . '";',
$versionInfo
);
$versionInfo = preg_replace(
'/^const IS_DEVELOPMENT_BUILD = (?:true|false);$/m',
'const IS_DEVELOPMENT_BUILD = ' . ($isDev ? 'true' : 'false') . ';',
'/^([\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);
}
/**
* @param string[] $argv
* @phpstan-param list<string> $argv
*/
function main(array $argv) : void{
if(isset($argv[1])){
$currentVer = new VersionString($argv[1]);
}else{
$currentVer = new VersionString(BASE_VERSION);
}
$nextVer = new VersionString(sprintf(
"%u.%u.%u",
$currentVer->getMajor(),
$currentVer->getMinor(),
$currentVer->getPatch() + 1
));
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"
];
$versionInfoPath = dirname(__DIR__) . '/src/pocketmine/VersionInfo.php';
replaceVersion($versionInfoPath, $currentVer->getBaseVersion(), false);
function systemWrapper(string $command, string $errorMessage) : void{
system($command, $result);
if($result !== 0){
echo "error: $errorMessage; aborting\n";
exit(1);
}
}
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 commit -m "Release ' . $currentVer->getBaseVersion() . '" --include "' . $versionInfoPath . '"');
system('git tag ' . $currentVer->getBaseVersion());
replaceVersion($versionInfoPath, $nextVer->getBaseVersion(), true);
system('git add "' . $versionInfoPath . '"');
system('git commit -m "' . $nextVer->getBaseVersion() . ' is next" --include "' . $versionInfoPath . '"');
systemWrapper('git add "' . dirname(__DIR__) . '/changelogs"', "failed to stage changelog changes");
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);
systemWrapper('git commit -m "Release ' . $currentVer->getBaseVersion() . '" --include "' . $versionInfoPath . '"', "failed to create release commit");
systemWrapper('git tag ' . $currentVer->getBaseVersion(), "failed to create release tag");
replaceVersion($versionInfoPath, $nextVer->getBaseVersion(), true, $channel);
systemWrapper('git add "' . $versionInfoPath . '"', "failed to stage changes for post-release commit");
systemWrapper('git commit -m "' . $nextVer->getBaseVersion() . ' is next" --include "' . $versionInfoPath . '"', "failed to create post-release commit");
echo "pushing changes in 5 seconds\n";
sleep(5);
system('git push origin HEAD ' . $currentVer->getBaseVersion());
systemWrapper('git push origin HEAD ' . $currentVer->getBaseVersion(), "failed to push changes to remote");
}
if(!defined('pocketmine\_PHPSTAN_ANALYSIS')){
main($argv);
}
main();

View File

@ -17,7 +17,7 @@
* @link http://www.pocketmine.net/
*
*
*/
*/
declare(strict_types=1);
@ -26,7 +26,6 @@ namespace pocketmine\build\server_phar;
use pocketmine\utils\Git;
use function array_map;
use function count;
use function defined;
use function dirname;
use function file_exists;
use function getcwd;
@ -41,6 +40,7 @@ use function rtrim;
use function sprintf;
use function str_replace;
use function unlink;
use const PHP_EOL;
require dirname(__DIR__) . '/vendor/autoload.php';
@ -129,23 +129,34 @@ function main() : void{
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:"]);
$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
'git' => $gitHash,
'build' => $build
],
<<<'STUB'
<?php
@ -158,7 +169,7 @@ if(!is_readable($tmpDir) or !is_writable($tmpDir)){
exit(1);
}
require("phar://" . __FILE__ . "/src/pocketmine/PocketMine.php");
require("phar://" . __FILE__ . "/src/PocketMine.php");
__HALT_COMPILER();
STUB
,
@ -169,6 +180,4 @@ STUB
}
}
if(!defined('pocketmine\_PHPSTAN_ANALYSIS')){
main();
}
main();

View File

@ -32,3 +32,23 @@ Plugin developers should **only** update their required API to this version if y
- 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`.

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.

32
changelogs/3.26.md Normal file
View File

@ -0,0 +1,32 @@
**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.
# 3.26.5
- Fixed several denial-of-service attack vectors related to writable book text length and encoding.
- Fixed several denial-of-service attack vectors related to skin data field lengths.

15
changelogs/3.27.md Normal file
View File

@ -0,0 +1,15 @@
**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.27.0
- Introduced support for protocol encryption.
- Encryption is enabled by default.
- Fixes login replay attacks.
- This may cause some performance degradation.
- Encryption can be disabled by setting `network.enable-encryption` to `false` in `pocketmine.yml`. DO NOT do this unless you understand the risks involved.
- An obsoletion notice has been added to the console during server startup.

1767
changelogs/4.0-beta.md Normal file

File diff suppressed because it is too large Load Diff

1651
changelogs/4.0.md Normal file

File diff suppressed because it is too large Load Diff

166
changelogs/4.1-beta.md Normal file
View File

@ -0,0 +1,166 @@
**For Minecraft: Bedrock Edition 1.18.0**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 4.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.
# 4.1.0-BETA1
Released 22nd January 2022.
## General
- Game mode names (e.g. `survival`, `creative`) may now be used for the `gamemode` property in `server.properties`.
- Increased default maximum render distance to 16 chunks. Players with a render distance smaller than this will notice no difference.
- The setup wizard now prompts for a maximum render distance value.
- The setup wizard now prompts for an IPv6 port selection. Previously it would always use 19133.
- `chunk-ticking.disable-block-ticking` now accepts block names like those used in the `/give` command.
- The `/clear` command now behaves more like vanilla:
- The order of inventories is now the same as Bedrock.
- The cursor and offhand inventories are now cleared if necessary.
## Technical
- `PlayerAuthInputPacket` is now used instead of `MovePlayerPacket` for processing movements. This improves position and rotation accuracy.
- `&&` and `||` are now always used instead of `and` and `or`.
- New version of `pocketmine/errorhandler` is used by this version, adding support for `ErrorToExceptionHandler::trap()`. This enables reliably capturing `E_WARNING` and `E_NOTICE` from functions such as `yaml_parse()` and friends.
- New dependency versions are required by this version:
- `pocketmine/bedrock-protocol` has been updated from 7.1.0 to [7.3.0](https://github.com/pmmp/BedrockProtocol/releases/tag/7.3.0%2Bbedrock-1.18.0).
- `pocketmine/errorhandler` has been updated from 0.3.0 to [0.6.0](https://github.com/pmmp/ErrorHandler/releases/tag/0.6.0).
## API
### Block
- The following classes have been added:
- `Lectern`
- `Pumpkin`
- The following public API methods have been added:
- `Block->getTypeId() : int` - returns an integer which uniquely identifies the block type, ignoring things like facing, colour etc.
- `VanillaBlocks::LECTERN()`
### Entity
- The following classes have been added:
- `animation\ItemEntityStackSizeChangeAnimation`
- The following public API methods have been added:
- `object\ItemEntity->isMergeable(object\ItemEntity $other) : bool`
- `object\ItemEntity->setStackSize(int $size) : void`
- `object\ItemEntity->tryMergeInto(object\ItemEntity $other) : bool`
- `ExperienceManager->canAttractXpOrbs() : bool`
- `ExperienceManager->setCanAttractXpOrbs(bool $v = true) : void`
- `Entity->getSize() : EntitySizeInfo`
- `Living->isGliding() : bool`
- `Living->isSwimming() : bool`
- `Living->setGliding(bool $value = true) : void`
- `Living->setSwimming(bool $value = true) : void`
- The following protected API methods have been added:
- `Entity->getBlocksIntersected(float $inset) : \Generator<int, Block, void, void>`
### Event
- `BlockSpreadEvent` is now called when fire spreads to the positions of blocks it burns away.
- `BlockFormEvent` is now called when concrete powder turns into concrete due to contact with water.
- The following classes have been added:
- `BlockMeltEvent` - called when ice or snow melts
- `ChestPairEvent` - called when two chests try to form a pair
- `PlayerToggleGlideEvent` - called when a player starts or stops gliding
- `PlayerToggleSwimEvent` - called when a player starts or stops swimming
### Item
- The following public API methods have been added:
- `SplashPotion->getType() : PotionType`
- `VanillaItems::AIR()`
- The following API methods have been deprecated:
- `ItemFactory::air()` - use `VanillaItems::AIR()` instead
### Player
- The following public API methods have been added:
- `Player->hasBlockCollision() : bool`
- `Player->setHasBlockCollision(bool $value)` - allows controlling spectator-like no-clip behaviour without changing game mode
- `Player->toggleSwim(bool $swim) : bool` - called by the network system when the client tries to start/stop swimming
- `Player->toggleGlide(bool $glide) : bool` - called by the network system when the client tries to start/stop gliding
### Server
- The following public API constants have been added:
- `Server::DEFAULT_SERVER_NAME`
- `Server::DEFAULT_MAX_PLAYERS`
- `Server::DEFAULT_PORT_IPV4`
- `Server::DEFAULT_PORT_IPV6`
- `Server::DEFAULT_MAX_VIEW_DISTANCE`
### Utils
- Config parsing errors are now always represented by `ConfigLoadException` and include the path to the file in the message.
- Added `TextFormat::MINECOIN_GOLD`, and support for it to the various `TextFormat` methods.
- The following public API methods have been added:
- `Utils::assumeNotFalse()` - static analysis crutch to silence PHPStan errors without using `ignoreErrors` or `@phpstan-ignore-line`, which are both too coarse.
- The following public API properties have been added:
- `Terminal::$COLOR_MINECOIN_GOLD`
- The following classes have been added:
- `ConfigLoadException`
- Fixed `Random->nextSignedInt()` to actually return a signed int. Previously it would return any integer value between 0 and 4,294,957,295.
- Fixed `Random->nextSignedFloat()` to return a float between `-1.0` and `1.0`. Previously it would return any value between `0.0` and `2.0`.
- `VersionString->getNumber()` output is now structured differently to fix overflow issues caused by the old format.
### World
- The following classes have been added:
- `sound\ItemUseOnBlockSound`
- `sound\LecternPlaceBookSound`
## Gameplay
### Blocks
- Fire now spreads.
- Implemented lectern blocks.
- Added missing sounds for hoeing grass and dirt.
- Added missing sounds for using a shovel on grass to create grass path.
- Pumpkins can now be carved using shears.
### Items
- Dropped items of the same type now merge with each other.
### Misc
- Implemented player swimming.
# 4.1.0-BETA2
Released 27th January 2022.
## API
### Block
- The following API methods have been added:
- `utils\BrewingStandSlot->getSlotNumber() : int`
- `utils\FurnaceType->getCookSound() : Sound`
- The following API constants have been added:
- `tile\BrewingStand::BREW_TIME_TICKS`
### Crafting
- The following API methods have been added:
- `CraftingManager->getPotionContainerChangeRecipes() : array<int, array<string, PotionContainerChangeRecipe>>`
- `CraftingManager->getPotionTypeRecipes() : array<string, array<string, PotionTypeRecipe>>`
- `CraftingManager->registerPotionContainerChangeRecipe(PotionContainerChangeRecipe $recipe) : void`
- `CraftingManager->registerPotionTypeRecipe(PotionTypeRecipe $recipe) : void`
- The following classes have been added:
- `BrewingRecipe`
- `PotionContainerChangeRecipe`
- `PotionTypeRecipe`
### Event
- The following classes have been added:
- `BrewItemEvent` - called when a brewing stand finishes brewing potions; this is called up to 3 times (once for each brewing slot, as needed)
- `BrewingFuelUseEvent` - called when a brewing stand consumes blaze powder
- `PlayerViewDistanceChangeEvent` - called whenever a player alters their render distance or requests one for the first time when connecting
### World
#### Sound
- The following classes have been added:
- `BlastFurnaceSound` - the sound made by a blast furnace during smelting
- `FurnaceSound` - the sound made by a regular furnace during cooking or smelting
- `PotionFinishBrewingSound` - the sound made by a brewing stand when a potion finishes being brewed
- `SmokerSound` - the sound made by a smoker during cooking
## Gameplay
### Blocks
- Brewing stands can now be used for brewing potions.
- The visual appearance of a brewing stand now updates correctly when the contents of its inventory changes (adding/removing potions).
- Added missing sounds for furnace, blast furnace and smoker.
- Fixed ender chest not dropping itself when mined with a Silk Touch pickaxe.
- Cobwebs now drop themselves when mined using shears.
- The correct amount of fall damage is now taken when falling from a height onto hay bales.
- Fixed block updating bug introduced by beta1 which caused crops and other plants to never grow.
### Misc
- Added a workaround for client hitbox size bug after swimming which caused the player to be able to fit into one-block-tall gaps.

142
changelogs/4.1.md Normal file
View File

@ -0,0 +1,142 @@
**For Minecraft: Bedrock Edition 1.18.0**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 4.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.
# 4.1.0
Released 7th February 2022.
## General
- Game mode names (e.g. `survival`, `creative`) may now be used for the `gamemode` property in `server.properties`.
- Increased default maximum render distance to 16 chunks. Players with a render distance smaller than this will notice no difference.
- The setup wizard now prompts for a maximum render distance value.
- The setup wizard now prompts for an IPv6 port selection. Previously it would always use 19133.
- `chunk-ticking.disable-block-ticking` now accepts block names like those used in the `/give` command.
- The `/clear` command now behaves more like vanilla:
- The order of inventories is now the same as Bedrock.
- The cursor and offhand inventories are now cleared if necessary.
## Technical
- `PlayerAuthInputPacket` is now used instead of `MovePlayerPacket` for processing movements. This improves position and rotation accuracy.
- `&&` and `||` are now always used instead of `and` and `or`.
- New version of `pocketmine/errorhandler` is used by this version, adding support for `ErrorToExceptionHandler::trap()`. This enables reliably capturing `E_WARNING` and `E_NOTICE` from functions such as `yaml_parse()` and friends.
- New dependency versions are required by this version:
- `pocketmine/bedrock-protocol` has been updated from 7.1.0 to [7.3.0](https://github.com/pmmp/BedrockProtocol/releases/tag/7.3.0%2Bbedrock-1.18.0).
- `pocketmine/errorhandler` has been updated from 0.3.0 to [0.6.0](https://github.com/pmmp/ErrorHandler/releases/tag/0.6.0).
## API
### Block
- The following classes have been added:
- `Lectern`
- `Pumpkin`
- The following public API methods have been added:
- `Block->getTypeId() : int` - returns an integer which uniquely identifies the block type, ignoring things like facing, colour etc.
- `VanillaBlocks::LECTERN()`
- `utils\BrewingStandSlot->getSlotNumber() : int`
- `utils\FurnaceType->getCookSound() : Sound`
- The following API constants have been added:
- `tile\BrewingStand::BREW_TIME_TICKS`
### Crafting
- The following API methods have been added:
- `CraftingManager->getPotionContainerChangeRecipes() : array<int, array<string, PotionContainerChangeRecipe>>`
- `CraftingManager->getPotionTypeRecipes() : array<string, array<string, PotionTypeRecipe>>`
- `CraftingManager->registerPotionContainerChangeRecipe(PotionContainerChangeRecipe $recipe) : void`
- `CraftingManager->registerPotionTypeRecipe(PotionTypeRecipe $recipe) : void`
- The following classes have been added:
- `BrewingRecipe`
- `PotionContainerChangeRecipe`
- `PotionTypeRecipe`
### Entity
- The following classes have been added:
- `animation\ItemEntityStackSizeChangeAnimation`
- The following public API methods have been added:
- `object\ItemEntity->isMergeable(object\ItemEntity $other) : bool`
- `object\ItemEntity->setStackSize(int $size) : void`
- `object\ItemEntity->tryMergeInto(object\ItemEntity $other) : bool`
- `ExperienceManager->canAttractXpOrbs() : bool`
- `ExperienceManager->setCanAttractXpOrbs(bool $v = true) : void`
- `Entity->getSize() : EntitySizeInfo`
- `Living->isGliding() : bool`
- `Living->isSwimming() : bool`
- `Living->setGliding(bool $value = true) : void`
- `Living->setSwimming(bool $value = true) : void`
- The following protected API methods have been added:
- `Entity->getBlocksIntersected(float $inset) : \Generator<int, Block, void, void>`
### Event
- `BlockSpreadEvent` is now called when fire spreads to the positions of blocks it burns away.
- `BlockFormEvent` is now called when concrete powder turns into concrete due to contact with water.
- The following classes have been added:
- `BlockMeltEvent` - called when ice or snow melts
- `BrewItemEvent` - called when a brewing stand finishes brewing potions; this is called up to 3 times (once for each brewing slot, as needed)
- `BrewingFuelUseEvent` - called when a brewing stand consumes blaze powder
- `ChestPairEvent` - called when two chests try to form a pair
- `PlayerToggleGlideEvent` - called when a player starts or stops gliding
- `PlayerToggleSwimEvent` - called when a player starts or stops swimming
- `PlayerViewDistanceChangeEvent` - called whenever a player alters their render distance or requests one for the first time when connecting
### Item
- The following public API methods have been added:
- `SplashPotion->getType() : PotionType`
- `VanillaItems::AIR()`
- The following API methods have been deprecated:
- `ItemFactory::air()` - use `VanillaItems::AIR()` instead
### Player
- The following public API methods have been added:
- `Player->hasBlockCollision() : bool`
- `Player->setHasBlockCollision(bool $value)` - allows controlling spectator-like no-clip behaviour without changing game mode
- `Player->toggleSwim(bool $swim) : bool` - called by the network system when the client tries to start/stop swimming
- `Player->toggleGlide(bool $glide) : bool` - called by the network system when the client tries to start/stop gliding
### Server
- The following public API constants have been added:
- `Server::DEFAULT_SERVER_NAME`
- `Server::DEFAULT_MAX_PLAYERS`
- `Server::DEFAULT_PORT_IPV4`
- `Server::DEFAULT_PORT_IPV6`
- `Server::DEFAULT_MAX_VIEW_DISTANCE`
### Utils
- Config parsing errors are now always represented by `ConfigLoadException` and include the path to the file in the message.
- Added `TextFormat::MINECOIN_GOLD`, and support for it to the various `TextFormat` methods.
- The following public API methods have been added:
- `Utils::assumeNotFalse()` - static analysis crutch to silence PHPStan errors without using `ignoreErrors` or `@phpstan-ignore-line`, which are both too coarse.
- The following public API properties have been added:
- `Terminal::$COLOR_MINECOIN_GOLD`
- The following classes have been added:
- `ConfigLoadException`
- Fixed `Random->nextSignedInt()` to actually return a signed int. Previously it would return any integer value between 0 and 4,294,957,295.
- Fixed `Random->nextSignedFloat()` to return a float between `-1.0` and `1.0`. Previously it would return any value between `0.0` and `2.0`.
- `VersionString->getNumber()` output is now structured differently to fix overflow issues caused by the old format.
### World
- The following classes have been added:
- `sound\BlastFurnaceSound` - the sound made by a blast furnace during smelting
- `sound\FurnaceSound` - the sound made by a regular furnace during cooking or smelting
- `sound\ItemUseOnBlockSound`
- `sound\LecternPlaceBookSound`
- `sound\PotionFinishBrewingSound` - the sound made by a brewing stand when a potion finishes being brewed
- `sound\SmokerSound` - the sound made by a smoker during cooking
## Gameplay
### Blocks
- Fire now spreads.
- Implemented lectern blocks.
- Added missing sounds for hoeing grass and dirt.
- Added missing sounds for using a shovel on grass to create grass path.
- Pumpkins can now be carved using shears.
- Brewing stands can now be used for brewing potions.
- The visual appearance of a brewing stand now updates correctly when the contents of its inventory changes (adding/removing potions).
- Added missing sounds for furnace, blast furnace and smoker.
- Fixed ender chest not dropping itself when mined with a Silk Touch pickaxe.
- Cobwebs now drop themselves when mined using shears.
- The correct amount of fall damage is now taken when falling from a height onto hay bales.
### Items
- Dropped items of the same type now merge with each other.

121
changelogs/4.2.md Normal file
View File

@ -0,0 +1,121 @@
**For Minecraft: Bedrock Edition 1.18.10**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 4.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.
# 4.2.0
- Added support for Minecraft: Bedrock Edition 1.18.10.
# 4.2.1
Released 19th February 2022.
## General
- Improved performance of `Item::nbtSerialize()` - this will improve performance during world saves.
- Added more missing changes to the 4.0.0 changelog.
## Fixes
- Fixed multiple players being able to sleep in the same bed.
- Fixed hitbox not resetting properly after swimming or gliding.
# 4.2.2
Released 2nd March 2022.
## Fixes
- Fixed crash in `/dumpmemory` due to usage of non-printable string keys in `CraftingManager`. Array contents in memory dumps are now rendered as prettified key-value pairs.
- Fixed output directory for `/dumpmemory`.
- `PlayerInventory->isHotbarSlot()` now correctly returns `false` when given `9`.
- Fixed ghost items left in the inventory when dropping tools while mining.
# 4.2.3
Released 9th March 2022.
## Technical
- Now analysed using PHPStan 1.4.8.
- Now using `pocketmine/bedrock-protocol` [`8.0.1`](https://github.com/pmmp/BedrockProtocol/releases/tag/8.0.1%2Bbedrock-1.18.10).
## Fixes
### Core
- Fixed a memory leak and other bugs related to plugins disabling themselves during `onEnable()`.
### Gameplay
- Sweet berry bushes now absorb fall damage.
- Fixed mycelium spreading onto coarse dirt.
- Fixed blocks placed during `Block->onIncinerate()` getting overwritten.
- Fixed shulker boxes being unopenable when underwater.
- Fixed invisible fire on top of transparent non-flammable blocks.
### API
- Various APIs accepting `Vector3`, `Position` or `Location` no longer accept objects containing `INF` or `NaN` in any component. Previously, this was allowed, but would cause lots of obscure crashes later on.
- `Entity->setRotation()` no longer accepts `INF` or `NaN`.
- Fixed missing bounds check for `ItemFrame->setItemDropChance()`.
# 4.2.4
Released 18th March 2022.
## Fixes
- Fixed a crash when handling out-of-bounds meta values on the network.
# 4.2.5
Released 28th March 2022.
## General
- The layout of the human-readable part of crashdumps has been changed in an effort to improve the useful information density. It is hoped that this change will cause more useful information to be provided when people paste crash traces on Discord, since all the most important information is now at the top of the file.
- Version, git hash, PHP version and OS have been moved to the top of the crashdump.
- Backtrace has been moved above code sample.
- Docker images are now built by GitHub Actions (first live test).
## Technical
- The methods of `Inventory` and `BaseInventory` have been rearranged to improve coherency.
## Fixes
### API
- Enum members of enums created using `EnumTrait` are now able to have single-character names.
- Registry members of registries created using `RegistryTrait` or `CloningRegistryTrait` now have their names checked for invalid characters.
- `Entity::__construct()` now uses a guard variable to prevent it from being called multiple times unintentionally. This is necessary because `Entity::__construct()` has side effects.
- Fixed `PlayerItemHeldEvent` not being called when the content of the held slot was changed (e.g. replacing the held item via inventory menu).
### Gameplay
- Reduced the appearance of ghost items in unsupported gameplay scenarios using client prediction information. This fixes, for example, the appearance of ghost items when right-clicking on a filled flower pot.
# 4.2.6
Released 1st April 2022.
## Fixes
- Fixed buffer length underflow crash in `LoginPacket` handling.
# 4.2.7
Released 15th April 2022.
## General
- Added lots more documentation (in comments) about the `aliases` section in `pocketmine.yml`. You can read about this feature in the `aliases` section of the [updated `pocketmine.yml` template](/resources/pocketmine.yml).
- Improved wording of documentation of `PlayerPreLoginEvent`.
## Fixes
- Fixed core server crash when a plugin causes another plugin to be disabled during a scheduled task.
- Fixed core server crash when loading a plugin with an abstract main class.
- Fixed ghost items in many interaction situations (most notably, using projectiles while looking at an entity or block).
- Implemented a workaround for a client teleport bug which led to player positions not updating properly when using ender pearls.
- Fixed buggy movement when teleporting the player during `PlayerToggleSneakEvent`, `PlayerToggleSprintEvent`, `PlayerToggleSwimEvent` and `PlayerToggleGlideEvent`.
# 4.2.8
Released 17th April 2022.
## Fixes
- Fixed a memory leak in RakLib which could result in a server crash when players stay online for a long time.
- Fixed server crash when attempting to load a corrupted empty resource pack.
- Fixed users with the same name with differerently cased letters being able to duplicate items (userdata is matched by case-insensitive name).
# 4.2.9
Released 19th April 2022.
## Fixes
- Fixed several potential crashes when deserializing item NBT (due to insufficient validation of input data).
# 4.2.10
Released 20th April 2022.
## Fixes
- Fixed performance issue when chat messages received from the client contain many newlines. This security vulnerability was disclosed publicly necessitating a priority fix.

77
changelogs/4.3.md Normal file
View File

@ -0,0 +1,77 @@
**For Minecraft: Bedrock Edition 1.18.30**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 4.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.
# 4.3.0
Released 20th April 2022.
## General
- Added support for Minecraft: Bedrock Edition 1.18.30.
- Removed support for older versions.
# 4.3.1
Released 23rd April 2022.
## Fixes
- Updated BedrockProtocol dependency to fix incorrect command argument types.
- Creative players no longer die in the void.
# 4.3.2
Released 10th May 2022.
## Fixes
- Fixed an assertion failure in certain edge cases during world generation.
- Fixed `Entity::setNameTagVisible()` not immediately showing results to players already online.
## Documentation
- Added more documentation in the template `pocketmine.yml` for the `aliases` config section.
- Removed useless doc comment in `PlayerChangeSkinEvent`.
# 4.3.3
Released 16th May 2022.
## General
- Improved display of parameters in exception stack trace logs.
- Exception stack traces now include names for dynamic named arguments (i.e. arguments that don't match any parameter of the function), if any were given.
- Note: Named arguments which do match parameters are not shown this way, since PHP reduces them to positional arguments for performance reasons.
## Fixes
- Fixed server crash when chunks are unloaded during chunk generation callbacks
- Fixed dead coral fan items placing coral fans in the wrong orientation.
- Fixed max stack size of boat items.
# 4.3.4
Released 22nd May 2022.
## Fixes
- Fixed `difficulty` in `server.properties` having no effect - it's now applied to newly generated worlds.
- Note: this setting still doesn't behave the same way as vanilla due to potential disruption to existing servers.
- Fixed paintings not working in newly generated worlds and some other cases.
- Fixed inventory window switching breaking the inventory UI in some cases (e.g. pressing E while clicking a chest).
- Fixed minecart items incorrectly stacking.
- Fixed incorrect light levels in translucent blocks at the top of the world.
- Fixed teleporting sleeping players causing broken behaviour on the sleeping player's client.
- Fixed `EntityExplodeEvent->setYield()` accepting values outside the range 0-100.
- Fixed `ExplosionPrimeEvent->setForce()` accepting negative values (later resulting in crashes).
## Documentation
- Updated documentation for the following events:
- `CommandEvent`
- `EntityDespawnEvent`
- `EntityExplodeEvent`
- `EntitySpawnEvent`
- `ExplosionPrimeEvent`
- `InventoryTransactionEvent`
- `ItemDespawnEvent`
- `ItemSpawnEvent`
- `PlayerCommandPreprocessEvent`
- `PlayerDropItemEvent`
- `PlayerItemHeldEvent`
- `PlayerKickEvent`
- `PlayerQuitEvent`
- `PlayerTransferEvent`
- `UpdateNotifyEvent`

77
changelogs/4.4-beta.md Normal file
View File

@ -0,0 +1,77 @@
**For Minecraft: Bedrock Edition 1.18.30**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 4.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.
# 4.4.0-BETA1
Released 25th May 2022.
## General
- The server will now shut itself down if any of the following errors occur during startup:
- Any plugin fails to load or enable (plugins loaded by other plugins post-startup are **not** affected by this change) (**PR [#4951](https://github.com/pmmp/PocketMine-MP/pull/4951)**)
- The motivation for this change is to prevent situations where plugins failing to load could result in adverse outcomes, such as a world protection plugin leaving a lobby unprotected from griefing.
- If you encounter this problem, remove the offending plugin(s) or prevent it from loading using `plugin_list.yml`.
- See **PR [#4951](https://github.com/pmmp/PocketMine-MP/pull/4951)** for more detail on this change.
- Any world mentioned in `server.properties` or `pocketmine.yml` fails to load (worlds loaded by plugins are **not** affected by this change)
- Any world mentioned in `server.properties` or `pocketmine.yml` fails to generate (e.g. due to invalid generator settings)
- Enabling the server whitelist while the server is running (e.g. using `/whitelist on`) will now kick any non-whitelisted players currently on the server (**PR [#4774](https://github.com/pmmp/PocketMine-MP/pull/4774)**).
- Help for commands (`/help <name of command>`) now displays a list of aliases of that command.
- A CRITICAL log message is now generated if a plugin disables itself when enabling, in case the plugin doesn't emit any error of its own.
- The `/give` command now shows the alias used to find the given item in the success message, instead of the item ID/meta.
## Fixes
- Block placement has been fixed in many places where it previously didn't work correctly (**PR [#4886](https://github.com/pmmp/PocketMine-MP/pull/4886)**):
- torches on top of slabs, upside-down stairs
- torches on the back face of stairs
- flower pots on top of fences
- the list goes on and on ...
- Fixed backslash escapes not getting properly removed from commands in some cases.
- Fixed aliases defined in the `aliases` section of `pocketmine.yml` not being treated as quote-aware.
## Gameplay
- Plants in flower pots can now be removed by right-clicking on the flower pot.
- Leaves now have a 2% chance of dropping sticks when destroyed by hand (**PR [#5019](https://github.com/pmmp/PocketMine-MP/pull/5019)**).
- Food exhaustion now matches Bedrock 1.18.30 (**PR [#5034](https://github.com/pmmp/PocketMine-MP/pull/5034)**).
- Implemented Stonecutter block (**PR [#4732](https://github.com/pmmp/PocketMine-MP/pull/4732)**).
## API
### Block
- Added `Block->getSupportType(Facing) : SupportType` (**PR [#4886](https://github.com/pmmp/PocketMine-MP/pull/4886)**).
- This is used to determine the kind of support a block face can provide to a block (e.g. a torch) placed on it.
- Added `utils\SupportType` enum (**PR [#4886](https://github.com/pmmp/PocketMine-MP/pull/4886)**).
- `tile\Spawnable->isDirty()` and `tile\Spawnable->setDirty()` are now `@deprecated`.
### Command
- Added `CommandStringHelper::parseQuoteAware()`. This static method contains the code used by `SimpleCommandMap` used to parse quoted command arguments.
### Entity
- Added `Human::emote()` (**PR [#4610](https://github.com/pmmp/PocketMine-MP/pull/4610)**)
### Event
- `PlayerCommandPreprocessEvent` is now `@deprecated`, since its functionality is entirely replaced by other, general-purpose events.
- Use `CommandEvent` to intercept commands.
- Use `PlayerChatEvent` to intercept chat messages.
- To convert a chat message into a command, pass it directly to `Server->dispatchCommand()` with the player as sender.
- Added `PlayerPostChunkSendEvent` (**PR [#4937](https://github.com/pmmp/PocketMine-MP/pull/4937)**).
- Added `PlayerDeathEvent->setKeepXp()` (**PR [#4015](https://github.com/pmmp/PocketMine-MP/pull/4015)**).
- `InventoryCloseEvent` is now called **after** the target window has been removed. This fixes various feedback loops caused by trying to open new windows to a player while there was one still active.
- As a side effect, this now means that `Player->getCurrentWindow()` will return `null` during `InventoryCloseEvent`. Use `InventoryCloseEvent->getInventory()` instead.
### Item
- `StringToItemParser` now recognizes `cod`, `raw_cod` and `cooked_cod` aliases.
### Plugin
- `DisablePluginException` may now be thrown from `Plugin::onEnable()` to make the server gracefully disable the plugin (without crashing) (**PR [#4780](https://github.com/pmmp/PocketMine-MP/pull/4780)**).
- `PluginManager->registerEvent()` now returns the `RegisteredListener` created for the handler, to permit unregistering it later.
## Internals
- Private property declarations now use typed properties (PHP 7.4) and promoted constructor properties (PHP 8.0) wherever possible.
- Protected and public properties remain unchanged, since they can't be changed without breaking subclasses.
- Promoted constructor properties are only used when it's consistently possible to promote most or all properties in a class.
- Simplified and improved legibility of `FormattedCommandAlias`.
- Added unit tests for the quote-aware command parser used by `SimpleCommandMap`.
- Various hardcoded values in `block` package classes have been moved to private constants to improve readability.
- Added various constants used in the `LevelDB` world provider.

97
changelogs/4.4.md Normal file
View File

@ -0,0 +1,97 @@
**For Minecraft: Bedrock Edition 1.18.30**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 4.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.
# 4.4.0
Released 1st June 2022.
## General
- The server will now shut itself down if any of the following errors occur during startup:
- Any plugin fails to load or enable (plugins loaded by other plugins post-startup are **not** affected by this change) (**PR [#4951](https://github.com/pmmp/PocketMine-MP/pull/4951)**)
- The motivation for this change is to prevent situations where plugins failing to load could result in adverse outcomes, such as a world protection plugin leaving a lobby unprotected from griefing.
- If you encounter this problem, remove the offending plugin(s) or prevent it from loading using `plugin_list.yml`.
- See **PR [#4951](https://github.com/pmmp/PocketMine-MP/pull/4951)** for more detail on this change.
- Any world mentioned in `server.properties` or `pocketmine.yml` fails to load (worlds loaded by plugins are **not** affected by this change)
- Any world mentioned in `server.properties` or `pocketmine.yml` fails to generate (e.g. due to invalid generator settings)
- Enabling the server whitelist while the server is running (e.g. using `/whitelist on`) will now kick any non-whitelisted players currently on the server (**PR [#4774](https://github.com/pmmp/PocketMine-MP/pull/4774)**).
- Help for commands (`/help <name of command>`) now displays a list of aliases of that command.
- A CRITICAL log message is now generated if a plugin disables itself when enabling, in case the plugin doesn't emit any error of its own.
- The `/give` command now shows the alias used to find the given item in the success message, instead of the item ID/meta.
## Fixes
- Block placement has been fixed in many places where it previously didn't work correctly (**PR [#4886](https://github.com/pmmp/PocketMine-MP/pull/4886)**):
- torches on top of slabs, upside-down stairs
- torches on the back face of stairs
- flower pots on top of fences
- the list goes on and on ...
- Fixed backslash escapes not getting properly removed from commands in some cases.
- Fixed aliases defined in the `aliases` section of `pocketmine.yml` not being treated as quote-aware.
## Gameplay
- Plants in flower pots can now be removed by right-clicking on the flower pot.
- Leaves now have a 2% chance of dropping sticks when destroyed by hand (**PR [#5019](https://github.com/pmmp/PocketMine-MP/pull/5019)**).
- Food exhaustion now matches Bedrock 1.18.30 (**PR [#5034](https://github.com/pmmp/PocketMine-MP/pull/5034)**).
- Implemented Stonecutter block (**PR [#4732](https://github.com/pmmp/PocketMine-MP/pull/4732)**).
## API
### Block
- Added `Block->getSupportType(Facing) : SupportType` (**PR [#4886](https://github.com/pmmp/PocketMine-MP/pull/4886)**).
- This is used to determine the kind of support a block face can provide to a block (e.g. a torch) placed on it.
- Added `utils\SupportType` enum (**PR [#4886](https://github.com/pmmp/PocketMine-MP/pull/4886)**).
- `tile\Spawnable->isDirty()` and `tile\Spawnable->setDirty()` are now `@deprecated`.
### Command
- Added `CommandStringHelper::parseQuoteAware()`. This static method contains the code used by `SimpleCommandMap` used to parse quoted command arguments.
### Entity
- Added `Human::emote()` (**PR [#4610](https://github.com/pmmp/PocketMine-MP/pull/4610)**)
### Event
- `PlayerCommandPreprocessEvent` is now `@deprecated`, since its functionality is entirely replaced by other, general-purpose events.
- Use `CommandEvent` to intercept commands.
- Use `PlayerChatEvent` to intercept chat messages.
- To convert a chat message into a command, pass it directly to `Server->dispatchCommand()` with the player as sender.
- Added `PlayerPostChunkSendEvent` (**PR [#4937](https://github.com/pmmp/PocketMine-MP/pull/4937)**).
- Added `PlayerDeathEvent->setKeepXp()` (**PR [#4015](https://github.com/pmmp/PocketMine-MP/pull/4015)**).
- `InventoryCloseEvent` is now called **after** the target window has been removed. This fixes various feedback loops caused by trying to open new windows to a player while there was one still active.
- As a side effect, this now means that `Player->getCurrentWindow()` will return `null` during `InventoryCloseEvent`. Use `InventoryCloseEvent->getInventory()` instead.
### Item
- `StringToItemParser` now recognizes `cod`, `raw_cod` and `cooked_cod` aliases.
### Plugin
- `DisablePluginException` may now be thrown from `Plugin::onEnable()` to make the server gracefully disable the plugin (without crashing) (**PR [#4780](https://github.com/pmmp/PocketMine-MP/pull/4780)**).
- `PluginManager->registerEvent()` now returns the `RegisteredListener` created for the handler, to permit unregistering it later.
## Internals
- Private property declarations now use typed properties (PHP 7.4) and promoted constructor properties (PHP 8.0) wherever possible.
- Protected and public properties remain unchanged, since they can't be changed without breaking subclasses.
- Promoted constructor properties are only used when it's consistently possible to promote most or all properties in a class.
- Simplified and improved legibility of `FormattedCommandAlias`.
- Added unit tests for the quote-aware command parser used by `SimpleCommandMap`.
- Various hardcoded values in `block` package classes have been moved to private constants to improve readability.
- Added various constants used in the `LevelDB` world provider.
# 4.4.1
Released 5th June 2022.
## General
- The server process will now exit with an error code if plugins, worlds or network interfaces failed to start.
## Fixes
- Fixed graylisted plugins preventing the server from starting.
- Fixed `composer make-devtools` command.
- Fixed the `Maximum memory (manager)` units being incorrectly displayed in `/status`.
- Fixed `Player->removeCurrentWindow()` breaking inventory windows.
# 4.4.2
Released 7th June 2022.
## Fixes
- Fixed a crash when arbitrary item IDs appeared in network items in some cases.
- Fixed saved paintings being deleted when loaded from disk (regression from 4.3.4).
- Fixed max stack size of fishing rods.

28
changelogs/4.5.md Normal file
View File

@ -0,0 +1,28 @@
**For Minecraft: Bedrock Edition 1.19.0**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 4.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.
# 4.5.0
Released 7th June 2022.
## General
- Added support for Minecraft: Bedrock Edition 1.19.0.
- Removed support for older versions.
# 4.5.1
Released 8th June 2022.
## Fixes
- Fixed commands defined in `pocketmine.yml` `aliases` not passing the correct arguments.
- Updated BedrockProtocol to fix command argument types displayed on client-side command suggestions.
# 4.5.2
Released 29th June 2022.
## Fixes
- Fixed terrain getting redrawn when flying in spectator mode (or when using `Player->setHasBlockCollision(false)`).
- Fixed skulls with the `noDrops` flag set being treated as unknown blocks.

42
changelogs/4.6.md Normal file
View File

@ -0,0 +1,42 @@
**For Minecraft: Bedrock Edition 1.19.10**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 4.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.
# 4.6.0
Released 13th July 2022.
## General
- Added support for Minecraft: Bedrock Edition 1.19.10.
- Removed support for older versions.
# 4.6.1
Released 22nd July 2022.
## Tools
- `build/generate-registry-annotations.php` now supports processing single files (useful for PhpStorm file watchers).
## API
- Updated documentation for `AsyncTask`.
## Fixes
- Fixed incorrect items being displayed in item frames.
- Fixed books not showing in lecterns.
- Fixed incorrect damage interval of Wither status effect.
- Fixed incorrect fire ticks when being set on fire by lava (8 seconds in Bedrock instead of 15).
- `Entity->attack()` now cancels damage from `FIRE` and `FIRE_TICK` damage causes if the entity is fireproof.
- Fixed inventory windows getting force-closed when the client attempts to use an enchanting table or anvil.
# 4.6.2
Released 6th August 2022.
## Core
- Improved server-side performance of `PlayerAuthInputPacket` handler.
- Improved client-side performance of `FloatingTextParticle` by using an invisible falling block entity. This offered a roughly 5x performance improvement over using tiny invisible players in local testing.
## Fixes
- Fixed assert failures and debug spam on debug Minecraft clients related to abilities in `AddPlayerPacket`.
- Fixed crash in `ReversePriorityQueue` on PHP 8.1 by adding `#[ReturnTypeWillChange]` attribute.

46
changelogs/4.7.md Normal file
View File

@ -0,0 +1,46 @@
**For Minecraft: Bedrock Edition 1.19.20**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 4.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.
# 4.7.0
Released 9th August 2022.
## General
- Added support for Minecraft: Bedrock Edition 1.19.20.
- Removed support for older versions.
# 4.7.1
Released 14th August 2022.
## Fixes
- Fixed server crash when loading items from disk which have negative meta values.
- Fixed Turtle Master potions not giving any effects.
- Unimplemented items are no longer craftable.
- Fixed incorrect items appearing in item frames (due to an obsolete workaround for 1.19.10).
# 4.7.2
Released 16th August 2022.
## Fixes
- Fixed crash when processing player skins with invalid geometry data.
- Fixed spectator players being able to pick blocks using mousewheel click.
- Improved supporting requirements for sugarcane.
# 4.7.3
Released 22nd August 2022.
## General
- Added complete translations for Spanish and Vietnamese.
- All continuous integration (static analysis, unit tests, integration tests) are now performed on PHP 8.1 as well as 8.0.
- InventoryTransaction now verifies that stack sizes of items after the transaction don't exceed the maximum stack size of the item type or the containing inventory.
## Fixes
- Fixed Normal generator crash on PHP 8.1.
- Fixed a race condition during async worker shutdown that could lead to tasks executing in the wrong order. This (very rarely) led to a crash in `PopulationTask` due to its preceding `GeneratorRegisterTask` not being executed.
- Fixed `/give` accepting negative amounts or amounts larger than 32767 (vanilla max).
- Fixed placement conditions for vines (no longer able to be placed on the side of cacti).
- Fixed incorrect documentation of `SignText::__construct()`.

23
changelogs/4.8.md Normal file
View File

@ -0,0 +1,23 @@
**For Minecraft: Bedrock Edition 1.19.21**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 4.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.
# 4.8.0
Released 24th August 2022.
## General
- Added support for Minecraft: Bedrock Edition 1.19.21.
- Removed support for older versions.
# 4.8.1
Released 26th August 2022.
## General
- Crashdumps now include JIT mode information for use by the Crash Archive.
## Fixes
- Fixed uninitialized offset error in `DyeColorIdMap` when given invalid dye color IDs.

36
changelogs/4.9.md Normal file
View File

@ -0,0 +1,36 @@
**For Minecraft: Bedrock Edition 1.19.30**
### Note about API versions
Plugins which don't touch the protocol and compatible with any previous 4.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.
# 4.9.0
Released 20th September 2022.
## General
- Added support for Minecraft: Bedrock Edition 1.19.30.
- Removed support for older versions.
# 4.9.1
Released 11th October 2022.
## Documentation
- Added and improved documentation for many API methods in `Player` and `Block`.
- Added missing `@internal` tag for `TaskHandler->setNextRun()`, `TaskHandler->remove()` and `TaskHandler->run()`.
## Fixes
- Flight state is now locked by the server in spectator mode. This prevents any attempt by the client to toggle flight mode.
- Fixed entity health exceeding its max health after the expiry of Health Boost effect.
- Fixed burp sound not being played when a player eats food.
- Fixed placement conditions for mushrooms - they can now only be placed when the light level at the target is <= 12, or on podzol or mycelium.
- Fixed sign text appearing to change colour and/or glow when using dye on a sign - since this feature is not yet implemented, no change should occur.
- Fixed players drowning when sprint-swimming on the surface of water.
## Internals
- Added more detailed debug logging during the player login sequence.
- Silenced debug spam during `PreSpawnPacketHandler`, considerably reducing debug noise when players join.
- Fixed an edge case in `InventoryManager->removeWindow()`. This bug didn't have any effect on stable versions, but caused a `next-minor` development version to crash.
- `Item`s returned by event getters are now cloned if modifying the result will have no useful side effects.
- Updated `pocketmine/bedrock-data` to [`1.11.1`](https://github.com/pmmp/BedrockData/tree/1.11.1%2Bbedrock-1.19.30), which reduces bandwidth consumption during logins by not sending useless biome generation data.

View File

@ -1,66 +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.3.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.2.0",
"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.7",
"pocketmine/spl": "^0.4.0",
"pocketmine/binaryutils": "^0.1.9",
"pocketmine/nbt": "^0.2.10",
"pocketmine/math": "^0.2.0",
"pocketmine/snooze": "^0.1.0",
"pocketmine/classloader": "^0.1.0",
"pocketmine/log": "^0.2.0",
"pocketmine/log-pthreads": "^0.1.0",
"composer-runtime-api": "^2.0",
"adhocore/json-comment": "^1.1",
"fgrosse/phpasn1": "^2.3",
"netresearch/jsonmapper": "^4.0",
"pocketmine/bedrock-data": "~1.11.0+bedrock-1.19.30",
"pocketmine/bedrock-protocol": "~13.0.0+bedrock-1.19.30",
"pocketmine/binaryutils": "^0.2.1",
"pocketmine/callback-validator": "^1.0.2",
"adhocore/json-comment": "^0.1.0",
"composer-runtime-api": "^2.0"
"pocketmine/classloader": "^0.2.0",
"pocketmine/color": "^0.2.0",
"pocketmine/errorhandler": "^0.6.0",
"pocketmine/locale-data": "~2.8.0 <2.8.9",
"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": "0.12.54",
"phpstan/phpstan-phpunit": "^0.12.6",
"phpstan/phpstan-strict-rules": "^0.12.2",
"phpstan/phpstan": "1.8.8",
"phpstan/phpstan-phpunit": "^1.1.0",
"phpstan/phpstan-strict-rules": "^1.2.0",
"phpunit/phpunit": "^9.2"
},
"autoload": {
"psr-4": {
"": ["src"]
"pocketmine\\": "src/"
},
"files": [
"src/pocketmine/CoreConstants.php",
"src/pocketmine/GlobalConstants.php",
"src/pocketmine/VersionInfo.php"
"src/CoreConstants.php"
]
},
"autoload-dev": {
"psr-4": {
"pocketmine\\": "tests/phpunit/"
"pocketmine\\": "tests/phpunit/",
"pocketmine\\phpstan\\rules\\": "tests/phpstan/rules"
}
},
"config": {
"platform": {
"php": "7.3.0"
}
"php": "8.0.0"
},
"sort-packages": true
},
"scripts": {
"make-devtools": "@php -dphar.readonly=0 tests/plugins/DevTools/src/ConsoleScript.php --make ./ --relative 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"
]
}
}

1692
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
# Doxyfile 1.8.15
# Doxyfile 1.9.3
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
@ -93,14 +93,6 @@ ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all generated output in the proper direction.
# Possible values are: None, LTR, RTL and Context.
# The default value is: None.
OUTPUT_TEXT_DIRECTION = None
# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
# descriptions after the members that are listed in the file and class
# documentation (similar to Javadoc). Set to NO to disable this.
@ -197,6 +189,16 @@ SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line
# such as
# /***************
# as being the beginning of a Javadoc-style comment "banner". If set to NO, the
# Javadoc-style will behave just like regular comments and it will not be
# interpreted by doxygen.
# The default value is: NO.
JAVADOC_BANNER = NO
# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
# line (until the first dot) of a Qt-style comment as the brief description. If
# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
@ -217,6 +219,14 @@ QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
# By default Python docstrings are displayed as preformatted text and doxygen's
# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the
# doxygen's special commands can be used and the contents of the docstring
# documentation blocks is shown as doxygen documentation.
# The default value is: YES.
PYTHON_DOCSTRING = YES
# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
# documentation from any documented member that it re-implements.
# The default value is: YES.
@ -240,25 +250,19 @@ TAB_SIZE = 4
# the documentation. An alias has the form:
# name=value
# For example adding
# "sideeffect=@par Side Effects:\n"
# "sideeffect=@par Side Effects:^^"
# will allow you to put the command \sideeffect (or @sideeffect) in the
# documentation, which will result in a user-defined paragraph with heading
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines (in the resulting output). You can put ^^ in the value part of an
# alias to insert a newline as if a physical newline was in the original file.
# When you need a literal { or } or , in the value part of an alias you have to
# escape them by means of a backslash (\), this can lead to conflicts with the
# commands \{ and \} for these it is advised to use the version @{ and @} or use
# a double escape (\\{ and \\})
# "Side Effects:". Note that you cannot put \n's in the value part of an alias
# to insert newlines (in the resulting output). You can put ^^ in the value part
# of an alias to insert a newline as if a physical newline was in the original
# file. When you need a literal { or } or , in the value part of an alias you
# have to escape them by means of a backslash (\), this can lead to conflicts
# with the commands \{ and \} for these it is advised to use the version @{ and
# @} or use a double escape (\\{ and \\})
ALIASES =
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
# instance, some of the names that are used will be different. The list of all
@ -299,19 +303,22 @@ OPTIMIZE_OUTPUT_SLICE = NO
# parses. With this tag you can assign which parser to use for a given
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension, and
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice,
# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice,
# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
# tries to guess whether the code is fixed or free formatted code, this is the
# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat
# .inc files as Fortran files (default is PHP), and .f files as C (default is
# Fortran), use: inc=Fortran f=C.
# default for Fortran type files). For instance to make doxygen treat .inc files
# as Fortran files (default is PHP), and .f files as C (default is Fortran),
# use: inc=Fortran f=C.
#
# Note: For files without extension you can use no_extension as a placeholder.
#
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
# the files are not read by doxygen. When specifying no_extension you should add
# * to the FILE_PATTERNS.
#
# Note see also the list of default file extension mappings.
EXTENSION_MAPPING =
@ -329,7 +336,7 @@ MARKDOWN_SUPPORT = YES
# to that level are automatically included in the table of contents, even if
# they do not have an id attribute.
# Note: This feature currently applies only to Markdown headings.
# Minimum value: 0, maximum value: 99, default value: 0.
# Minimum value: 0, maximum value: 99, default value: 5.
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
TOC_INCLUDE_HEADINGS = 0
@ -445,6 +452,19 @@ TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use
# during processing. When set to 0 doxygen will based this on the number of
# cores available in the system. You can set it explicitly to a value larger
# than 0 to get more control over the balance between CPU load and processing
# speed. At this moment only the input processing can be done using multiple
# threads. Since this is still an experimental feature the default is set to 1,
# which effectively disables parallel processing. Please report any issues you
# encounter. Generating dot graphs in parallel is controlled by the
# DOT_NUM_THREADS setting.
# Minimum value: 0, maximum value: 32, default value: 1.
NUM_PROC_THREADS = 1
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
@ -465,6 +485,12 @@ EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
# methods of a class will be included in the documentation.
# The default value is: NO.
EXTRACT_PRIV_VIRTUAL = NO
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
# scope will be included in the documentation.
# The default value is: NO.
@ -502,6 +528,13 @@ EXTRACT_LOCAL_METHODS = YES
EXTRACT_ANON_NSPACES = YES
# If this flag is set to YES, the name of an unnamed parameter in a declaration
# will be determined by the corresponding definition. By default unnamed
# parameters remain unnamed in the output.
# The default value is: YES.
RESOLVE_UNNAMED_PARAMS = YES
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
# undocumented members inside documented classes or files. If set to NO these
# members will be included in the various overviews, but no documentation
@ -519,8 +552,8 @@ HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
# (class|struct|union) declarations. If set to NO, these declarations will be
# included in the documentation.
# declarations. If set to NO, these declarations will be included in the
# documentation.
# The default value is: NO.
HIDE_FRIEND_COMPOUNDS = NO
@ -539,11 +572,18 @@ HIDE_IN_BODY_DOCS = YES
INTERNAL_DOCS = NO
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
# names in lower-case letters. If set to YES, upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# and Mac users are advised to set this option to NO.
# With the correct setting of option CASE_SENSE_NAMES doxygen will better be
# able to match the capabilities of the underlying filesystem. In case the
# filesystem is case sensitive (i.e. it supports files in the same directory
# whose names only differ in casing), the option must be set to YES to properly
# deal with such files in case they appear in the input. For filesystems that
# are not case sensitive the option should be be set to NO to properly deal with
# output files written for symbols that only differ in casing, such as for two
# classes, one named CLASS and the other named Class, and to also support
# references to files without having to specify the exact matching casing. On
# Windows (including Cygwin) and MacOS, users should typically set this option
# to NO, whereas on Linux or other Unix flavors it should typically be set to
# YES.
# The default value is: system dependent.
CASE_SENSE_NAMES = NO
@ -562,6 +602,12 @@ HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class
# will show which file needs to be included to use the class.
# The default value is: YES.
SHOW_HEADERFILE = YES
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
# the files that are included by a file in the documentation of that file.
# The default value is: YES.
@ -719,7 +765,8 @@ FILE_VERSION_FILTER =
# output files in an output format independent way. To create the layout file
# that represents doxygen's defaults, run doxygen with the -l option. You can
# optionally specify a file name after the option, if omitted DoxygenLayout.xml
# will be used as the name of the layout file.
# will be used as the name of the layout file. See also section "Changing the
# layout of pages" for information.
#
# Note that if you run doxygen from a directory containing a file called
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
@ -765,24 +812,35 @@ WARNINGS = NO
WARN_IF_UNDOCUMENTED = NO
# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
# potential errors in the documentation, such as not documenting some parameters
# in a documented function, or documenting parameters that don't exist or using
# markup commands wrongly.
# potential errors in the documentation, such as documenting some parameters in
# a documented function twice, or documenting parameters that don't exist or
# using markup commands wrongly.
# The default value is: YES.
WARN_IF_DOC_ERROR = YES
# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete
# function parameter documentation. If set to NO, doxygen will accept that some
# parameters have no documentation without warning.
# The default value is: YES.
WARN_IF_INCOMPLETE_DOC = YES
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
# are documented, but have no documentation for their parameters or return
# value. If set to NO, doxygen will only warn about wrong or incomplete
# parameter documentation, but not about the absence of documentation. If
# EXTRACT_ALL is set to YES then this flag will automatically be disabled.
# value. If set to NO, doxygen will only warn about wrong parameter
# documentation, but not about the absence of documentation. If EXTRACT_ALL is
# set to YES then this flag will automatically be disabled. See also
# WARN_IF_INCOMPLETE_DOC
# The default value is: NO.
WARN_NO_PARAMDOC = NO
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
# a warning is encountered.
# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but
# at the end of the doxygen process doxygen will return with a non-zero status.
# Possible values are: NO, YES and FAIL_ON_WARNINGS.
# The default value is: NO.
WARN_AS_ERROR = NO
@ -799,7 +857,10 @@ WARN_FORMAT = "$file:$line: $text"
# The WARN_LOGFILE tag can be used to specify a file to which warning and error
# messages should be written. If left blank the output is written to standard
# error (stderr).
# error (stderr). In case the file specified cannot be opened for writing the
# warning and error messages are written to standard error. When as file - is
# specified the warning and error messages are written to standard output
# (stdout).
WARN_LOGFILE =
@ -820,8 +881,8 @@ INPUT = ../src \
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
# documentation (see: https://www.gnu.org/software/libiconv/) for the list of
# possible encodings.
# documentation (see:
# https://www.gnu.org/software/libiconv/) for the list of possible encodings.
# The default value is: UTF-8.
INPUT_ENCODING = UTF-8
@ -834,11 +895,15 @@ INPUT_ENCODING = UTF-8
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# read by doxygen.
#
# Note the list of default checked file patterns might differ from the list of
# default file extension mappings.
#
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.
# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml,
# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C
# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd,
# *.vhdl, *.ucf, *.qsf and *.ice.
FILE_PATTERNS = *.php
@ -883,7 +948,7 @@ EXCLUDE_PATTERNS = */bin/* \
# (namespaces, classes, functions, etc.) that should be excluded from the
# output. The symbol name can be a fully qualified name, a word, or if the
# wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test
# ANamespace::AClass, ANamespace::*Test
#
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
@ -1059,16 +1124,24 @@ USE_HTAGS = NO
VERBATIM_HEADERS = YES
# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
# cost of reduced performance. This can be particularly helpful with template
# rich C++ code for which doxygen's built-in parser lacks the necessary type
# information.
# clang parser (see:
# http://clang.llvm.org/) for more accurate parsing at the cost of reduced
# performance. This can be particularly helpful with template rich C++ code for
# which doxygen's built-in parser lacks the necessary type information.
# Note: The availability of this option depends on whether or not doxygen was
# generated with the -Duse_libclang=ON option for CMake.
# The default value is: NO.
CLANG_ASSISTED_PARSING = NO
# If the CLANG_ASSISTED_PARSING tag is set to YES and the CLANG_ADD_INC_PATHS
# tag is set to YES then doxygen will add the directory of each input to the
# include path.
# The default value is: YES.
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
CLANG_ADD_INC_PATHS = YES
# If clang assisted parsing is enabled you can provide the compiler with command
# line options that you would normally use when invoking the compiler. Note that
# the include paths will already be set by doxygen for the files and directories
@ -1078,10 +1151,13 @@ CLANG_ASSISTED_PARSING = NO
CLANG_OPTIONS =
# If clang assisted parsing is enabled you can provide the clang parser with the
# path to the compilation database (see:
# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files
# were built. This is equivalent to specifying the "-p" option to a clang tool,
# such as clang-check. These options will then be passed to the parser.
# path to the directory containing a file called compile_commands.json. This
# file is the compilation database (see:
# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the
# options used when the source files were built. This is equivalent to
# specifying the -p option to a clang tool, such as clang-check. These options
# will then be passed to the parser. Any options specified with CLANG_OPTIONS
# will be added as well.
# Note: The availability of this option depends on whether or not doxygen was
# generated with the -Duse_libclang=ON option for CMake.
@ -1098,13 +1174,6 @@ CLANG_DATABASE_PATH =
ALPHABETICAL_INDEX = YES
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
# which the alphabetical index list will be split.
# Minimum value: 1, maximum value: 20, default value: 5.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
COLS_IN_ALPHA_INDEX = 5
# In case all classes in a project start with a common prefix, all classes will
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
# can be used to specify a prefix (or a list of prefixes) that should be ignored
@ -1204,7 +1273,7 @@ HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
# this color. Hue is specified as an angle on a colorwheel, see
# this color. Hue is specified as an angle on a color-wheel, see
# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
# purple, and 360 is red again.
@ -1214,7 +1283,7 @@ HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
# in the HTML output. For a value of 0 the output will use grayscales only. A
# in the HTML output. For a value of 0 the output will use gray-scales only. A
# value of 255 will produce the most vivid colors.
# Minimum value: 0, maximum value: 255, default value: 100.
# This tag requires that the tag GENERATE_HTML is set to YES.
@ -1239,13 +1308,13 @@ HTML_COLORSTYLE_GAMMA = 80
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_TIMESTAMP = YES
HTML_TIMESTAMP = NO
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
# documentation will contain a main index with vertical navigation menus that
# are dynamically created via Javascript. If disabled, the navigation index will
# are dynamically created via JavaScript. If disabled, the navigation index will
# consists of multiple levels of tabs that are statically embedded in every HTML
# page. Disable this option to support browsers that do not have Javascript,
# page. Disable this option to support browsers that do not have JavaScript,
# like the Qt help browser.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
@ -1275,10 +1344,11 @@ HTML_INDEX_NUM_ENTRIES = 100
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
# generated that can be used as input for Apple's Xcode 3 integrated development
# environment (see: https://developer.apple.com/xcode/), introduced with OSX
# 10.5 (Leopard). To create a documentation set, doxygen will generate a
# Makefile in the HTML output directory. Running make will produce the docset in
# that directory and running make install will install the docset in
# environment (see:
# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To
# create a documentation set, doxygen will generate a Makefile in the HTML
# output directory. Running make will produce the docset in that directory and
# running make install will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
# genXcode/_index.html for more information.
@ -1295,6 +1365,13 @@ GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
# This tag determines the URL of the docset feed. A documentation feed provides
# an umbrella under which multiple documentation sets from a single provider
# (such as a company or product suite) can be grouped.
# This tag requires that the tag GENERATE_DOCSET is set to YES.
DOCSET_FEEDURL =
# This tag specifies a string that should uniquely identify the documentation
# set bundle. This should be a reverse domain-name style string, e.g.
# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
@ -1320,8 +1397,12 @@ DOCSET_PUBLISHER_NAME = Publisher
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on
# Windows.
# on Windows. In the beginning of 2021 Microsoft took the original page, with
# a.o. the download links, offline the HTML help workshop was already many years
# in maintenance mode). You can download the HTML help workshop from the web
# archives at Installation executable (see:
# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo
# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe).
#
# The HTML Help Workshop contains a compiler that can convert all HTML output
# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
@ -1351,7 +1432,7 @@ CHM_FILE =
HHC_LOCATION =
# The GENERATE_CHI flag controls if a separate .chi index file is generated
# (YES) or that it should be included in the master .chm file (NO).
# (YES) or that it should be included in the main .chm file (NO).
# The default value is: NO.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
@ -1396,7 +1477,8 @@ QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
# (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
# (see:
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_QHP is set to YES.
@ -1404,8 +1486,8 @@ QHP_NAMESPACE = org.doxygen.Project
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
# Help Project output. For more information please see Qt Help Project / Virtual
# Folders (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
# folders).
# Folders (see:
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders).
# The default value is: doc.
# This tag requires that the tag GENERATE_QHP is set to YES.
@ -1413,30 +1495,30 @@ QHP_VIRTUAL_FOLDER = doc
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
# filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
# filters).
# Filters (see:
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
# filters).
# Filters (see:
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
# http://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_SECT_FILTER_ATTRS =
# The QHG_LOCATION tag can be used to specify the location of Qt's
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
# generated .qhp file.
# The QHG_LOCATION tag can be used to specify the location (absolute path
# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to
# run qhelpgenerator on the generated .qhp file.
# This tag requires that the tag GENERATE_QHP is set to YES.
QHG_LOCATION =
@ -1479,16 +1561,28 @@ DISABLE_INDEX = NO
# to work a browser that supports JavaScript, DHTML, CSS and frames is required
# (i.e. any modern browser). Windows users are probably better off using the
# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
# further fine-tune the look of the index. As an example, the default style
# sheet generated by doxygen has an example that shows how to put an image at
# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
# the same information as the tab index, you could consider setting
# DISABLE_INDEX to YES when enabling this option.
# further fine tune the look of the index (see "Fine-tuning the output"). As an
# example, the default style sheet generated by doxygen has an example that
# shows how to put an image at the root of the tree instead of the PROJECT_NAME.
# Since the tree basically has the same information as the tab index, you could
# consider setting DISABLE_INDEX to YES when enabling this option.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_TREEVIEW = YES
# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the
# FULL_SIDEBAR option determines if the side bar is limited to only the treeview
# area (value NO) or if it should extend to the full height of the window (value
# YES). Setting this to YES gives a layout similar to
# https://docs.readthedocs.io with more room for contents, but less room for the
# project logo, title, and description. If either GENERATE_TREEVIEW or
# DISABLE_INDEX is set to NO, this option has no effect.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
FULL_SIDEBAR = NO
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
# doxygen will group on one line in the generated HTML documentation.
#
@ -1513,6 +1607,24 @@ TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email
# addresses.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
OBFUSCATE_EMAILS = YES
# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg
# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see
# https://inkscape.org) to generate formulas as SVG images instead of PNGs for
# the HTML output. These images will generally look nicer at scaled resolutions.
# Possible values are: png (the default) and svg (looks nicer but requires the
# pdf2svg or inkscape tool).
# The default value is: png.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FORMULA_FORMAT = png
# Use this tag to change the font size of LaTeX formulas included as images in
# the HTML documentation. When you change the font size after a successful
# doxygen run you need to manually remove any form_*.png images from the HTML
@ -1533,8 +1645,14 @@ FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
# to create new LaTeX commands to be used in formulas as building blocks. See
# the section "Including formulas" for details.
FORMULA_MACROFILE =
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
# https://www.mathjax.org) which uses client side Javascript for the rendering
# https://www.mathjax.org) which uses client side JavaScript for the rendering
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
# installed or if you want to formulas look prettier in the HTML output. When
# enabled you may also need to install MathJax separately and configure the path
@ -1544,11 +1662,29 @@ FORMULA_TRANSPARENT = YES
USE_MATHJAX = YES
# With MATHJAX_VERSION it is possible to specify the MathJax version to be used.
# Note that the different versions of MathJax have different requirements with
# regards to the different settings, so it is possible that also other MathJax
# settings have to be changed when switching between the different MathJax
# versions.
# Possible values are: MathJax_2 and MathJax_3.
# The default value is: MathJax_2.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_VERSION = MathJax_2
# When MathJax is enabled you can set the default output format to be used for
# the MathJax output. See the MathJax site (see:
# http://docs.mathjax.org/en/latest/output.html) for more details.
# the MathJax output. For more details about the output format see MathJax
# version 2 (see:
# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3
# (see:
# http://docs.mathjax.org/en/latest/web/components/output.html).
# Possible values are: HTML-CSS (which is slower, but has the best
# compatibility), NativeMML (i.e. MathML) and SVG.
# compatibility. This is the name for Mathjax version 2, for MathJax version 3
# this will be translated into chtml), NativeMML (i.e. MathML. Only supported
# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This
# is the name for Mathjax version 3, for MathJax version 2 this will be
# translated into HTML-CSS) and SVG.
# The default value is: HTML-CSS.
# This tag requires that the tag USE_MATHJAX is set to YES.
@ -1561,22 +1697,29 @@ MATHJAX_FORMAT = HTML-CSS
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
# Content Delivery Network so you can quickly see the result without installing
# MathJax. However, it is strongly recommended to install a local copy of
# MathJax from https://www.mathjax.org before deployment.
# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/.
# MathJax from https://www.mathjax.org before deployment. The default value is:
# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2
# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_RELPATH = https://cdn.mathjax.org/mathjax/latest
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
# extension names that should be enabled during MathJax rendering. For example
# for MathJax version 2 (see
# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions):
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
# For example for MathJax version 3 (see
# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html):
# MATHJAX_EXTENSIONS = ams
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_EXTENSIONS =
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
# of code that will be used on startup of the MathJax code. See the MathJax site
# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
# (see:
# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an
# example see the documentation.
# This tag requires that the tag USE_MATHJAX is set to YES.
@ -1604,7 +1747,7 @@ MATHJAX_CODEFILE =
SEARCHENGINE = YES
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using Javascript. There
# implemented using a web server instead of a web client using JavaScript. There
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
# setting. When disabled, doxygen will generate a PHP script for searching and
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
@ -1623,7 +1766,8 @@ SERVER_BASED_SEARCH = NO
#
# Doxygen ships with an example indexer (doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library
# Xapian (see: https://xapian.org/).
# Xapian (see:
# https://xapian.org/).
#
# See the section "External Indexing and Searching" for details.
# The default value is: NO.
@ -1636,8 +1780,9 @@ EXTERNAL_SEARCH = NO
#
# Doxygen ships with an example indexer (doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library
# Xapian (see: https://xapian.org/). See the section "External Indexing and
# Searching" for details.
# Xapian (see:
# https://xapian.org/). See the section "External Indexing and Searching" for
# details.
# This tag requires that the tag SEARCHENGINE is set to YES.
SEARCHENGINE_URL =
@ -1708,10 +1853,11 @@ LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to
# generate index for LaTeX.
# generate index for LaTeX. In case there is no backslash (\) as first character
# it will be automatically added in the LaTeX code.
# Note: This tag is used in the generated output file (.tex).
# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.
# The default value is: \makeindex.
# The default value is: makeindex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_MAKEINDEX_CMD = \makeindex
@ -1745,29 +1891,31 @@ PAPER_TYPE = a4
EXTRA_PACKAGES =
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
# generated LaTeX document. The header should contain everything until the first
# chapter. If it is left blank doxygen will generate a standard header. See
# section "Doxygen usage" for information on how to let doxygen write the
# default header to a separate file.
# The LATEX_HEADER tag can be used to specify a user-defined LaTeX header for
# the generated LaTeX document. The header should contain everything until the
# first chapter. If it is left blank doxygen will generate a standard header. It
# is highly recommended to start with a default header using
# doxygen -w latex new_header.tex new_footer.tex new_stylesheet.sty
# and then modify the file new_header.tex. See also section "Doxygen usage" for
# information on how to generate the default header that doxygen normally uses.
#
# Note: Only use a user-defined header if you know what you are doing! The
# following commands have a special meaning inside the header: $title,
# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
# string, for the replacement values of the other commands the user is referred
# to HTML_HEADER.
# Note: Only use a user-defined header if you know what you are doing!
# Note: The header is subject to change so you typically have to regenerate the
# default header when upgrading to a newer version of doxygen. The following
# commands have a special meaning inside the header (and footer): For a
# description of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_HEADER =
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
# generated LaTeX document. The footer should contain everything after the last
# chapter. If it is left blank doxygen will generate a standard footer. See
# The LATEX_FOOTER tag can be used to specify a user-defined LaTeX footer for
# the generated LaTeX document. The footer should contain everything after the
# last chapter. If it is left blank doxygen will generate a standard footer. See
# LATEX_HEADER for more information on how to generate a default footer and what
# special commands can be used inside the footer.
#
# Note: Only use a user-defined footer if you know what you are doing!
# special commands can be used inside the footer. See also section "Doxygen
# usage" for information on how to generate the default footer that doxygen
# normally uses. Note: Only use a user-defined footer if you know what you are
# doing!
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_FOOTER =
@ -1800,9 +1948,11 @@ LATEX_EXTRA_FILES =
PDF_HYPERLINKS = YES
# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
# the PDF file directly from the LaTeX files. Set this option to YES, to get a
# higher quality PDF documentation.
# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as
# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX
# files. Set this option to YES, to get a higher quality PDF documentation.
#
# See also section LATEX_CMD_NAME for selecting the engine.
# The default value is: YES.
# This tag requires that the tag GENERATE_LATEX is set to YES.
@ -1810,8 +1960,7 @@ USE_PDFLATEX = YES
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
# command to the generated LaTeX files. This will instruct LaTeX to keep running
# if errors occur, instead of asking the user for help. This option is also used
# when generating formulas in HTML.
# if errors occur, instead of asking the user for help.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
@ -1824,16 +1973,6 @@ LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
# code with syntax highlighting in the LaTeX output.
#
# Note that which sources are shown also depends on other settings such as
# SOURCE_BROWSER.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_SOURCE_CODE = NO
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. See
# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
@ -1914,16 +2053,6 @@ RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
# with syntax highlighting in the RTF output.
#
# Note that which sources are shown also depends on other settings such as
# SOURCE_BROWSER.
# The default value is: NO.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
@ -2020,15 +2149,6 @@ GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
# program listings (including syntax highlighting and cross-referencing
# information) to the DOCBOOK output. Note that enabling this will significantly
# increase the size of the DOCBOOK output.
# The default value is: NO.
# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
@ -2203,34 +2323,10 @@ EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of 'which perl').
# The default file (with absolute path) is: /usr/bin/perl.
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
# NO turns the diagrams off. Note that this option also works with HAVE_DOT
# disabled, but it is recommended to install and use dot, since it yields more
# powerful graphs.
# The default value is: YES.
CLASS_DIAGRAMS = NO
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see:
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
@ -2287,11 +2383,14 @@ DOT_FONTSIZE = 10
DOT_FONTPATH =
# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
# each documented class showing the direct and indirect inheritance relations.
# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a
# graph for each documented class showing the direct and indirect inheritance
# relations. In case HAVE_DOT is set as well dot will be used to draw the graph,
# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set
# to TEXT the direct and indirect inheritance relations will be shown as texts /
# links.
# Possible values are: NO, YES, TEXT and GRAPH.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
CLASS_GRAPH = YES
@ -2328,10 +2427,32 @@ UML_LOOK = YES
# but if the number exceeds 15, the total amount of fields shown is limited to
# 10.
# Minimum value: 0, maximum value: 100, default value: 10.
# This tag requires that the tag HAVE_DOT is set to YES.
# This tag requires that the tag UML_LOOK is set to YES.
UML_LIMIT_NUM_FIELDS = 10
# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and
# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS
# tag is set to YES, doxygen will add type and arguments for attributes and
# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen
# will not generate fields with class member information in the UML graphs. The
# class diagrams will look similar to the default class diagrams but using UML
# notation for the relationships.
# Possible values are: NO, YES and NONE.
# The default value is: NO.
# This tag requires that the tag UML_LOOK is set to YES.
DOT_UML_DETAILS = NO
# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters
# to display on a single line. If the actual line length exceeds this threshold
# significantly it will wrapped across multiple lines. Some heuristics are apply
# to avoid ugly line breaks.
# Minimum value: 0, maximum value: 1000, default value: 17.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_WRAP_THRESHOLD = 17
# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
# collaboration graphs will show the relations between templates and their
# instances.
@ -2398,6 +2519,13 @@ GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
# The DIR_GRAPH_MAX_DEPTH tag can be used to limit the maximum number of levels
# of child directories generated in directory dependency graphs by dot.
# Minimum value: 1, maximum value: 25, default value: 1.
# This tag requires that the tag DIRECTORY_GRAPH is set to YES.
DIR_GRAPH_MAX_DEPTH = 1
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot. For an explanation of the image formats see the section
# output formats in the documentation of the dot tool (Graphviz (see:
@ -2451,10 +2579,10 @@ MSCFILE_DIRS =
DIAFILE_DIRS =
# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
# path where java can find the plantuml.jar file. If left blank, it is assumed
# PlantUML is not used or called during a preprocessing step. Doxygen will
# generate a warning when it encounters a \startuml command in this case and
# will not generate output for the diagram.
# path where java can find the plantuml.jar file or to the filename of jar file
# to be used. If left blank, it is assumed PlantUML is not used or called during
# a preprocessing step. Doxygen will generate a warning when it encounters a
# \startuml command in this case and will not generate output for the diagram.
PLANTUML_JAR_PATH =
@ -2516,14 +2644,18 @@ DOT_MULTI_TARGETS = YES
# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
# explaining the meaning of the various boxes and arrows in the dot generated
# graphs.
# Note: This tag requires that UML_LOOK isn't set, i.e. the doxygen internal
# graphical representation for inheritance and collaboration diagrams is used.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate
# files that are used to generate the various graphs.
#
# Note: This setting is not only used for dot files but also for msc temporary
# files.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_CLEANUP = YES

View File

@ -7,4 +7,4 @@ 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://github.com/pmmp/DeveloperDocs/) - Reference, guides and specifications for the PocketMine-MP API
- [DeveloperDocs](https://devdoc.pmmp.io) - General documentation for PocketMine-MP plugin developers

View File

@ -1,43 +1,58 @@
includes:
- tests/phpstan/analyse-for-current-php-version.neon.php
- tests/phpstan/configs/actual-problems.neon
- tests/phpstan/configs/check-explicit-mixed-baseline.neon
- tests/phpstan/configs/com-dotnet-magic.neon
- tests/phpstan/configs/gc-hacks.neon
- tests/phpstan/configs/l7-baseline.neon
- tests/phpstan/configs/l8-baseline.neon
- tests/phpstan/configs/impossible-generics.neon
- tests/phpstan/configs/php-bugs.neon
- 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
- 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: 8
checkExplicitMixed: true
level: 9
checkMissingCallableSignature: true
treatPhpDocTypesAsCertain: false
bootstrapFiles:
- tests/phpstan/bootstrap.php
scanDirectories:
- tests/plugins/TesterPlugin
- build
- tests/plugins/TesterPlugin
- tools
scanFiles:
- src/pocketmine/PocketMine.php
- build/make-release.php
- build/server-phar.php
- src/PocketMine.php
paths:
- build
- src
- build/make-release.php
- build/server-phar.php
- tests/phpstan/rules
- tests/phpunit
- tests/plugins/TesterPlugin
- tools
excludePaths:
analyseAndScan:
- build/php
dynamicConstantNames:
- pocketmine\IS_DEVELOPMENT_BUILD
- pocketmine\VersionInfo::IS_DEVELOPMENT_BUILD
- pocketmine\DEBUG
- pocketmine\IS_DEVELOPMENT_BUILD
stubFiles:
- tests/phpstan/stubs/pthreads.stub
- tests/phpstan/stubs/chunkutils.stub
- 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: []

View File

@ -87,11 +87,14 @@ network:
compression-level: 6
#Use AsyncTasks for compression. Adds half/one tick delay, less CPU load on main thread
async-compression: false
#Experimental, only for Windows. Tries to use UPnP to automatically port forward
#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
@ -100,13 +103,13 @@ debug:
player:
#Choose whether to enable player data saving.
save-player-data: true
anti-cheat:
#If false, will try to prevent speed and noclip cheats. May cause movement issues.
allow-movement-cheats: 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 levels will use when created
default-format: pmanvil
#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.
@ -120,11 +123,14 @@ chunk-ticking:
per-tick: 40
#Radius of chunks around a player to tick
tick-radius: 3
light-updates: false
clear-tick-list: true
#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
#- grass
#- ice
#- fire
chunk-generation:
#Max. amount of chunks in the waiting queue to be populated
@ -151,7 +157,6 @@ auto-updater:
enabled: true
on-update:
warn-console: true
warn-ops: true
#Can be development, alpha, beta or stable.
preferred-channel: stable
#If using a development version, it will suggest changing the channel
@ -168,16 +173,44 @@ console:
title-tick: true
aliases:
#Examples:
#showtheversion: version
##This section allows you to add, remove or remap command aliases.
##A single alias can call one or more other commands (or aliases).
##Aliases defined here will override any command aliases declared by plugins or PocketMine-MP itself.
##To remove an alias, set it to [], like so (note that prefixed aliases like "pocketmine:stop" will remain and can't
##be removed):
#stop: []
##Commands are not removed, only their aliases. You can still refer to a command using its full (prefixed)
##name, even if all its aliases are overwritten. The full name is usually something like "pocketmine:commandname" or
##"pluginname:commandname".
#abort: [pocketmine:stop]
##To add an alias, list the command(s) that it calls:
#showtheversion: [version]
#savestop: [save-all, stop]
##To invoke another command with arguments, use $1 to pass the first argument, $2 for the second etc:
#giveadmin: [op $1] ## `giveadmin alex` -> `op alex`
#kill: [suicide, say "I tried to kill $1"] ## `kill alex` -> `suicide` + `say "I tried to kill alex"`
#giverandom: [give $1 $2, say "Someone has just received a $2!"] ## `giverandom alex diamond` -> `give alex diamond` + `say "Someone has just received a diamond!"`
##To make arguments mandatory (so that the command fails if they are not provided), use $$, e.g. $$1, $$2:
#makeadmin: [op $$1] ## `makeadmin alex` -> `op alex`, `makeadmin` with no arguments = error
##To pass through a range of arguments, put a - (hyphen) after the index:
#tpalias: [tp $1-] ## `tpalias 256 70 256` -> `tp 256 70 256` - this passes arguments 1 and everything after it to the `tp` command
##To change an existing command alias and make it do something else:
#tp: [suicide]
worlds:
#These settings will override the generator set in server.properties and allows loading multiple levels
#These settings will override the generator set in server.properties and allows loading multiple worlds
#Example:
#world:
# seed: 404
# generator: FLAT:2;7,59x1,3x3,2;1;decoration(treecount=80 grasscount=45)
# 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.

View File

@ -17,7 +17,7 @@
* @link http://www.pocketmine.net/
*
*
*/
*/
declare(strict_types=1);
@ -33,5 +33,8 @@ if(defined('pocketmine\_CORE_CONSTANTS_INCLUDED')){
}
define('pocketmine\_CORE_CONSTANTS_INCLUDED', true);
define('pocketmine\PATH', dirname(__DIR__, 2) . '/');
define('pocketmine\RESOURCE_PATH', __DIR__ . '/resources/');
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');

527
src/MemoryManager.php Normal file
View File

@ -0,0 +1,527 @@
<?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\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_THROW_ON_ERROR;
use const JSON_UNESCAPED_SLASHES;
use const SORT_NUMERIC;
class MemoryManager{
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(
private 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 || !$this->lowMemDisableChunkCache;
}
/**
* Returns the allowed chunk radius based on the current memory usage.
*/
public function getViewDistance(int $distance) : int{
return ($this->lowMemory && $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 || $this->globalMemoryLimit > 0) && ++$this->checkTicker >= $this->checkRate){
$this->checkTicker = 0;
$memory = Process::getAdvancedMemoryUsage();
$trigger = false;
if($this->memoryLimit > 0 && $memory[0] > $this->memoryLimit){
$trigger = 0;
}elseif($this->globalMemoryLimit > 0 && $memory[1] > $this->globalMemoryLimit){
$trigger = 1;
}
if($trigger !== false){
if($this->lowMemory && $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 && ++$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 = Utils::assumeNotFalse(ini_get('memory_limit'), "memory_limit INI directive should always exist");
ini_set('memory_limit', '-1');
gc_disable();
if(!file_exists($outputFolder)){
mkdir($outputFolder, 0777, true);
}
$obData = Utils::assumeNotFalse(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() || $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 | JSON_THROW_ON_ERROR));
$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 | JSON_THROW_ON_ERROR));
$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 | JSON_THROW_ON_ERROR));
$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 | JSON_THROW_ON_ERROR) . "\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 | JSON_THROW_ON_ERROR));
file_put_contents(Path::join($outputFolder, "referenceCounts.js"), json_encode($refCounts, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
arsort($instanceCounts, SORT_NUMERIC);
file_put_contents(Path::join($outputFolder, "instanceCounts.js"), json_encode($instanceCounts, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
$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 = [];
$numeric = 0;
foreach($from as $key => $value){
$data[$numeric] = [
"k" => self::continueDump($key, $objects, $refCounts, $recursion + 1, $maxNesting, $maxStringSize),
"v" => self::continueDump($value, $objects, $refCounts, $recursion + 1, $maxNesting, $maxStringSize),
];
$numeric++;
}
}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;
}
}

View File

@ -23,19 +23,31 @@ declare(strict_types=1);
namespace pocketmine {
use pocketmine\utils\Git;
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\utils\Utils;
use pocketmine\utils\VersionString;
use pocketmine\wizard\SetupWizard;
use Webmozart\PathUtil\Path;
use function defined;
use function extension_loaded;
use function function_exists;
use function getcwd;
use function phpversion;
use function preg_match;
use function preg_quote;
use function realpath;
use function version_compare;
require_once __DIR__ . '/VersionInfo.php';
const MIN_PHP_VERSION = "7.3.0";
const MIN_PHP_VERSION = "8.0.0";
/**
* @param string $message
@ -73,13 +85,18 @@ namespace pocketmine {
}
$extensions = [
"bcmath" => "BC Math",
"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",
@ -98,40 +115,54 @@ namespace pocketmine {
}
}
if(extension_loaded("pthreads")){
$pthreads_version = phpversion("pthreads");
if(($pthreads_version = phpversion("pthreads")) !== false){
if(substr_count($pthreads_version, ".") < 2){
$pthreads_version = "0.$pthreads_version";
}
if(version_compare($pthreads_version, "3.2.0") < 0){
$messages[] = "pthreads >= 3.2.0 is required, while you have $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(($leveldb_version = phpversion("leveldb")) !== false){
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;
}
/**
* @param \Logger $logger
* @return void
*/
function emit_performance_warnings(\Logger $logger){
if(extension_loaded("xdebug")){
$logger->warning("Xdebug extension is enabled. This has a major impact on performance.");
if(PHP_DEBUG !== 0){
$logger->warning("This PHP binary was compiled in debug mode. This has a major impact on performance.");
}
if(!extension_loaded("pocketmine_chunkutils")){
$logger->warning("ChunkUtils extension is missing. Anvil-format worlds will experience degraded performance.");
if(extension_loaded("xdebug") && (!function_exists('xdebug_info') || count(xdebug_info('mode')) !== 0)){
$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.");
@ -139,6 +170,24 @@ namespace pocketmine {
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 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 have enabled PHP JIT.
To turn off JIT, change `opcache.jit` to `0` in your php.ini file.
-------------------------------------------------------------------------------------------
JIT_WARNING
);
}
}
}
/**
@ -159,10 +208,14 @@ namespace pocketmine {
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 ($binary) does not satisfy some requirements.");
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);
@ -172,66 +225,53 @@ namespace pocketmine {
error_reporting(-1);
set_ini_entries();
$opts = getopt("", ["bootstrap:"]);
if(isset($opts["bootstrap"])){
$bootstrap = ($real = realpath($opts["bootstrap"])) !== false ? $real : $opts["bootstrap"];
}else{
$bootstrap = dirname(__FILE__, 3) . '/vendor/autoload.php';
}
if($bootstrap === false or !is_file($bootstrap)){
$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);
}
define('pocketmine\COMPOSER_AUTOLOADER_PATH', $bootstrap);
require_once(\pocketmine\COMPOSER_AUTOLOADER_PATH);
require_once($bootstrap);
set_error_handler([Utils::class, 'errorExceptionHandler']);
$version = new VersionString(\pocketmine\BASE_VERSION, \pocketmine\IS_DEVELOPMENT_BUILD, \pocketmine\BUILD_NUMBER);
define('pocketmine\VERSION', $version->getFullVersion(true));
$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"];
$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);
}
define('pocketmine\GIT_COMMIT', $gitHash);
ErrorToExceptionHandler::set();
$opts = getopt("", ["data:", "plugins:", "no-wizard", "enable-ansi", "disable-ansi"]);
define('pocketmine\DATA', isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : realpath(getcwd()) . DIRECTORY_SEPARATOR);
define('pocketmine\PLUGIN_PATH', isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : realpath(getcwd()) . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
$cwd = Utils::assumeNotFalse(realpath(Utils::assumeNotFalse(getcwd())));
$dataPath = isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : $cwd . DIRECTORY_SEPARATOR;
$pluginPath = isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : $cwd . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR;
Filesystem::addCleanedPath($pluginPath, Filesystem::CLEAN_PATH_PLUGINS_PREFIX);
if(!file_exists(\pocketmine\DATA)){
mkdir(\pocketmine\DATA, 0777, true);
if(!file_exists($dataPath)){
mkdir($dataPath, 0777, true);
}
define('pocketmine\LOCK_FILE', fopen(\pocketmine\DATA . 'server.lock', "a+b"));
if(!flock(\pocketmine\LOCK_FILE, LOCK_EX | LOCK_NB)){
//wait for a shared lock to avoid race conditions if two servers started at the same time - this makes sure the
//other server wrote its PID and released exclusive lock before we get our lock
flock(\pocketmine\LOCK_FILE, LOCK_SH);
$pid = stream_get_contents(\pocketmine\LOCK_FILE);
critical_error("Another " . \pocketmine\NAME . " instance (PID $pid) is already using this folder (" . realpath(\pocketmine\DATA) . ").");
$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);
}
ftruncate(\pocketmine\LOCK_FILE, 0);
fwrite(\pocketmine\LOCK_FILE, (string) getmypid());
fflush(\pocketmine\LOCK_FILE);
flock(\pocketmine\LOCK_FILE, LOCK_SH); //prevent acquiring an exclusive lock from another process, but allow reading
//Logger has a dependency on timezone
$tzError = Timezone::init();
Timezone::init();
if(isset($opts["enable-ansi"])){
Terminal::init(true);
@ -241,36 +281,28 @@ namespace pocketmine {
Terminal::init();
}
$logger = new MainLogger(\pocketmine\DATA . "server.log");
$logger->registerStatic();
foreach($tzError as $e){
$logger->warning($e);
}
unset($tzError);
$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(\pocketmine\DATA . "server.properties") and !isset($opts["no-wizard"])){
$installer = new SetupWizard();
if(!file_exists(Path::join($dataPath, "server.properties")) && !isset($opts["no-wizard"])){
$installer = new SetupWizard($dataPath);
if(!$installer->run()){
$exitCode = -1;
break;
}
}
//TODO: move this to a Server field
define('pocketmine\START_TIME', microtime(true));
/*
* We now use the Composer autoloader, but this autoloader is still for loading plugins.
*/
$autoloader = new \BaseClassLoader();
$autoloader->register(false);
new Server($autoloader, $logger, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
new Server($autoloader, $logger, $dataPath, $pluginPath);
$logger->info("Stopping other threads");
@ -280,27 +312,18 @@ namespace pocketmine {
if(ThreadManager::getInstance()->stopAll() > 0){
$logger->debug("Some threads could not be stopped, performing a force-kill");
Process::kill(getmypid());
Process::kill(Process::pid(), true);
}
}while(false);
$logger->shutdown();
$logger->join();
$logger->shutdownLogWriterThread();
echo Terminal::$FORMAT_RESET . PHP_EOL;
if(!flock(\pocketmine\LOCK_FILE, LOCK_UN)){
critical_error("Failed to release the server.lock file.");
}
if(!fclose(\pocketmine\LOCK_FILE)){
critical_error("Could not close server.lock resource.");
}
Filesystem::releaseLockFile($lockFilePath);
exit($exitCode);
}
if(!defined('pocketmine\_PHPSTAN_ANALYSIS')){
\pocketmine\server();
}
\pocketmine\server();
}

1878
src/Server.php Normal file

File diff suppressed because it is too large Load Diff

140
src/ServerConfigGroup.php Normal file
View File

@ -0,0 +1,140 @@
<?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 mixed[]
* @phpstan-var array<string, mixed>
*/
private array $propertyCache = [];
public function __construct(
private Config $pocketmineYml,
private Config $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();
}
}
}

89
src/VersionInfo.php Normal file
View File

@ -0,0 +1,89 @@
<?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.9.1";
public const IS_DEVELOPMENT_BUILD = false;
public const BUILD_CHANNEL = "stable";
private function __construct(){
//NOOP
}
private static ?string $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;
}
private static ?VersionString $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

@ -17,19 +17,16 @@
* @link http://www.pocketmine.net/
*
*
*/
*/
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

@ -17,19 +17,22 @@
* @link http://www.pocketmine.net/
*
*
*/
*/
declare(strict_types=1);
namespace pocketmine\block;
abstract class Transparent extends Block{
/**
* Air block
*/
class Air extends Flowable{
public function isTransparent() : bool{
public function canBeReplaced() : bool{
return true;
}
public function getLightFilter() : int{
return 0;
public function canBePlaced() : bool{
return false;
}
}

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

@ -0,0 +1,106 @@
<?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\block\utils\SupportType;
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;
public const UNDAMAGED = 0;
public const SLIGHTLY_DAMAGED = 1;
public const VERY_DAMAGED = 2;
private int $damage = self::UNDAMAGED;
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, self::UNDAMAGED, self::VERY_DAMAGED);
}
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 < self::UNDAMAGED || $damage > self::VERY_DAMAGED){
throw new \InvalidArgumentException("Damage must be in range " . self::UNDAMAGED . " ... " . self::VERY_DAMAGED);
}
$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 getSupportType(int $facing) : SupportType{
return SupportType::NONE();
}
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;
}
}

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

@ -0,0 +1,245 @@
<?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\block\utils\SupportType;
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)];
}
public function getSupportType(int $facing) : SupportType{
return SupportType::NONE();
}
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) && !$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::BAMBOO_SAPLING_FLAG_READY) !== 0;
}
protected function writeStateToMeta() : int{
return $this->ready ? BlockLegacyMetadata::BAMBOO_SAPLING_FLAG_READY : 0;
}
public function getStateBitmask() : int{ return 0b1; }
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;
}
}

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

@ -0,0 +1,152 @@
<?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\block\utils\SupportType;
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 getSupportType(int $facing) : SupportType{
return SupportType::NONE();
}
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 && count($this->patterns) > 0){
$drop->setPatterns($this->patterns);
}
return [$drop];
}
public function getPickedItem(bool $addUserData = false) : Item{
$result = $this->asItem();
if($addUserData && $result instanceof ItemBanner && count($this->patterns) > 0){
$result->setPatterns($this->patterns);
}
return $result;
}
}

73
src/block/BaseCoral.php Normal file
View File

@ -0,0 +1,73 @@
<?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\CoralType;
use pocketmine\block\utils\CoralTypeTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\item\Item;
abstract class BaseCoral extends Transparent{
use CoralTypeTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
parent::__construct($idInfo, $name, $breakInfo);
$this->coralType = CoralType::TUBE();
}
public function onNearbyBlockChange() : void{
if(!$this->dead){
$world = $this->position->getWorld();
$hasWater = false;
foreach($this->position->sides() as $vector3){
if($world->getBlock($vector3) instanceof Water){
$hasWater = true;
break;
}
}
//TODO: check water inside the block itself (not supported on the API yet)
if(!$hasWater){
$world->setBlock($this->position, $this->setDead(true));
}
}
}
public function getDropsForCompatibleTool(Item $item) : array{
return [];
}
public function isAffectedBySilkTouch() : bool{
return true;
}
public function isSolid() : bool{ return false; }
protected function recalculateCollisionBoxes() : array{ return []; }
public function getSupportType(int $facing) : SupportType{
return SupportType::NONE();
}
}

234
src/block/BaseRail.php Normal file
View File

@ -0,0 +1,234 @@
<?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\RailConnectionInfo;
use pocketmine\item\Item;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
use function array_reverse;
use function array_search;
use function array_shift;
use function count;
use function in_array;
abstract class BaseRail extends Flowable{
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($blockReplace->getSide(Facing::DOWN)->getSupportType(Facing::UP)->hasEdgeSupport()){
return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
}
return false;
}
public function onPostPlace() : void{
$this->tryReconnect();
}
/**
* @param int[] $connections
* @param int[][] $lookup
* @phpstan-param array<int, list<int>> $lookup
*/
protected static function searchState(array $connections, array $lookup) : ?int{
$shape = array_search($connections, $lookup, true);
if($shape === false){
$shape = array_search(array_reverse($connections), $lookup, true);
}
return $shape === false ? null : $shape;
}
/**
* Sets the rail shape according to the given connections, if a shape matches.
*
* @param int[] $connections
*
* @throws \InvalidArgumentException if no shape matches the given connections
*/
abstract protected function setShapeFromConnections(array $connections) : void;
/**
* Returns the connection directions of this rail (depending on the current block state)
*
* @return int[]
*/
abstract protected function getCurrentShapeConnections() : array;
/**
* Returns all the directions this rail is already connected in.
*
* @return int[]
*/
private function getConnectedDirections() : array{
/** @var int[] $connections */
$connections = [];
/** @var int $connection */
foreach($this->getCurrentShapeConnections() as $connection){
$other = $this->getSide($connection & ~RailConnectionInfo::FLAG_ASCEND);
$otherConnection = Facing::opposite($connection & ~RailConnectionInfo::FLAG_ASCEND);
if(($connection & RailConnectionInfo::FLAG_ASCEND) !== 0){
$other = $other->getSide(Facing::UP);
}elseif(!($other instanceof BaseRail)){ //check for rail sloping up to meet this one
$other = $other->getSide(Facing::DOWN);
$otherConnection |= RailConnectionInfo::FLAG_ASCEND;
}
if(
$other instanceof BaseRail &&
in_array($otherConnection, $other->getCurrentShapeConnections(), true)
){
$connections[] = $connection;
}
}
return $connections;
}
/**
* @param int[] $constraints
*
* @return true[]
* @phpstan-return array<int, true>
*/
private function getPossibleConnectionDirections(array $constraints) : array{
switch(count($constraints)){
case 0:
//No constraints, can connect in any direction
$possible = [
Facing::NORTH => true,
Facing::SOUTH => true,
Facing::WEST => true,
Facing::EAST => true
];
foreach($possible as $p => $_){
$possible[$p | RailConnectionInfo::FLAG_ASCEND] = true;
}
return $possible;
case 1:
return $this->getPossibleConnectionDirectionsOneConstraint(array_shift($constraints));
case 2:
return [];
default:
throw new \InvalidArgumentException("Expected at most 2 constraints, got " . count($constraints));
}
}
/**
* @return true[]
* @phpstan-return array<int, true>
*/
protected function getPossibleConnectionDirectionsOneConstraint(int $constraint) : array{
$opposite = Facing::opposite($constraint & ~RailConnectionInfo::FLAG_ASCEND);
$possible = [$opposite => true];
if(($constraint & RailConnectionInfo::FLAG_ASCEND) === 0){
//We can slope the other way if this connection isn't already a slope
$possible[$opposite | RailConnectionInfo::FLAG_ASCEND] = true;
}
return $possible;
}
private function tryReconnect() : void{
$thisConnections = $this->getConnectedDirections();
$changed = false;
do{
$possible = $this->getPossibleConnectionDirections($thisConnections);
$continue = false;
foreach($possible as $thisSide => $_){
$otherSide = Facing::opposite($thisSide & ~RailConnectionInfo::FLAG_ASCEND);
$other = $this->getSide($thisSide & ~RailConnectionInfo::FLAG_ASCEND);
if(($thisSide & RailConnectionInfo::FLAG_ASCEND) !== 0){
$other = $other->getSide(Facing::UP);
}elseif(!($other instanceof BaseRail)){ //check if other rails can slope up to meet this one
$other = $other->getSide(Facing::DOWN);
$otherSide |= RailConnectionInfo::FLAG_ASCEND;
}
if(!($other instanceof BaseRail) || count($otherConnections = $other->getConnectedDirections()) >= 2){
//we can only connect to a rail that has less than 2 connections
continue;
}
$otherPossible = $other->getPossibleConnectionDirections($otherConnections);
if(isset($otherPossible[$otherSide])){
$otherConnections[] = $otherSide;
$other->setConnections($otherConnections);
$this->position->getWorld()->setBlock($other->position, $other);
$changed = true;
$thisConnections[] = $thisSide;
$continue = count($thisConnections) < 2;
break; //force recomputing possible directions, since this connection could invalidate others
}
}
}while($continue);
if($changed){
$this->setConnections($thisConnections);
$this->position->getWorld()->setBlock($this->position, $this);
}
}
/**
* @param int[] $connections
*/
private function setConnections(array $connections) : void{
if(count($connections) === 1){
$connections[] = Facing::opposite($connections[0] & ~RailConnectionInfo::FLAG_ASCEND);
}elseif(count($connections) !== 2){
throw new \InvalidArgumentException("Expected exactly 2 connections, got " . count($connections));
}
$this->setShapeFromConnections($connections);
}
public function onNearbyBlockChange() : void{
if(!$this->getSide(Facing::DOWN)->getSupportType(Facing::UP)->hasEdgeSupport()){
$this->position->getWorld()->useBreakOn($this->position);
}else{
foreach($this->getCurrentShapeConnections() as $connection){
if(($connection & RailConnectionInfo::FLAG_ASCEND) !== 0 && !$this->getSide($connection & ~RailConnectionInfo::FLAG_ASCEND)->getSupportType(Facing::UP)->hasEdgeSupport()){
$this->position->getWorld()->useBreakOn($this->position);
break;
}
}
}
}
}

142
src/block/BaseSign.php Normal file
View File

@ -0,0 +1,142 @@
<?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\Sign as TileSign;
use pocketmine\block\utils\SignText;
use pocketmine\block\utils\SupportType;
use pocketmine\event\block\SignChangeEvent;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\utils\TextFormat;
use pocketmine\world\BlockTransaction;
use function array_map;
use function assert;
use function strlen;
abstract class BaseSign extends Transparent{
protected SignText $text;
protected ?int $editorEntityRuntimeId = null;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
parent::__construct($idInfo, $name, $breakInfo);
$this->text = new SignText();
}
public function readStateFromWorld() : void{
parent::readStateFromWorld();
$tile = $this->position->getWorld()->getTile($this->position);
if($tile instanceof TileSign){
$this->text = $tile->getText();
$this->editorEntityRuntimeId = $tile->getEditorEntityRuntimeId();
}
}
public function writeStateToWorld() : void{
parent::writeStateToWorld();
$tile = $this->position->getWorld()->getTile($this->position);
assert($tile instanceof TileSign);
$tile->setText($this->text);
$tile->setEditorEntityRuntimeId($this->editorEntityRuntimeId);
}
public function isSolid() : bool{
return false;
}
public function getMaxStackSize() : int{
return 16;
}
/**
* @return AxisAlignedBB[]
*/
protected function recalculateCollisionBoxes() : array{
return [];
}
public function getSupportType(int $facing) : SupportType{
return SupportType::NONE();
}
abstract protected function getSupportingFace() : int;
public function onNearbyBlockChange() : void{
if($this->getSide($this->getSupportingFace())->getId() === BlockLegacyIds::AIR){
$this->position->getWorld()->useBreakOn($this->position);
}
}
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($player !== null){
$this->editorEntityRuntimeId = $player->getId();
}
return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
}
/**
* Returns an object containing information about the sign text.
*/
public function getText() : SignText{
return $this->text;
}
/** @return $this */
public function setText(SignText $text) : self{
$this->text = $text;
return $this;
}
/**
* Called by the player controller (network session) to update the sign text, firing events as appropriate.
*
* @return bool if the sign update was successful.
* @throws \UnexpectedValueException if the text payload is too large
*/
public function updateText(Player $author, SignText $text) : bool{
$size = 0;
foreach($text->getLines() as $line){
$size += strlen($line);
}
if($size > 1000){
throw new \UnexpectedValueException($author->getName() . " tried to write $size bytes of text onto a sign (bigger than max 1000)");
}
$ev = new SignChangeEvent($this, $author, new SignText(array_map(function(string $line) : string{
return TextFormat::clean($line, false);
}, $text->getLines())));
if($this->editorEntityRuntimeId === null || $this->editorEntityRuntimeId !== $author->getId()){
$ev->cancel();
}
$ev->call();
if(!$ev->isCancelled()){
$this->setText($ev->getNewText());
$this->position->getWorld()->setBlock($this->position, $this);
return true;
}
return false;
}
}

View File

@ -17,17 +17,17 @@
* @link http://www.pocketmine.net/
*
*
*/
*/
declare(strict_types=1);
namespace pocketmine\block;
class StillLava extends Lava{
final class Beacon extends Transparent{
protected $id = self::STILL_LAVA;
public function getName() : string{
return "Still Lava";
public function getLightLevel() : int{
return 15;
}
//TODO
}

227
src/block/Bed.php Normal file
View File

@ -0,0 +1,227 @@
<?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\Bed as TileBed;
use pocketmine\block\utils\BlockDataSerializer;
use pocketmine\block\utils\ColoredTrait;
use pocketmine\block\utils\DyeColor;
use pocketmine\block\utils\HorizontalFacingTrait;
use pocketmine\block\utils\SupportType;
use pocketmine\data\bedrock\DyeColorIdMap;
use pocketmine\entity\Entity;
use pocketmine\entity\Living;
use pocketmine\item\Item;
use pocketmine\lang\KnownTranslationFactory;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\utils\TextFormat;
use pocketmine\world\BlockTransaction;
use pocketmine\world\World;
class Bed extends Transparent{
use ColoredTrait;
use HorizontalFacingTrait;
protected bool $occupied = false;
protected bool $head = false;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
$this->color = DyeColor::RED();
parent::__construct($idInfo, $name, $breakInfo);
}
protected function writeStateToMeta() : int{
return BlockDataSerializer::writeLegacyHorizontalFacing($this->facing) |
($this->occupied ? BlockLegacyMetadata::BED_FLAG_OCCUPIED : 0) |
($this->head ? BlockLegacyMetadata::BED_FLAG_HEAD : 0);
}
public function readStateFromData(int $id, int $stateMeta) : void{
$this->facing = BlockDataSerializer::readLegacyHorizontalFacing($stateMeta & 0x03);
$this->occupied = ($stateMeta & BlockLegacyMetadata::BED_FLAG_OCCUPIED) !== 0;
$this->head = ($stateMeta & BlockLegacyMetadata::BED_FLAG_HEAD) !== 0;
}
public function getStateBitmask() : int{
return 0b1111;
}
public function readStateFromWorld() : void{
parent::readStateFromWorld();
//read extra state information from the tile - this is an ugly hack
$tile = $this->position->getWorld()->getTile($this->position);
if($tile instanceof TileBed){
$this->color = $tile->getColor();
}
}
public function writeStateToWorld() : void{
parent::writeStateToWorld();
//extra block properties storage hack
$tile = $this->position->getWorld()->getTile($this->position);
if($tile instanceof TileBed){
$tile->setColor($this->color);
}
}
/**
* @return AxisAlignedBB[]
*/
protected function recalculateCollisionBoxes() : array{
return [AxisAlignedBB::one()->trim(Facing::UP, 7 / 16)];
}
public function getSupportType(int $facing) : SupportType{
return SupportType::NONE();
}
public function isHeadPart() : bool{
return $this->head;
}
/** @return $this */
public function setHead(bool $head) : self{
$this->head = $head;
return $this;
}
public function isOccupied() : bool{
return $this->occupied;
}
/** @return $this */
public function setOccupied(bool $occupied = true) : self{
$this->occupied = $occupied;
return $this;
}
private function getOtherHalfSide() : int{
return $this->head ? Facing::opposite($this->facing) : $this->facing;
}
public function getOtherHalf() : ?Bed{
$other = $this->getSide($this->getOtherHalfSide());
if($other instanceof Bed && $other->head !== $this->head && $other->facing === $this->facing){
return $other;
}
return null;
}
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($player !== null){
$other = $this->getOtherHalf();
$playerPos = $player->getPosition();
if($other === null){
$player->sendMessage(TextFormat::GRAY . "This bed is incomplete");
return true;
}elseif($playerPos->distanceSquared($this->position) > 4 && $playerPos->distanceSquared($other->position) > 4){
$player->sendMessage(KnownTranslationFactory::tile_bed_tooFar()->prefix(TextFormat::GRAY));
return true;
}
$time = $this->position->getWorld()->getTimeOfDay();
$isNight = ($time >= World::TIME_NIGHT && $time < World::TIME_SUNRISE);
if(!$isNight){
$player->sendMessage(KnownTranslationFactory::tile_bed_noSleep()->prefix(TextFormat::GRAY));
return true;
}
$b = ($this->isHeadPart() ? $this : $other);
if($b->isOccupied()){
$player->sendMessage(KnownTranslationFactory::tile_bed_occupied()->prefix(TextFormat::GRAY));
return true;
}
$player->sleepOn($b->position);
}
return true;
}
public function onNearbyBlockChange() : void{
if(!$this->head && ($other = $this->getOtherHalf()) !== null && $other->occupied !== $this->occupied){
$this->occupied = $other->occupied;
$this->position->getWorld()->setBlock($this->position, $this);
}
}
public function onEntityLand(Entity $entity) : ?float{
if($entity instanceof Living && $entity->isSneaking()){
return null;
}
$entity->fallDistance *= 0.5;
return $entity->getMotion()->y * -3 / 4; // 2/3 in Java, according to the wiki
}
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
if($this->canBeSupportedBy($this->getSide(Facing::DOWN))){
$this->facing = $player !== null ? $player->getHorizontalFacing() : Facing::NORTH;
$next = $this->getSide($this->getOtherHalfSide());
if($next->canBeReplaced() && $this->canBeSupportedBy($next->getSide(Facing::DOWN))){
$nextState = clone $this;
$nextState->head = true;
$tx->addBlock($blockReplace->position, $this)->addBlock($next->position, $nextState);
return true;
}
}
return false;
}
public function getDrops(Item $item) : array{
if($this->head){
return parent::getDrops($item);
}
return [];
}
protected function writeStateToItemMeta() : int{
return DyeColorIdMap::getInstance()->toId($this->color);
}
public function getAffectedBlocks() : array{
if(($other = $this->getOtherHalf()) !== null){
return [$this, $other];
}
return parent::getAffectedBlocks();
}
private function canBeSupportedBy(Block $block) : bool{
return !$block->getSupportType(Facing::UP)->equals(SupportType::NONE());
}
}

View File

@ -17,39 +17,35 @@
* @link http://www.pocketmine.net/
*
*
*/
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\TieredTool;
class Bedrock extends Opaque{
class Netherrack extends Solid{
private bool $burnsForever = false;
protected $id = self::NETHERRACK;
public function __construct(int $meta = 0){
$this->meta = $meta;
public function readStateFromData(int $id, int $stateMeta) : void{
$this->burnsForever = ($stateMeta & BlockLegacyMetadata::BEDROCK_FLAG_INFINIBURN) !== 0;
}
public function getName() : string{
return "Netherrack";
protected function writeStateToMeta() : int{
return $this->burnsForever ? BlockLegacyMetadata::BEDROCK_FLAG_INFINIBURN : 0;
}
public function getHardness() : float{
return 0.4;
}
public function getToolType() : int{
return BlockToolType::TYPE_PICKAXE;
}
public function getToolHarvestLevel() : int{
return TieredTool::TIER_WOODEN;
public function getStateBitmask() : int{
return 0b1;
}
public function burnsForever() : bool{
return true;
return $this->burnsForever;
}
/** @return $this */
public function setBurnsForever(bool $burnsForever) : self{
$this->burnsForever = $burnsForever;
return $this;
}
}

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