diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 274fdcdcf..71566601e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,11 +13,11 @@ jobs: strategy: matrix: image: [ubuntu-20.04] - php: [8.0.14] + php: [8.0.16] steps: - name: Build and prepare PHP cache - uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636 + uses: pmmp/setup-php-action@aa636a4fe0c1c035fd9a3f05e360eadd86e06440 with: php-version: ${{ matrix.php }} install-path: "./bin" @@ -31,13 +31,13 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: [8.0.14] + php: [8.0.16] steps: - uses: actions/checkout@v2 - name: Setup PHP - uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636 + uses: pmmp/setup-php-action@aa636a4fe0c1c035fd9a3f05e360eadd86e06440 with: php-version: ${{ matrix.php }} install-path: "./bin" @@ -69,13 +69,13 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: [8.0.14] + php: [8.0.16] steps: - uses: actions/checkout@v2 - name: Setup PHP - uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636 + uses: pmmp/setup-php-action@aa636a4fe0c1c035fd9a3f05e360eadd86e06440 with: php-version: ${{ matrix.php }} install-path: "./bin" @@ -107,7 +107,7 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: [8.0.14] + php: [8.0.16] steps: - uses: actions/checkout@v2 @@ -115,7 +115,7 @@ jobs: submodules: true - name: Setup PHP - uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636 + uses: pmmp/setup-php-action@aa636a4fe0c1c035fd9a3f05e360eadd86e06440 with: php-version: ${{ matrix.php }} install-path: "./bin" @@ -147,13 +147,13 @@ jobs: fail-fast: false matrix: image: [ubuntu-20.04] - php: [8.0.14] + php: [8.0.16] steps: - uses: actions/checkout@v2 - name: Setup PHP - uses: pmmp/setup-php-action@e232f72a4330a07aae8418e8aa56b64efcdda636 + uses: pmmp/setup-php-action@aa636a4fe0c1c035fd9a3f05e360eadd86e06440 with: php-version: ${{ matrix.php }} install-path: "./bin" diff --git a/changelogs/4.0.md b/changelogs/4.0.md index b7b66c4a4..08bc18f43 100644 --- a/changelogs/4.0.md +++ b/changelogs/4.0.md @@ -413,6 +413,7 @@ However, if we add `src-namespace-prefix: pmmp\TesterPlugin` to the `plugin.yml` ### Command - The following classes have been removed: + - `PluginIdentifiableCommand` - use `PluginOwned` and `PluginOwnedTrait` - `RemoteConsoleCommandSender` - The following API methods have signature changes: - `Command->setPermission()` argument is now mandatory (but still nullable). @@ -1054,6 +1055,7 @@ However, if we add `src-namespace-prefix: pmmp\TesterPlugin` to the `plugin.yml` - `Player->addWindow()`: use `Player->setCurrentWindow()` instead - `Player->dataPacket()`: replaced by `NetworkSession->sendDataPacket()` - `Player->getAddress()`: replaced by `NetworkSession->getIp()` + - `Player->getClientId()`: the client ID can be found in `PlayerInfo->getExtraData()` - `Player->getPing()`: moved to `NetworkSession` - `Player->getPort()`: moved to `NetworkSession` - `Player->getWindow()`: use `Player->getCurrentWindow()` instead @@ -1069,6 +1071,8 @@ However, if we add `src-namespace-prefix: pmmp\TesterPlugin` to the `plugin.yml` - API version checks are now more strict. It is no longer legal to declare multiple minimum versions on the same major version. Doing so will now cause the plugin to fail to load with the message `Multiple minimum API versions found for some major versions`. - `plugin.yml` YAML commands loading is now internalized inside `PluginBase`. - `PluginManager->registerEvent()` now has a simpler signature: `registerEvent(string $event, \Closure $handler, int $priority, Plugin $plugin, bool $handleCancelled = false)`. The provided closure must accept the specified event class as its only parameter. See [Event API changes](#event) for more details. +- The following classes have been added: + - `PluginOwned` - The following classes have been removed: - `PluginLogger` - The following constants have been removed: diff --git a/src/block/Bed.php b/src/block/Bed.php index fd566bca3..9a487aa8f 100644 --- a/src/block/Bed.php +++ b/src/block/Bed.php @@ -166,7 +166,7 @@ class Bed extends Transparent{ } public function onNearbyBlockChange() : void{ - if(($other = $this->getOtherHalf()) !== null && $other->occupied !== $this->occupied){ + if(!$this->head && ($other = $this->getOtherHalf()) !== null && $other->occupied !== $this->occupied){ $this->occupied = $other->occupied; $this->position->getWorld()->setBlock($this->position, $this); } diff --git a/src/item/Item.php b/src/item/Item.php index a1b2a6eab..b490ac6b1 100644 --- a/src/item/Item.php +++ b/src/item/Item.php @@ -659,8 +659,9 @@ class Item implements \JsonSerializable{ ->setByte("Count", Binary::signByte($this->count)) ->setShort("Damage", $this->getMeta()); - if($this->hasNamedTag()){ - $result->setTag("tag", $this->getNamedTag()); + $tag = $this->getNamedTag(); + if($tag->count() > 0){ + $result->setTag("tag", $tag); } if($slot !== -1){ diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index 3c97db45e..73be3bee5 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -124,12 +124,14 @@ use function count; use function get_class; use function in_array; use function json_encode; +use function ksort; use function strlen; use function strtolower; use function substr; use function time; use function ucfirst; use const JSON_THROW_ON_ERROR; +use const SORT_NUMERIC; class NetworkSession{ private \PrefixedLogger $logger; @@ -821,6 +823,9 @@ class NetworkSession{ * @phpstan-param array $properties */ public function syncActorData(Entity $entity, array $properties) : void{ + //TODO: HACK! as of 1.18.10, the client responds differently to the same data ordered in different orders - for + //example, sending HEIGHT in the list before FLAGS when unsetting the SWIMMING flag results in a hitbox glitch + ksort($properties, SORT_NUMERIC); $this->sendDataPacket(SetActorDataPacket::create($entity->getId(), $properties, 0)); } diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index 97d45ee89..dc2a5e468 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -90,8 +90,6 @@ use pocketmine\network\mcpe\protocol\SubClientLoginPacket; use pocketmine\network\mcpe\protocol\TextPacket; use pocketmine\network\mcpe\protocol\types\ActorEvent; use pocketmine\network\mcpe\protocol\types\BlockPosition; -use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties; -use pocketmine\network\mcpe\protocol\types\entity\FloatMetadataProperty; use pocketmine\network\mcpe\protocol\types\inventory\ContainerIds; use pocketmine\network\mcpe\protocol\types\inventory\MismatchTransactionData; use pocketmine\network\mcpe\protocol\types\inventory\NetworkInventoryAction; @@ -224,11 +222,6 @@ class InGamePacketHandler extends PacketHandler{ ($gliding !== null && !$this->player->toggleGlide($gliding)); if((bool) $mismatch){ $this->player->sendData([$this->player]); - }elseif($packet->hasFlag(PlayerAuthInputFlags::STOP_SWIMMING) || $packet->hasFlag(PlayerAuthInputFlags::STOP_GLIDING)){ - //TODO: HACK! workaround for a client bug where the AABB doesn't change back properly when stopping swimming or gliding - $this->player->sendData([$this->player], [ - EntityMetadataProperties::BOUNDING_BOX_HEIGHT => new FloatMetadataProperty($this->player->getSize()->getHeight()) - ]); } if($packet->hasFlag(PlayerAuthInputFlags::START_JUMPING)){