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/composer.json b/composer.json index b7d7e3b18..f5987dc5a 100644 --- a/composer.json +++ b/composer.json @@ -37,13 +37,13 @@ "pocketmine/bedrock-block-upgrade-schema": "dev-master@dev", "pocketmine/bedrock-data": "dev-modern-world-support@dev", "pocketmine/bedrock-item-upgrade-schema": "dev-master", - "pocketmine/bedrock-protocol": "~13.0.0+bedrock-1.19.30", + "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", "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", @@ -55,7 +55,7 @@ "symfony/filesystem": "^5.4" }, "require-dev": { - "phpstan/phpstan": "1.8.9", + "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 335e02a33..3b0ce6b72 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": "1053875fbf22e06a28c612aae6aa5c6b", + "content-hash": "7f8f55d50d24b3274d23b26d8a44181f", "packages": [ { "name": "adhocore/json-comment", @@ -280,12 +280,12 @@ "source": { "type": "git", "url": "https://github.com/pmmp/BedrockData.git", - "reference": "e6a51075e600b0494f8fb57574c4b0e77c344475" + "reference": "74fbcebae366b31f4a97bbf39ebb99be632f17a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/e6a51075e600b0494f8fb57574c4b0e77c344475", - "reference": "e6a51075e600b0494f8fb57574c4b0e77c344475", + "url": "https://api.github.com/repos/pmmp/BedrockData/zipball/74fbcebae366b31f4a97bbf39ebb99be632f17a0", + "reference": "74fbcebae366b31f4a97bbf39ebb99be632f17a0", "shasum": "" }, "type": "library", @@ -298,7 +298,7 @@ "issues": "https://github.com/pmmp/BedrockData/issues", "source": "https://github.com/pmmp/BedrockData/tree/modern-world-support" }, - "time": "2022-09-28T20:32:25+00:00" + "time": "2022-10-31T19:07:33+00:00" }, { "name": "pocketmine/bedrock-item-upgrade-schema", @@ -329,16 +329,16 @@ }, { "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": { @@ -352,7 +352,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" @@ -370,9 +370,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", @@ -590,16 +590,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", @@ -607,9 +607,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", @@ -1767,16 +1767,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.9", + "version": "1.8.11", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2" + "reference": "46e223dd68a620da18855c23046ddb00940b4014" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2", - "reference": "3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/46e223dd68a620da18855c23046ddb00940b4014", + "reference": "46e223dd68a620da18855c23046ddb00940b4014", "shasum": "" }, "require": { @@ -1806,7 +1806,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.11" }, "funding": [ { @@ -1822,25 +1822,25 @@ "type": "tidelift" } ], - "time": "2022-10-13T13:40:18+00:00" + "time": "2022-10-24T15:45:13+00:00" }, { "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" @@ -1872,9 +1872,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", @@ -1926,16 +1926,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": { @@ -1991,7 +1991,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": [ { @@ -1999,7 +1999,7 @@ "type": "github" } ], - "time": "2022-08-30T12:24:04+00:00" + "time": "2022-10-27T13:35:33+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2244,16 +2244,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": { @@ -2326,7 +2326,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": [ { @@ -2342,7 +2342,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/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"])){ diff --git a/src/command/SimpleCommandMap.php b/src/command/SimpleCommandMap.php index 858cf4575..8a9a2aa06 100644 --- a/src/command/SimpleCommandMap.php +++ b/src/command/SimpleCommandMap.php @@ -140,7 +140,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 3f440be29..b8903fec3 100644 --- a/src/command/defaults/HelpCommand.php +++ b/src/command/defaults/HelpCommand.php @@ -76,7 +76,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); @@ -91,7 +91,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::RESET . $descriptionString); + $sender->sendMessage(TextFormat::DARK_GREEN . "/" . $command->getLabel() . ": " . TextFormat::RESET . $descriptionString); } } @@ -102,7 +102,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::RESET, TextFormat::YELLOW . " ---------")); $sender->sendMessage(KnownTranslationFactory::pocketmine_command_help_specificCommand_description(TextFormat::RESET . $descriptionString) ->prefix(TextFormat::GOLD)); diff --git a/src/command/defaults/StatusCommand.php b/src/command/defaults/StatusCommand.php index 7f5b0766b..15a603297 100644 --- a/src/command/defaults/StatusCommand.php +++ b/src/command/defaults/StatusCommand.php @@ -78,10 +78,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()}%)"); diff --git a/src/crafting/CraftingManagerFromDataHelper.php b/src/crafting/CraftingManagerFromDataHelper.php index 6b0dd1929..c07182523 100644 --- a/src/crafting/CraftingManagerFromDataHelper.php +++ b/src/crafting/CraftingManagerFromDataHelper.php @@ -52,6 +52,9 @@ use function json_decode; final class CraftingManagerFromDataHelper{ private static function deserializeIngredient(RecipeIngredientData $data) : ?RecipeIngredient{ + if(!isset($data->name)){ + return null; //TODO: not yet implemented + } if(isset($data->count) && $data->count !== 1){ //every case we've seen so far where this isn't the case, it's been a bug and the count was ignored anyway //e.g. gold blocks crafted from 9 ingots, but each input item individually had a count of 9 diff --git a/src/entity/Entity.php b/src/entity/Entity.php index b4e2ca8de..520ff782b 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; @@ -1448,6 +1449,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 bf1724d69..cc48ad731 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; @@ -468,6 +469,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/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"; diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index 5b36c0b06..2b87f7ea3 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -98,6 +98,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; @@ -880,7 +881,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{ @@ -899,11 +900,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){ @@ -911,7 +912,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(); @@ -926,7 +927,7 @@ class NetworkSession{ ] ); - $commandData[$command->getName()] = $data; + $commandData[$command->getLabel()] = $data; } $this->sendDataPacket(AvailableCommandsPacket::create($commandData, [], [], [])); 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; + } } diff --git a/src/world/particle/FloatingTextParticle.php b/src/world/particle/FloatingTextParticle.php index 811d2ddac..e7766470f 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{ @@ -109,6 +110,7 @@ class FloatingTextParticle implements Particle{ 0, [], $actorMetadata, + new PropertySyncData([], []), [] ); }