From 2db3498891e729bce9f03a4350c57da7ae513db6 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 24 Sep 2022 21:26:42 +0100 Subject: [PATCH 1/8] Updated DevTools submodule to pmmp/DevTools@bd0fa048dae29bebe25ba76d8c58788e92418b67 --- tests/plugins/DevTools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plugins/DevTools b/tests/plugins/DevTools index e884a4c23..bd0fa048d 160000 --- a/tests/plugins/DevTools +++ b/tests/plugins/DevTools @@ -1 +1 @@ -Subproject commit e884a4c234629126203e769df7c4dbbbc0dc2d49 +Subproject commit bd0fa048dae29bebe25ba76d8c58788e92418b67 From dec188d4adb641a8162808b984677bcadc1f0cf5 Mon Sep 17 00:00:00 2001 From: DHJ1 <93106203+DHJ1@users.noreply.github.com> Date: Tue, 27 Sep 2022 19:17:29 +0300 Subject: [PATCH 2/8] TaskHandler: mark some public methods as @internal (#5310) closes #5309 --- src/scheduler/TaskHandler.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/scheduler/TaskHandler.php b/src/scheduler/TaskHandler.php index e1cadb652..50d9f01b0 100644 --- a/src/scheduler/TaskHandler.php +++ b/src/scheduler/TaskHandler.php @@ -69,6 +69,9 @@ class TaskHandler{ return $this->nextRun; } + /** + * @internal + */ public function setNextRun(int $ticks) : void{ $this->nextRun = $ticks; } @@ -103,11 +106,17 @@ class TaskHandler{ } } + /** + * @internal + */ public function remove() : void{ $this->cancelled = true; $this->task->setHandler(null); } + /** + * @internal + */ public function run() : void{ $this->timings->startTiming(); try{ From 455f9fa92e861e0ab6a4ea7df7e4a5b0d27a9ab3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Sep 2022 17:18:47 +0100 Subject: [PATCH 3/8] 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](https://github.com/pmmp/DevTools/compare/bd0fa048dae29bebe25ba76d8c58788e92418b67...95921c6d877cbe07921a20bcca436db76b0d8bda) --- updated-dependencies: - dependency-name: tests/plugins/DevTools dependency-type: direct:production ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- tests/plugins/DevTools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plugins/DevTools b/tests/plugins/DevTools index bd0fa048d..95921c6d8 160000 --- a/tests/plugins/DevTools +++ b/tests/plugins/DevTools @@ -1 +1 @@ -Subproject commit bd0fa048dae29bebe25ba76d8c58788e92418b67 +Subproject commit 95921c6d877cbe07921a20bcca436db76b0d8bda From e2f1b10165aeef246516ef2a7585ed43aa0f0785 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Sep 2022 17:18:58 +0100 Subject: [PATCH 4/8] 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] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.lock | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index 51710b868..71e413d01 100644 --- a/composer.lock +++ b/composer.lock @@ -1983,16 +1983,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.24", + "version": "9.5.25", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5" + "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", - "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", + "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", "shasum": "" }, "require": { @@ -2014,14 +2014,14 @@ "phpunit/php-timer": "^5.0.2", "sebastian/cli-parser": "^1.0.1", "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", + "sebastian/comparator": "^4.0.8", "sebastian/diff": "^4.0.3", "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.3", + "sebastian/exporter": "^4.0.5", "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.1", + "sebastian/type": "^3.2", "sebastian/version": "^3.0.2" }, "suggest": { @@ -2065,7 +2065,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.24" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.25" }, "funding": [ { @@ -2075,9 +2075,13 @@ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "time": "2022-08-30T07:42:16+00:00" + "time": "2022-09-25T03:44:45+00:00" }, { "name": "sebastian/cli-parser", From 5e5661de75b1ed2991f221c1d11a744071461034 Mon Sep 17 00:00:00 2001 From: IvanCraft623 <57236932+IvanCraft623@users.noreply.github.com> Date: Tue, 27 Sep 2022 11:21:55 -0500 Subject: [PATCH 5/8] Play burp sound when consuming a FoodSource (#5158) --- src/entity/Living.php | 4 ++++ src/world/sound/BurpSound.php | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/world/sound/BurpSound.php diff --git a/src/entity/Living.php b/src/entity/Living.php index 1d597715c..58b7c1791 100644 --- a/src/entity/Living.php +++ b/src/entity/Living.php @@ -56,6 +56,7 @@ use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties; use pocketmine\player\Player; use pocketmine\timings\Timings; use pocketmine\utils\Binary; +use pocketmine\world\sound\BurpSound; use pocketmine\world\sound\EntityLandSound; use pocketmine\world\sound\EntityLongFallSound; use pocketmine\world\sound\EntityShortFallSound; @@ -320,6 +321,9 @@ abstract class Living extends Entity{ foreach($consumable->getAdditionalEffects() as $effect){ $this->effectManager->add($effect); } + if($consumable instanceof FoodSource){ + $this->broadcastSound(new BurpSound()); + } $consumable->onConsume($this); } diff --git a/src/world/sound/BurpSound.php b/src/world/sound/BurpSound.php new file mode 100644 index 000000000..a4467f71d --- /dev/null +++ b/src/world/sound/BurpSound.php @@ -0,0 +1,35 @@ + Date: Tue, 27 Sep 2022 18:13:59 +0100 Subject: [PATCH 6/8] CONTRIBUTING: added a table of what types of changes are accepted by what branches --- CONTRIBUTING.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 745f89cba..84c5ec297 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,6 +18,32 @@ Larger contributions like feature additions should be preceded by a [Change Prop ## Other things you'll need - [git](https://git-scm.com/) +## Choosing a target branch +PocketMine-MP has three primary branches of development. + +| 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. From ed7c95549d80f6ed750d4b95bb45282a26ee7604 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 27 Sep 2022 21:08:31 +0100 Subject: [PATCH 7/8] 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. --- .../mcpe/handler/PreSpawnPacketHandler.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/network/mcpe/handler/PreSpawnPacketHandler.php b/src/network/mcpe/handler/PreSpawnPacketHandler.php index f9ff35808..2814dba4e 100644 --- a/src/network/mcpe/handler/PreSpawnPacketHandler.php +++ b/src/network/mcpe/handler/PreSpawnPacketHandler.php @@ -61,6 +61,7 @@ class PreSpawnPacketHandler extends PacketHandler{ public function setUp() : void{ $location = $this->player->getLocation(); + $this->session->getLogger()->debug("Preparing StartGamePacket"); $levelSettings = new LevelSettings(); $levelSettings->seed = -1; $levelSettings->spawnSettings = new SpawnSettings(SpawnSettings::BIOME_TYPE_DEFAULT, "", DimensionIds::OVERWORLD); //TODO: implement this properly @@ -104,22 +105,39 @@ class PreSpawnPacketHandler extends PacketHandler{ GlobalItemTypeDictionary::getInstance()->getDictionary()->getEntries(), )); + $this->session->getLogger()->debug("Sending actor identifiers"); $this->session->sendDataPacket(StaticPacketCache::getInstance()->getAvailableActorIdentifiers()); + + $this->session->getLogger()->debug("Sending biome definitions"); $this->session->sendDataPacket(StaticPacketCache::getInstance()->getBiomeDefs()); + + $this->session->getLogger()->debug("Sending attributes"); $this->session->syncAttributes($this->player, $this->player->getAttributeMap()->getAll()); + + $this->session->getLogger()->debug("Sending available commands"); $this->session->syncAvailableCommands(); + + $this->session->getLogger()->debug("Sending abilities"); $this->session->syncAbilities($this->player); $this->session->syncAdventureSettings(); + + $this->session->getLogger()->debug("Sending effects"); foreach($this->player->getEffects()->all() as $effect){ $this->session->onEntityEffectAdded($this->player, $effect, false); } + + $this->session->getLogger()->debug("Sending actor metadata"); $this->player->sendData([$this->player]); + $this->session->getLogger()->debug("Sending inventory"); $this->inventoryManager->syncAll(); $this->inventoryManager->syncCreative(); $this->inventoryManager->syncSelectedHotbarSlot(); + + $this->session->getLogger()->debug("Sending crafting data"); $this->session->sendDataPacket(CraftingDataCache::getInstance()->getCache($this->server->getCraftingManager())); + $this->session->getLogger()->debug("Sending player list"); $this->session->syncPlayerList($this->server->getOnlinePlayers()); } From def2f8c1456cdafcf6aa8caa2f1dd6beba5deea0 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 28 Sep 2022 01:01:42 +0100 Subject: [PATCH 8/8] 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. --- src/network/mcpe/InventoryManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/mcpe/InventoryManager.php b/src/network/mcpe/InventoryManager.php index 7e7891c39..a9578cf67 100644 --- a/src/network/mcpe/InventoryManager.php +++ b/src/network/mcpe/InventoryManager.php @@ -259,7 +259,7 @@ class InventoryManager{ public function onClientRemoveWindow(int $id) : void{ if($id === $this->lastInventoryNetworkId){ - if($id !== $this->pendingCloseWindowId){ + if(isset($this->windowMap[$id]) && $id !== $this->pendingCloseWindowId){ $this->remove($id); $this->player->removeCurrentWindow(); }