From d4eb73abe91222303c5a164ab648929cc6bad7eb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:56:55 +0100 Subject: [PATCH 01/10] Bump phpstan/phpstan from 1.8.9 to 1.8.10 (#5351) Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.8.9 to 1.8.10. - [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.9...1.8.10) --- updated-dependencies: - dependency-name: phpstan/phpstan 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.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 5a1bcc362..cb177d5a2 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ "webmozart/path-util": "^2.3" }, "require-dev": { - "phpstan/phpstan": "1.8.9", + "phpstan/phpstan": "1.8.10", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.2.0", "phpunit/phpunit": "^9.2" diff --git a/composer.lock b/composer.lock index f4eff2983..9706506a5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c9763de398a3777e29ca6a29f86251a3", + "content-hash": "8b1a7f632168a8335e665e8f0ea7f95d", "packages": [ { "name": "adhocore/json-comment", @@ -1510,16 +1510,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.9", + "version": "1.8.10", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2" + "reference": "0c4459dc42c568b818b3f25186589f3acddc1823" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2", - "reference": "3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0c4459dc42c568b818b3f25186589f3acddc1823", + "reference": "0c4459dc42c568b818b3f25186589f3acddc1823", "shasum": "" }, "require": { @@ -1549,7 +1549,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.9" + "source": "https://github.com/phpstan/phpstan/tree/1.8.10" }, "funding": [ { @@ -1565,7 +1565,7 @@ "type": "tidelift" } ], - "time": "2022-10-13T13:40:18+00:00" + "time": "2022-10-17T14:23:35+00:00" }, { "name": "phpstan/phpstan-phpunit", From d74824c8d5e979d2c3147aabad54b41345dd5310 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 18 Oct 2022 19:34:12 +0100 Subject: [PATCH 02/10] Correctly use Command->getLabel() instead of Command->getName() getName() essentially serves as an ID for the command for CommandExecutors. It has no other sane use case. Since it's not unique (multiple commands with the same name may be registered, and the fallback alias will be used on conflict), it cannot be used for array indexing. It's also not correct to use it for any display purpose, since the command may not be able to be invoked by its 'name' if there was a conflict. There is an open debate about what to do with getName() and the wider CommandExecutor ecosystem, but that's a topic for another discussion. closes #5344 --- src/command/SimpleCommandMap.php | 2 +- src/command/defaults/HelpCommand.php | 6 +++--- src/network/mcpe/NetworkSession.php | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/command/SimpleCommandMap.php b/src/command/SimpleCommandMap.php index 5c33bf25a..bab101d5d 100644 --- a/src/command/SimpleCommandMap.php +++ b/src/command/SimpleCommandMap.php @@ -139,7 +139,7 @@ class SimpleCommandMap implements CommandMap{ public function register(string $fallbackPrefix, Command $command, ?string $label = null) : bool{ if($label === null){ - $label = $command->getName(); + $label = $command->getLabel(); } $label = trim($label); $fallbackPrefix = strtolower(trim($fallbackPrefix)); diff --git a/src/command/defaults/HelpCommand.php b/src/command/defaults/HelpCommand.php index 7fe12e039..3dc581838 100644 --- a/src/command/defaults/HelpCommand.php +++ b/src/command/defaults/HelpCommand.php @@ -80,7 +80,7 @@ class HelpCommand extends VanillaCommand{ $commands = []; foreach($sender->getServer()->getCommandMap()->getCommands() as $command){ if($command->testPermissionSilent($sender)){ - $commands[$command->getName()] = $command; + $commands[$command->getLabel()] = $command; } } ksort($commands, SORT_NATURAL | SORT_FLAG_CASE); @@ -95,7 +95,7 @@ class HelpCommand extends VanillaCommand{ foreach($commands[$pageNumber - 1] as $command){ $description = $command->getDescription(); $descriptionString = $description instanceof Translatable ? $lang->translate($description) : $description; - $sender->sendMessage(TextFormat::DARK_GREEN . "/" . $command->getName() . ": " . TextFormat::WHITE . $descriptionString); + $sender->sendMessage(TextFormat::DARK_GREEN . "/" . $command->getLabel() . ": " . TextFormat::WHITE . $descriptionString); } } @@ -106,7 +106,7 @@ class HelpCommand extends VanillaCommand{ $lang = $sender->getLanguage(); $description = $cmd->getDescription(); $descriptionString = $description instanceof Translatable ? $lang->translate($description) : $description; - $sender->sendMessage(KnownTranslationFactory::pocketmine_command_help_specificCommand_header($cmd->getName()) + $sender->sendMessage(KnownTranslationFactory::pocketmine_command_help_specificCommand_header($cmd->getLabel()) ->format(TextFormat::YELLOW . "--------- " . TextFormat::WHITE, TextFormat::YELLOW . " ---------")); $sender->sendMessage(KnownTranslationFactory::pocketmine_command_help_specificCommand_description(TextFormat::WHITE . $descriptionString) ->prefix(TextFormat::GOLD)); diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index ffd80e49d..5b090cc35 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -888,11 +888,11 @@ class NetworkSession{ public function syncAvailableCommands() : void{ $commandData = []; foreach($this->server->getCommandMap()->getCommands() as $name => $command){ - if(isset($commandData[$command->getName()]) || $command->getName() === "help" || !$command->testPermissionSilent($this->player)){ + if(isset($commandData[$command->getLabel()]) || $command->getLabel() === "help" || !$command->testPermissionSilent($this->player)){ continue; } - $lname = strtolower($command->getName()); + $lname = strtolower($command->getLabel()); $aliases = $command->getAliases(); $aliasObj = null; if(count($aliases) > 0){ @@ -900,7 +900,7 @@ class NetworkSession{ //work around a client bug which makes the original name not show when aliases are used $aliases[] = $lname; } - $aliasObj = new CommandEnum(ucfirst($command->getName()) . "Aliases", array_values($aliases)); + $aliasObj = new CommandEnum(ucfirst($command->getLabel()) . "Aliases", array_values($aliases)); } $description = $command->getDescription(); @@ -915,7 +915,7 @@ class NetworkSession{ ] ); - $commandData[$command->getName()] = $data; + $commandData[$command->getLabel()] = $data; } $this->sendDataPacket(AvailableCommandsPacket::create($commandData, [], [], [])); From 9a0ead6debba8501edcf9af0b556a2e704ce4dce Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 21 Oct 2022 14:28:22 +0100 Subject: [PATCH 03/10] Validate paths in --data and --plugins closes #2861 --- src/PocketMine.php | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/PocketMine.php b/src/PocketMine.php index faccb27e1..d3493f9f1 100644 --- a/src/PocketMine.php +++ b/src/PocketMine.php @@ -201,6 +201,24 @@ JIT_WARNING ini_set('assert.exception', '1'); } + function getopt_string(string $opt) : ?string{ + $opts = getopt("", ["$opt:"]); + if(isset($opts[$opt])){ + if(is_string($opts[$opt])){ + return $opts[$opt]; + } + if(is_array($opts[$opt])){ + critical_error("Cannot specify --$opt multiple times"); + exit(1); + } + if($opts[$opt] === false){ + critical_error("Missing value for --$opt"); + exit(1); + } + } + return null; + } + /** * @return void */ @@ -252,16 +270,22 @@ JIT_WARNING ErrorToExceptionHandler::set(); - $opts = getopt("", ["data:", "plugins:", "no-wizard", "enable-ansi", "disable-ansi"]); - $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; + $dataPath = getopt_string("data") ?? $cwd; + $pluginPath = getopt_string("plugins") ?? $cwd . DIRECTORY_SEPARATOR . "plugins"; Filesystem::addCleanedPath($pluginPath, Filesystem::CLEAN_PATH_PLUGINS_PREFIX); - if(!file_exists($dataPath)){ - mkdir($dataPath, 0777, true); + if(!@mkdir($dataPath, 0777, true) && (!is_dir($dataPath) || !is_writable($dataPath))){ + critical_error("Unable to create/access data directory at $dataPath. Check that the target location is accessible by the current user."); + exit(1); } + //this has to be done after we're sure the data path exists + $dataPath = realpath($dataPath) . DIRECTORY_SEPARATOR; + if(!@mkdir($pluginPath, 0777, true) && (!is_dir($pluginPath) || !is_writable($pluginPath))){ + critical_error("Unable to create plugin directory at $pluginPath. Check that the target location is accessible by the current user."); + exit(1); + } + $pluginPath = realpath($pluginPath) . DIRECTORY_SEPARATOR; $lockFilePath = Path::join($dataPath, 'server.lock'); if(($pid = Filesystem::createLockFile($lockFilePath)) !== null){ @@ -273,6 +297,7 @@ JIT_WARNING //Logger has a dependency on timezone Timezone::init(); + $opts = getopt("", ["no-wizard", "enable-ansi", "disable-ansi"]); if(isset($opts["enable-ansi"])){ Terminal::init(true); }elseif(isset($opts["disable-ansi"])){ From 6e4c62744ecb8108d61cba1861d1e464521df7bb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Oct 2022 19:55:01 +0100 Subject: [PATCH 04/10] Bump phpstan/phpstan from 1.8.10 to 1.8.11 (#5364) Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.8.10 to 1.8.11. - [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.10...1.8.11) --- updated-dependencies: - dependency-name: phpstan/phpstan 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.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index cb177d5a2..b8127fc1a 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ "webmozart/path-util": "^2.3" }, "require-dev": { - "phpstan/phpstan": "1.8.10", + "phpstan/phpstan": "1.8.11", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.2.0", "phpunit/phpunit": "^9.2" diff --git a/composer.lock b/composer.lock index 9706506a5..91ea1023b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8b1a7f632168a8335e665e8f0ea7f95d", + "content-hash": "99192d8900b36c33ceaa78025ab98ad3", "packages": [ { "name": "adhocore/json-comment", @@ -1510,16 +1510,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.10", + "version": "1.8.11", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0c4459dc42c568b818b3f25186589f3acddc1823" + "reference": "46e223dd68a620da18855c23046ddb00940b4014" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0c4459dc42c568b818b3f25186589f3acddc1823", - "reference": "0c4459dc42c568b818b3f25186589f3acddc1823", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/46e223dd68a620da18855c23046ddb00940b4014", + "reference": "46e223dd68a620da18855c23046ddb00940b4014", "shasum": "" }, "require": { @@ -1549,7 +1549,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.10" + "source": "https://github.com/phpstan/phpstan/tree/1.8.11" }, "funding": [ { @@ -1565,7 +1565,7 @@ "type": "tidelift" } ], - "time": "2022-10-17T14:23:35+00:00" + "time": "2022-10-24T15:45:13+00:00" }, { "name": "phpstan/phpstan-phpunit", From a9361b3f8b465d7bfb94b66c3111662dc5b1c8bd Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 25 Oct 2022 23:08:39 +0100 Subject: [PATCH 05/10] Changes for 1.19.40 --- composer.json | 4 +-- composer.lock | 28 ++++++++++----------- src/entity/Entity.php | 2 ++ src/entity/Human.php | 2 ++ src/network/mcpe/NetworkSession.php | 3 ++- src/world/particle/FloatingTextParticle.php | 2 ++ 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index b8127fc1a..397c2cc71 100644 --- a/composer.json +++ b/composer.json @@ -34,8 +34,8 @@ "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/bedrock-data": "~1.12.0+bedrock-1.19.40", + "pocketmine/bedrock-protocol": "~14.0.0+bedrock-1.19.40", "pocketmine/binaryutils": "^0.2.1", "pocketmine/callback-validator": "^1.0.2", "pocketmine/classloader": "^0.2.0", diff --git a/composer.lock b/composer.lock index 91ea1023b..e9f66ddd1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "99192d8900b36c33ceaa78025ab98ad3", + "content-hash": "ed062ef1dc3113ad2a75ba4d4d5e174f", "packages": [ { "name": "adhocore/json-comment", @@ -249,16 +249,16 @@ }, { "name": "pocketmine/bedrock-data", - "version": "1.11.1+bedrock-1.19.30", + "version": "1.12.0+bedrock-1.19.40", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockData.git", - "reference": "9ec9a9645ba19f04dd4e39d6d9bd30b562dfe90c" + "reference": "32690f1dac05608b558fe7c40b6d634772c8e416" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/9ec9a9645ba19f04dd4e39d6d9bd30b562dfe90c", - "reference": "9ec9a9645ba19f04dd4e39d6d9bd30b562dfe90c", + "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/32690f1dac05608b558fe7c40b6d634772c8e416", + "reference": "32690f1dac05608b558fe7c40b6d634772c8e416", "shasum": "" }, "type": "library", @@ -269,22 +269,22 @@ "description": "Blobs of data generated from Minecraft: Bedrock Edition, used by PocketMine-MP", "support": { "issues": "https://github.com/pmmp/BedrockData/issues", - "source": "https://github.com/pmmp/BedrockData/tree/1.11.1+bedrock-1.19.30" + "source": "https://github.com/pmmp/BedrockData/tree/bedrock-1.19.40" }, - "time": "2022-09-27T22:00:01+00:00" + "time": "2022-10-25T21:45:24+00:00" }, { "name": "pocketmine/bedrock-protocol", - "version": "13.0.0+bedrock-1.19.30", + "version": "14.0.0+bedrock-1.19.40", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockProtocol.git", - "reference": "94de2221676ca717587e1ff4e45445c24ada1749" + "reference": "b455a742779fee94d25f931cc2cbf6b2c5d61c1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/94de2221676ca717587e1ff4e45445c24ada1749", - "reference": "94de2221676ca717587e1ff4e45445c24ada1749", + "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/b455a742779fee94d25f931cc2cbf6b2c5d61c1f", + "reference": "b455a742779fee94d25f931cc2cbf6b2c5d61c1f", "shasum": "" }, "require": { @@ -298,7 +298,7 @@ "ramsey/uuid": "^4.1" }, "require-dev": { - "phpstan/phpstan": "1.8.0", + "phpstan/phpstan": "1.8.8", "phpstan/phpstan-phpunit": "^1.0.0", "phpstan/phpstan-strict-rules": "^1.0.0", "phpunit/phpunit": "^9.5" @@ -316,9 +316,9 @@ "description": "An implementation of the Minecraft: Bedrock Edition protocol in PHP", "support": { "issues": "https://github.com/pmmp/BedrockProtocol/issues", - "source": "https://github.com/pmmp/BedrockProtocol/tree/bedrock-1.19.30" + "source": "https://github.com/pmmp/BedrockProtocol/tree/bedrock-1.19.40" }, - "time": "2022-09-20T18:35:00+00:00" + "time": "2022-10-25T21:51:46+00:00" }, { "name": "pocketmine/binaryutils", diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 54873f9f1..be44a0433 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -52,6 +52,7 @@ use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection; use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataFlags; use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties; use pocketmine\network\mcpe\protocol\types\entity\MetadataProperty; +use pocketmine\network\mcpe\protocol\types\entity\PropertySyncData; use pocketmine\player\Player; use pocketmine\Server; use pocketmine\timings\Timings; @@ -1469,6 +1470,7 @@ abstract class Entity{ return new NetworkAttribute($attr->getId(), $attr->getMinValue(), $attr->getMaxValue(), $attr->getValue(), $attr->getDefaultValue(), []); }, $this->attributeMap->getAll()), $this->getAllNetworkData(), + new PropertySyncData([], []), [] //TODO: entity links )); } diff --git a/src/entity/Human.php b/src/entity/Human.php index ae323f0f8..095d3ea86 100644 --- a/src/entity/Human.php +++ b/src/entity/Human.php @@ -54,6 +54,7 @@ use pocketmine\network\mcpe\protocol\types\command\CommandPermissions; use pocketmine\network\mcpe\protocol\types\DeviceOS; use pocketmine\network\mcpe\protocol\types\entity\EntityIds; use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties; +use pocketmine\network\mcpe\protocol\types\entity\PropertySyncData; use pocketmine\network\mcpe\protocol\types\entity\StringMetadataProperty; use pocketmine\network\mcpe\protocol\types\GameMode; use pocketmine\network\mcpe\protocol\types\inventory\ItemStackWrapper; @@ -485,6 +486,7 @@ class Human extends Living implements ProjectileSource, InventoryHolder{ ItemStackWrapper::legacy(TypeConverter::getInstance()->coreItemStackToNet($this->getInventory()->getItemInHand())), GameMode::SURVIVAL, $this->getAllNetworkData(), + new PropertySyncData([], []), UpdateAbilitiesPacket::create(CommandPermissions::NORMAL, PlayerPermissions::VISITOR, $this->getId() /* TODO: this should be unique ID */, [ new UpdateAbilitiesPacketLayer( UpdateAbilitiesPacketLayer::LAYER_BASE, diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index 5b090cc35..dd8668637 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -97,6 +97,7 @@ use pocketmine\network\mcpe\protocol\types\command\CommandPermissions; use pocketmine\network\mcpe\protocol\types\DimensionIds; use pocketmine\network\mcpe\protocol\types\entity\Attribute as NetworkAttribute; use pocketmine\network\mcpe\protocol\types\entity\MetadataProperty; +use pocketmine\network\mcpe\protocol\types\entity\PropertySyncData; use pocketmine\network\mcpe\protocol\types\inventory\ContainerIds; use pocketmine\network\mcpe\protocol\types\inventory\ItemStackWrapper; use pocketmine\network\mcpe\protocol\types\PlayerListEntry; @@ -869,7 +870,7 @@ class NetworkSession{ //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)); + $this->sendDataPacket(SetActorDataPacket::create($entity->getId(), $properties, new PropertySyncData([], []), 0)); } public function onEntityEffectAdded(Living $entity, EffectInstance $effect, bool $replacesOldEffect) : void{ diff --git a/src/world/particle/FloatingTextParticle.php b/src/world/particle/FloatingTextParticle.php index 313e40d48..8797a7d5c 100644 --- a/src/world/particle/FloatingTextParticle.php +++ b/src/world/particle/FloatingTextParticle.php @@ -36,6 +36,7 @@ use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties; use pocketmine\network\mcpe\protocol\types\entity\FloatMetadataProperty; use pocketmine\network\mcpe\protocol\types\entity\IntMetadataProperty; use pocketmine\network\mcpe\protocol\types\entity\LongMetadataProperty; +use pocketmine\network\mcpe\protocol\types\entity\PropertySyncData; use pocketmine\network\mcpe\protocol\types\entity\StringMetadataProperty; class FloatingTextParticle implements Particle{ @@ -115,6 +116,7 @@ class FloatingTextParticle implements Particle{ 0, [], $actorMetadata, + new PropertySyncData([], []), [] ); } From 0d5287bf0bd7138113e1c154d3c3a3b83a407d82 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 26 Oct 2022 01:19:02 +0100 Subject: [PATCH 06/10] Release 4.10.0 --- changelogs/4.10.md | 14 ++++++++++++++ src/VersionInfo.php | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 changelogs/4.10.md diff --git a/changelogs/4.10.md b/changelogs/4.10.md new file mode 100644 index 000000000..8b27a6f09 --- /dev/null +++ b/changelogs/4.10.md @@ -0,0 +1,14 @@ +**For Minecraft: Bedrock Edition 1.19.40** + +### 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.10.0 +Released 26th October 2022. + +## General +- Added support for Minecraft: Bedrock Edition 1.19.40. +- Removed support for older versions. \ No newline at end of file diff --git a/src/VersionInfo.php b/src/VersionInfo.php index 83bf8f005..8a0728b09 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -31,8 +31,8 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; - public const BASE_VERSION = "4.9.2"; - public const IS_DEVELOPMENT_BUILD = true; + public const BASE_VERSION = "4.10.0"; + public const IS_DEVELOPMENT_BUILD = false; public const BUILD_CHANNEL = "stable"; private function __construct(){ From e4548da173f573566d8be26e4619a46d495fc5d3 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 26 Oct 2022 01:19:08 +0100 Subject: [PATCH 07/10] 4.10.1 is next --- src/VersionInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VersionInfo.php b/src/VersionInfo.php index 8a0728b09..ab7ac0b55 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -31,8 +31,8 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; - public const BASE_VERSION = "4.10.0"; - public const IS_DEVELOPMENT_BUILD = false; + public const BASE_VERSION = "4.10.1"; + public const IS_DEVELOPMENT_BUILD = true; public const BUILD_CHANNEL = "stable"; private function __construct(){ From fb31e6085e1a4694afc564845df323dbdf3fb419 Mon Sep 17 00:00:00 2001 From: "Eren A. Akyol" Date: Thu, 27 Oct 2022 01:26:55 +0300 Subject: [PATCH 08/10] StatusCommand: fix condition order for TPS colour (#5366) --- src/command/defaults/StatusCommand.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/command/defaults/StatusCommand.php b/src/command/defaults/StatusCommand.php index 7e5f9b544..0dca696d0 100644 --- a/src/command/defaults/StatusCommand.php +++ b/src/command/defaults/StatusCommand.php @@ -82,10 +82,10 @@ class StatusCommand extends VanillaCommand{ $sender->sendMessage(TextFormat::GOLD . "Uptime: " . TextFormat::RED . $uptime); $tpsColor = TextFormat::GREEN; - if($server->getTicksPerSecond() < 17){ - $tpsColor = TextFormat::GOLD; - }elseif($server->getTicksPerSecond() < 12){ + if($server->getTicksPerSecond() < 12){ $tpsColor = TextFormat::RED; + }elseif($server->getTicksPerSecond() < 17){ + $tpsColor = TextFormat::GOLD; } $sender->sendMessage(TextFormat::GOLD . "Current TPS: {$tpsColor}{$server->getTicksPerSecond()} ({$server->getTickUsage()}%)"); From 44af519cd6678ff600243d04e11d4280549525da Mon Sep 17 00:00:00 2001 From: jasonw_4331 Date: Sun, 30 Oct 2022 15:24:26 -0400 Subject: [PATCH 09/10] SpawnResponsePacketHandler: silence PlayerAuthInputPacket debug spam (#5368) --- src/network/mcpe/handler/SpawnResponsePacketHandler.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/network/mcpe/handler/SpawnResponsePacketHandler.php b/src/network/mcpe/handler/SpawnResponsePacketHandler.php index fae3597b8..554322af5 100644 --- a/src/network/mcpe/handler/SpawnResponsePacketHandler.php +++ b/src/network/mcpe/handler/SpawnResponsePacketHandler.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace pocketmine\network\mcpe\handler; +use pocketmine\network\mcpe\protocol\PlayerAuthInputPacket; use pocketmine\network\mcpe\protocol\SetLocalPlayerAsInitializedPacket; final class SpawnResponsePacketHandler extends PacketHandler{ @@ -35,4 +36,10 @@ final class SpawnResponsePacketHandler extends PacketHandler{ ($this->responseCallback)(); return true; } + + public function handlePlayerAuthInput(PlayerAuthInputPacket $packet) : bool{ + //the client will send this every tick once we start sending chunks, but we don't handle it in this stage + //this is very spammy so we filter it out + return true; + } } From 6da467b142bde1979035935872e0e07b94a6edec Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 31 Oct 2022 15:27:56 +0000 Subject: [PATCH 10/10] Updated composer dependencies --- composer.json | 2 +- composer.lock | 52 ++++++++++++++-------------- src/lang/KnownTranslationFactory.php | 8 +++++ src/lang/KnownTranslationKeys.php | 2 ++ 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/composer.json b/composer.json index 397c2cc71..9251a64b6 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ "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/locale-data": "~2.9.0", "pocketmine/log": "^0.4.0", "pocketmine/log-pthreads": "^0.4.0", "pocketmine/math": "^0.4.0", diff --git a/composer.lock b/composer.lock index e9f66ddd1..4814b9193 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ed062ef1dc3113ad2a75ba4d4d5e174f", + "content-hash": "0a402cad3151b4efa4f5da8034293b6d", "packages": [ { "name": "adhocore/json-comment", @@ -536,16 +536,16 @@ }, { "name": "pocketmine/locale-data", - "version": "2.8.7", + "version": "2.9.2", "source": { "type": "git", "url": "https://github.com/pmmp/Language.git", - "reference": "e115d3d64a508065f1cedad1be55528906308456" + "reference": "8813ffd2a4501521ca9433c534f3009f941de136" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/Language/zipball/e115d3d64a508065f1cedad1be55528906308456", - "reference": "e115d3d64a508065f1cedad1be55528906308456", + "url": "https://api.github.com/repos/pmmp/Language/zipball/8813ffd2a4501521ca9433c534f3009f941de136", + "reference": "8813ffd2a4501521ca9433c534f3009f941de136", "shasum": "" }, "type": "library", @@ -553,9 +553,9 @@ "description": "Language resources used by PocketMine-MP", "support": { "issues": "https://github.com/pmmp/Language/issues", - "source": "https://github.com/pmmp/Language/tree/2.8.7" + "source": "https://github.com/pmmp/Language/tree/2.9.2" }, - "time": "2022-08-21T20:37:16+00:00" + "time": "2022-10-21T20:30:38+00:00" }, { "name": "pocketmine/log", @@ -1569,21 +1569,21 @@ }, { "name": "phpstan/phpstan-phpunit", - "version": "1.1.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "4a3c437c09075736285d1cabb5c75bf27ed0bc84" + "reference": "dea1f87344c6964c607d9076dee42d891f3923f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/4a3c437c09075736285d1cabb5c75bf27ed0bc84", - "reference": "4a3c437c09075736285d1cabb5c75bf27ed0bc84", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/dea1f87344c6964c607d9076dee42d891f3923f0", + "reference": "dea1f87344c6964c607d9076dee42d891f3923f0", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.5.0" + "phpstan/phpstan": "^1.8.11" }, "conflict": { "phpunit/phpunit": "<7.0" @@ -1615,9 +1615,9 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.1.1" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.2.2" }, - "time": "2022-04-20T15:24:25+00:00" + "time": "2022-10-28T10:23:07+00:00" }, { "name": "phpstan/phpstan-strict-rules", @@ -1669,16 +1669,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.17", + "version": "9.2.18", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" + "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", - "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/12fddc491826940cf9b7e88ad9664cf51f0f6d0a", + "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a", "shasum": "" }, "require": { @@ -1734,7 +1734,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.18" }, "funding": [ { @@ -1742,7 +1742,7 @@ "type": "github" } ], - "time": "2022-08-30T12:24:04+00:00" + "time": "2022-10-27T13:35:33+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1987,16 +1987,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.25", + "version": "9.5.26", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d" + "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", - "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/851867efcbb6a1b992ec515c71cdcf20d895e9d2", + "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2", "shasum": "" }, "require": { @@ -2069,7 +2069,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.25" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.26" }, "funding": [ { @@ -2085,7 +2085,7 @@ "type": "tidelift" } ], - "time": "2022-09-25T03:44:45+00:00" + "time": "2022-10-28T06:00:21+00:00" }, { "name": "sebastian/cli-parser", diff --git a/src/lang/KnownTranslationFactory.php b/src/lang/KnownTranslationFactory.php index c7f4a4242..577c125fa 100644 --- a/src/lang/KnownTranslationFactory.php +++ b/src/lang/KnownTranslationFactory.php @@ -743,6 +743,10 @@ final class KnownTranslationFactory{ return new Translatable(KnownTranslationKeys::DISCONNECTIONSCREEN_SERVERFULL, []); } + public static function effect_darkness() : Translatable{ + return new Translatable(KnownTranslationKeys::EFFECT_DARKNESS, []); + } + public static function enchantment_arrowDamage() : Translatable{ return new Translatable(KnownTranslationKeys::ENCHANTMENT_ARROWDAMAGE, []); } @@ -1393,6 +1397,10 @@ final class KnownTranslationFactory{ return new Translatable(KnownTranslationKeys::POCKETMINE_COMMAND_UNBAN_PLAYER_DESCRIPTION, []); } + public static function pocketmine_command_userDefined_description() : Translatable{ + return new Translatable(KnownTranslationKeys::POCKETMINE_COMMAND_USERDEFINED_DESCRIPTION, []); + } + public static function pocketmine_command_version_description() : Translatable{ return new Translatable(KnownTranslationKeys::POCKETMINE_COMMAND_VERSION_DESCRIPTION, []); } diff --git a/src/lang/KnownTranslationKeys.php b/src/lang/KnownTranslationKeys.php index 9a9e91d39..87f88515d 100644 --- a/src/lang/KnownTranslationKeys.php +++ b/src/lang/KnownTranslationKeys.php @@ -160,6 +160,7 @@ final class KnownTranslationKeys{ public const DISCONNECTIONSCREEN_OUTDATEDSERVER = "disconnectionScreen.outdatedServer"; public const DISCONNECTIONSCREEN_RESOURCEPACK = "disconnectionScreen.resourcePack"; public const DISCONNECTIONSCREEN_SERVERFULL = "disconnectionScreen.serverFull"; + public const EFFECT_DARKNESS = "effect.darkness"; public const ENCHANTMENT_ARROWDAMAGE = "enchantment.arrowDamage"; public const ENCHANTMENT_ARROWFIRE = "enchantment.arrowFire"; public const ENCHANTMENT_ARROWINFINITE = "enchantment.arrowInfinite"; @@ -306,6 +307,7 @@ final class KnownTranslationKeys{ public const POCKETMINE_COMMAND_TRANSFERSERVER_USAGE = "pocketmine.command.transferserver.usage"; public const POCKETMINE_COMMAND_UNBAN_IP_DESCRIPTION = "pocketmine.command.unban.ip.description"; public const POCKETMINE_COMMAND_UNBAN_PLAYER_DESCRIPTION = "pocketmine.command.unban.player.description"; + public const POCKETMINE_COMMAND_USERDEFINED_DESCRIPTION = "pocketmine.command.userDefined.description"; public const POCKETMINE_COMMAND_VERSION_DESCRIPTION = "pocketmine.command.version.description"; public const POCKETMINE_COMMAND_VERSION_MINECRAFTVERSION = "pocketmine.command.version.minecraftVersion"; public const POCKETMINE_COMMAND_VERSION_NOSUCHPLUGIN = "pocketmine.command.version.noSuchPlugin";