From 9fd1f198e2cf265ac7b60b956239dd1654124a21 Mon Sep 17 00:00:00 2001 From: Vuillamier Lilian <33796736+Virvolta@users.noreply.github.com> Date: Fri, 1 Dec 2023 19:51:28 +0100 Subject: [PATCH 01/10] add symply.yml config --- .gitignore | 1 + .idea/codeStyles/Project.xml | 83 ------------------- .idea/codeStyles/codeStyleConfig.xml | 5 -- .idea/fileTemplates/code/PHP Constructor.php | 8 -- .../code/PHP Fluent Setter Method.php | 6 -- .../fileTemplates/code/PHP Getter Method.php | 3 - .../fileTemplates/code/PHP Setter Method.php | 2 - .../includes/PHP Class Doc Comment.php | 0 .../includes/PHP File Header.php | 21 ----- .../includes/PHP Function Doc Comment.php | 5 -- .../includes/PHP Interface Doc Comment.php | 0 .../includes/PHP Property Doc Comment.php | 1 - .../includes/PHP Trait Doc Comment.php | 0 .idea/fileTemplates/internal/PHP Class.php | 10 --- .idea/fileTemplates/internal/PHP File.php | 4 - .../fileTemplates/internal/PHP Interface.php | 10 --- .idea/fileTemplates/internal/PHP Trait.php | 10 --- composer.json | 3 +- resources/symply.yml | 6 ++ src/Server.php | 6 ++ src/ServerConfigGroup.php | 17 ++++ src/crash/CrashDumpData.php | 4 + symply/YmlSymplyProperties.php | 18 ++++ 23 files changed, 54 insertions(+), 169 deletions(-) delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/fileTemplates/code/PHP Constructor.php delete mode 100644 .idea/fileTemplates/code/PHP Fluent Setter Method.php delete mode 100644 .idea/fileTemplates/code/PHP Getter Method.php delete mode 100644 .idea/fileTemplates/code/PHP Setter Method.php delete mode 100644 .idea/fileTemplates/includes/PHP Class Doc Comment.php delete mode 100644 .idea/fileTemplates/includes/PHP File Header.php delete mode 100644 .idea/fileTemplates/includes/PHP Function Doc Comment.php delete mode 100644 .idea/fileTemplates/includes/PHP Interface Doc Comment.php delete mode 100644 .idea/fileTemplates/includes/PHP Property Doc Comment.php delete mode 100644 .idea/fileTemplates/includes/PHP Trait Doc Comment.php delete mode 100644 .idea/fileTemplates/internal/PHP Class.php delete mode 100644 .idea/fileTemplates/internal/PHP File.php delete mode 100644 .idea/fileTemplates/internal/PHP Interface.php delete mode 100644 .idea/fileTemplates/internal/PHP Trait.php create mode 100644 resources/symply.yml create mode 100644 symply/YmlSymplyProperties.php diff --git a/.gitignore b/.gitignore index 13c3473764f..3a72c8c316e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ crashdumps/* *.phar server.properties /pocketmine.yml +/symply.yml /plugin_list.yml memory_dumps/* resource_packs/ diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 466a1a3a409..00000000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 79ee123c2b2..00000000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/fileTemplates/code/PHP Constructor.php b/.idea/fileTemplates/code/PHP Constructor.php deleted file mode 100644 index 0f6384d97e8..00000000000 --- a/.idea/fileTemplates/code/PHP Constructor.php +++ /dev/null @@ -1,8 +0,0 @@ -#if(${THROWS_DOC} != "") -/** -${THROWS_DOC} -*/ -#end -public function __construct(${PARAM_LIST}) { -${BODY} -} \ No newline at end of file diff --git a/.idea/fileTemplates/code/PHP Fluent Setter Method.php b/.idea/fileTemplates/code/PHP Fluent Setter Method.php deleted file mode 100644 index a46d3050472..00000000000 --- a/.idea/fileTemplates/code/PHP Fluent Setter Method.php +++ /dev/null @@ -1,6 +0,0 @@ -/** @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; -} diff --git a/.idea/fileTemplates/code/PHP Getter Method.php b/.idea/fileTemplates/code/PHP Getter Method.php deleted file mode 100644 index 4193590271e..00000000000 --- a/.idea/fileTemplates/code/PHP Getter Method.php +++ /dev/null @@ -1,3 +0,0 @@ -#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 } diff --git a/.idea/fileTemplates/code/PHP Setter Method.php b/.idea/fileTemplates/code/PHP Setter Method.php deleted file mode 100644 index 2ded807f6a0..00000000000 --- a/.idea/fileTemplates/code/PHP Setter Method.php +++ /dev/null @@ -1,2 +0,0 @@ -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} diff --git a/.idea/fileTemplates/includes/PHP Class Doc Comment.php b/.idea/fileTemplates/includes/PHP Class Doc Comment.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/.idea/fileTemplates/includes/PHP File Header.php b/.idea/fileTemplates/includes/PHP File Header.php deleted file mode 100644 index db6ec1e1339..00000000000 --- a/.idea/fileTemplates/includes/PHP File Header.php +++ /dev/null @@ -1,21 +0,0 @@ - -/* - * - * ____ _ _ __ __ _ __ __ ____ - * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ - * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | - * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ - * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| - * - * 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); \ No newline at end of file diff --git a/.idea/fileTemplates/includes/PHP Function Doc Comment.php b/.idea/fileTemplates/includes/PHP Function Doc Comment.php deleted file mode 100644 index 8b993824502..00000000000 --- a/.idea/fileTemplates/includes/PHP Function Doc Comment.php +++ /dev/null @@ -1,5 +0,0 @@ -#if (${THROWS_DOC} != "") -/** -${THROWS_DOC} -*/ -#end \ No newline at end of file diff --git a/.idea/fileTemplates/includes/PHP Interface Doc Comment.php b/.idea/fileTemplates/includes/PHP Interface Doc Comment.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/.idea/fileTemplates/includes/PHP Property Doc Comment.php b/.idea/fileTemplates/includes/PHP Property Doc Comment.php deleted file mode 100644 index 59487962820..00000000000 --- a/.idea/fileTemplates/includes/PHP Property Doc Comment.php +++ /dev/null @@ -1 +0,0 @@ -/** @var ${TYPE_HINT} */ diff --git a/.idea/fileTemplates/includes/PHP Trait Doc Comment.php b/.idea/fileTemplates/includes/PHP Trait Doc Comment.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/.idea/fileTemplates/internal/PHP Class.php b/.idea/fileTemplates/internal/PHP Class.php deleted file mode 100644 index dc7d13b6b61..00000000000 --- a/.idea/fileTemplates/internal/PHP Class.php +++ /dev/null @@ -1,10 +0,0 @@ -dataPath, "symply.yml"); + if (!file_exists($symplyYmlPath)) { + $content = Filesystem::fileGetContents(Path::join(\pocketmine\RESOURCE_PATH, "symply.yml")); + @file_put_contents($symplyYmlPath, $content); + } + $this->configGroup = new ServerConfigGroup( new Config($pocketmineYmlPath, Config::YAML, []), new Config(Path::join($this->dataPath, "server.properties"), Config::PROPERTIES, [ diff --git a/src/ServerConfigGroup.php b/src/ServerConfigGroup.php index b4a3a908713..740845c4ed5 100644 --- a/src/ServerConfigGroup.php +++ b/src/ServerConfigGroup.php @@ -40,6 +40,7 @@ final class ServerConfigGroup{ public function __construct( private Config $pocketmineYml, + private Config $symplyYml, private Config $serverProperties ){} @@ -56,6 +57,19 @@ public function getProperty(string $variable, mixed $defaultValue = null) : mixe return $this->propertyCache[$variable] ?? $defaultValue; } + public function getSymplyProperty(string $variable, mixed $defaultValue = null) : mixed{ + if(!array_key_exists($variable, $this->propertyCache)){ + $v = getopt("", ["$variable::"]); + if(isset($v[$variable])){ + $this->propertyCache[$variable] = $v[$variable]; + }else{ + $this->propertyCache[$variable] = $this->symplyYml->getNested($variable); + } + } + + return $this->propertyCache[$variable] ?? $defaultValue; + } + public function getPropertyBool(string $variable, bool $defaultValue) : bool{ return (bool) $this->getProperty($variable, $defaultValue); } @@ -131,5 +145,8 @@ public function save() : void{ if($this->pocketmineYml->hasChanged()){ $this->pocketmineYml->save(); } + if ($this->symplyYml->hasChanged()) { + $this->symplyYml->save(); + } } } diff --git a/src/crash/CrashDumpData.php b/src/crash/CrashDumpData.php index b71e6f405b2..a4ccef86907 100644 --- a/src/crash/CrashDumpData.php +++ b/src/crash/CrashDumpData.php @@ -62,6 +62,8 @@ final class CrashDumpData implements \JsonSerializable{ public string $pocketmineDotYml = ""; + public string $symplyDotYml = ""; + /** * @var string[] * @phpstan-var array @@ -81,7 +83,9 @@ public function jsonSerialize() : array{ $result = (array) $this; unset($result["serverDotProperties"]); unset($result["pocketmineDotYml"]); + unset($result["symply.yml"]); $result["pocketmine.yml"] = $this->pocketmineDotYml; + $result["symply.yml"] = $this->symplyDotYml; $result["server.properties"] = $this->serverDotProperties; return $result; } diff --git a/symply/YmlSymplyProperties.php b/symply/YmlSymplyProperties.php new file mode 100644 index 00000000000..cb33853ff30 --- /dev/null +++ b/symply/YmlSymplyProperties.php @@ -0,0 +1,18 @@ + Date: Sat, 2 Dec 2023 10:14:42 +0100 Subject: [PATCH 02/10] set to Symply name --- build/server-phar.php | 2 +- src/VersionInfo.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/server-phar.php b/build/server-phar.php index 0665c89d5d9..0521d428b98 100644 --- a/build/server-phar.php +++ b/build/server-phar.php @@ -148,7 +148,7 @@ function main() : void{ $build = 0; } foreach(buildPhar( - $opts["out"] ?? getcwd() . DIRECTORY_SEPARATOR . "PocketMine-MP.phar", + $opts["out"] ?? getcwd() . DIRECTORY_SEPARATOR . "Symply.phar", dirname(__DIR__) . DIRECTORY_SEPARATOR, [ 'resources', diff --git a/src/VersionInfo.php b/src/VersionInfo.php index e0f4ca4f388..fa4d236c863 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -30,10 +30,10 @@ use function str_repeat; final class VersionInfo{ - public const NAME = "PocketMine-MP"; + public const NAME = "Symply"; public const BASE_VERSION = "5.8.3"; public const IS_DEVELOPMENT_BUILD = true; - public const BUILD_CHANNEL = "stable"; + public const BUILD_CHANNEL = "0.1"; /** * PocketMine-MP-specific version ID for world data. Used to determine what fixes need to be applied to old world From 12c5d3936cd8eae90a1954b899d2a8d892e361dd Mon Sep 17 00:00:00 2001 From: Sensei Tarzan Date: Sat, 2 Dec 2023 18:56:53 +0100 Subject: [PATCH 03/10] add support native waterdogpe in symply and fix system symply.yml --- .gitignore | 1 + build/generate-symply-yml-property-consts.php | 126 +++++++++++++++ build/server-phar.php | 3 +- resources/symply.yml | 4 +- src/PocketMine.php | 1 - src/Server.php | 13 +- src/network/mcpe/NetworkSession.php | 7 +- .../mcpe/handler/LoginPacketHandler.php | 44 ++++-- start.sh | 4 +- symply/YmlSymplyProperties.php | 31 +++- symply/waterdogpe/WDPEClientData.php | 148 ++++++++++++++++++ .../WDPEClientDataAnimationFrame.php | 39 +++++ .../WDPEClientDataPersonaPieceTintColor.php | 29 ++++ .../WDPEClientDataPersonaSkinPiece.php | 35 +++++ .../WDPEClientDataToSkinDataHelper.php | 84 ++++++++++ symply/waterdogpe/WDPEPlayerInfo.php | 40 +++++ 16 files changed, 585 insertions(+), 24 deletions(-) create mode 100644 build/generate-symply-yml-property-consts.php create mode 100644 symply/waterdogpe/WDPEClientData.php create mode 100644 symply/waterdogpe/WDPEClientDataAnimationFrame.php create mode 100644 symply/waterdogpe/WDPEClientDataPersonaPieceTintColor.php create mode 100644 symply/waterdogpe/WDPEClientDataPersonaSkinPiece.php create mode 100644 symply/waterdogpe/WDPEClientDataToSkinDataHelper.php create mode 100644 symply/waterdogpe/WDPEPlayerInfo.php diff --git a/.gitignore b/.gitignore index 3a72c8c316e..aea6da2ecd3 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,4 @@ Documentation/* # php-cs-fixer /.php_cs.cache /.php-cs-fixer.cache +/server/ diff --git a/build/generate-symply-yml-property-consts.php b/build/generate-symply-yml-property-consts.php new file mode 100644 index 00000000000..e40ca481f1c --- /dev/null +++ b/build/generate-symply-yml-property-consts.php @@ -0,0 +1,126 @@ + $constants + * @phpstan-param-out array $constants + */ +function collectProperties(string $prefix, array $properties, array &$constants) : void{ + foreach($properties as $propertyName => $property){ + $fullPropertyName = ($prefix !== "" ? $prefix . "." : "") . $propertyName; + + $constName = str_replace([".", "-"], "_", strtoupper($fullPropertyName)); + $constants[$constName] = $fullPropertyName; + + if(is_array($property)){ + collectProperties($fullPropertyName, $property, $constants); + } + } +} + +collectProperties("", $defaultConfig, $constants); +ksort($constants, SORT_STRING); + +$file = fopen(dirname(__DIR__) . '/symply/YmlSymplyProperties.php', 'wb'); +if($file === false){ + fwrite(STDERR, "Failed to open output file\n"); + exit(1); +} +fwrite($file, " $propertyName){ + fwrite($file, "\tpublic const $constName = '$propertyName';\n"); +} +fwrite($file, "}\n"); + +fclose($file); + +echo "Done. Don't forget to run CS fixup after generating code.\n"; diff --git a/build/server-phar.php b/build/server-phar.php index 0521d428b98..d69589f60e4 100644 --- a/build/server-phar.php +++ b/build/server-phar.php @@ -153,7 +153,8 @@ function main() : void{ [ 'resources', 'src', - 'vendor' + 'vendor', + 'symply' ], [ 'git' => $gitHash, diff --git a/resources/symply.yml b/resources/symply.yml index d847f5ba982..e39a9168b90 100644 --- a/resources/symply.yml +++ b/resources/symply.yml @@ -3,4 +3,6 @@ # New settings/defaults won't appear automatically in this file when upgrading. # Allow the persona skin in your Symply server -persona-skin: true \ No newline at end of file +persona-skin: true +# Allow the support WaterDogPE in your Symply server +waterdogpe-support: false \ No newline at end of file diff --git a/src/PocketMine.php b/src/PocketMine.php index 296c21a897c..8fd515a158b 100644 --- a/src/PocketMine.php +++ b/src/PocketMine.php @@ -337,7 +337,6 @@ function server(){ */ $autoloader = new ThreadSafeClassLoader(); $autoloader->register(false); - new Server($autoloader, $logger, $dataPath, $pluginPath); $logger->info("Stopping other threads"); diff --git a/src/Server.php b/src/Server.php index 896a15222fd..5ef8000935d 100644 --- a/src/Server.php +++ b/src/Server.php @@ -122,6 +122,7 @@ use pocketmine\YmlServerProperties as Yml; use Ramsey\Uuid\UuidInterface; use Symfony\Component\Filesystem\Path; +use symply\YmlSymplyProperties; use function array_fill; use function array_sum; use function base64_encode; @@ -300,6 +301,7 @@ class Server{ * @phpstan-var array> */ private array $broadcastSubscribers = []; + private bool $waterdogeSupport= false; public function getName() : string{ return VersionInfo::NAME; @@ -346,7 +348,7 @@ public function getMaxPlayers() : int{ * are not logged into Xbox Live will be disconnected. */ public function getOnlineMode() : bool{ - return $this->onlineMode; + return !$this->waterdogeSupport && $this->onlineMode; } /** @@ -412,6 +414,10 @@ public function isHardcore() : bool{ return $this->configGroup->getConfigBool(ServerProperties::HARDCORE, false); } + public function isWaterdogepeSupport(): bool{ + return $this->waterdogeSupport; + } + public function getMotd() : string{ return $this->configGroup->getConfigString(ServerProperties::MOTD, self::DEFAULT_SERVER_NAME); } @@ -817,6 +823,7 @@ public function __construct( $this->configGroup = new ServerConfigGroup( new Config($pocketmineYmlPath, Config::YAML, []), + new Config($symplyYmlPath, Config::YAML, []), new Config(Path::join($this->dataPath, "server.properties"), Config::PROPERTIES, [ ServerProperties::MOTD => self::DEFAULT_SERVER_NAME, ServerProperties::SERVER_PORT_IPV4 => self::DEFAULT_PORT_IPV4, @@ -940,9 +947,9 @@ public function __construct( $this->banByIP->load(); $this->maxPlayers = $this->configGroup->getConfigInt(ServerProperties::MAX_PLAYERS, self::DEFAULT_MAX_PLAYERS); - + $this->waterdogeSupport = $this->configGroup->getSymplyProperty(YmlSymplyProperties::WATERDOGPE_SUPPORT, false); $this->onlineMode = $this->configGroup->getConfigBool(ServerProperties::XBOX_AUTH, true); - if($this->onlineMode){ + if($this->getOnlineMode()){ $this->logger->info($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_auth_enabled())); }else{ $this->logger->warning($this->getLanguage()->translate(KnownTranslationFactory::pocketmine_server_auth_disabled())); diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index 4f015263644..6c8c9a1a0e3 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -109,6 +109,7 @@ use pocketmine\utils\TextFormat; use pocketmine\world\Position; use pocketmine\YmlServerProperties; +use symply\waterdogpe\WDPEPlayerInfo; use function array_map; use function array_values; use function base64_encode; @@ -742,7 +743,7 @@ private function setAuthenticationStatus(bool $authenticated, bool $authRequired $this->logger->debug("Xbox Live authenticated: " . ($this->authenticated ? "YES" : "NO")); $checkXUID = $this->server->getConfigGroup()->getPropertyBool(YmlServerProperties::PLAYER_VERIFY_XUID, true); - $myXUID = $this->info instanceof XboxLivePlayerInfo ? $this->info->getXuid() : ""; + $myXUID = $this->info instanceof XboxLivePlayerInfo || $this->info instanceof WDPEPlayerInfo ? $this->info->getXuid() : ""; $kickForXUIDMismatch = function(string $xuid) use ($checkXUID, $myXUID) : bool{ if($checkXUID && $myXUID !== $xuid){ $this->logger->debug("XUID mismatch: expected '$xuid', but got '$myXUID'"); @@ -762,7 +763,7 @@ private function setAuthenticationStatus(bool $authenticated, bool $authRequired } $info = $existingSession->getPlayerInfo(); if($info !== null && (strcasecmp($info->getUsername(), $this->info->getUsername()) === 0 || $info->getUuid()->equals($this->info->getUuid()))){ - if($kickForXUIDMismatch($info instanceof XboxLivePlayerInfo ? $info->getXuid() : "")){ + if($kickForXUIDMismatch($info instanceof XboxLivePlayerInfo || $info instanceof WDPEPlayerInfo ? $info->getXuid() : "")){ return; } $ev = new PlayerDuplicateLoginEvent($this, $existingSession, KnownTranslationFactory::disconnectionScreen_loggedinOtherLocation(), null); @@ -780,7 +781,7 @@ private function setAuthenticationStatus(bool $authenticated, bool $authRequired //TODO: we shouldn't be loading player data here at all, but right now we don't have any choice :( $this->cachedOfflinePlayerData = $this->server->getOfflinePlayerData($this->info->getUsername()); if($checkXUID){ - $recordedXUID = $this->cachedOfflinePlayerData !== null ? $this->cachedOfflinePlayerData->getTag(Player::TAG_LAST_KNOWN_XUID) : null; + $recordedXUID = $this->cachedOfflinePlayerData?->getTag(Player::TAG_LAST_KNOWN_XUID); if(!($recordedXUID instanceof StringTag)){ $this->logger->debug("No previous XUID recorded, no choice but to trust this player"); }elseif(!$kickForXUIDMismatch($recordedXUID->getValue())){ diff --git a/src/network/mcpe/handler/LoginPacketHandler.php b/src/network/mcpe/handler/LoginPacketHandler.php index 9ac82bc5fef..81f5f5844fb 100644 --- a/src/network/mcpe/handler/LoginPacketHandler.php +++ b/src/network/mcpe/handler/LoginPacketHandler.php @@ -23,7 +23,9 @@ namespace pocketmine\network\mcpe\handler; +use InvalidArgumentException; use pocketmine\entity\InvalidSkinException; +use pocketmine\entity\Skin; use pocketmine\event\player\PlayerPreLoginEvent; use pocketmine\lang\KnownTranslationFactory; use pocketmine\lang\Translatable; @@ -42,6 +44,9 @@ use pocketmine\player\XboxLivePlayerInfo; use pocketmine\Server; use Ramsey\Uuid\Uuid; +use symply\waterdogpe\WDPEClientData; +use symply\waterdogpe\WDPEClientDataToSkinDataHelper; +use symply\waterdogpe\WDPEPlayerInfo; use function is_array; /** @@ -64,18 +69,16 @@ public function handleLogin(LoginPacket $packet) : bool{ if(!Player::isValidUserName($extraData->displayName)){ $this->session->disconnectWithError(KnownTranslationFactory::disconnectionScreen_invalidName()); - return true; } $clientData = $this->parseClientData($packet->clientDataJwt); try{ - $skin = $this->session->getTypeConverter()->getSkinAdapter()->fromSkinData(ClientDataToSkinDataHelper::fromClientData($clientData)); - }catch(\InvalidArgumentException | InvalidSkinException $e){ + $skin = $this->parseSkinInClientData($clientData); + }catch(InvalidArgumentException | InvalidSkinException $e){ $this->session->getLogger()->debug("Invalid skin: " . $e->getMessage()); $this->session->disconnectWithError(KnownTranslationFactory::disconnectionScreen_invalidSkin()); - return true; } @@ -84,9 +87,18 @@ public function handleLogin(LoginPacket $packet) : bool{ } $uuid = Uuid::fromString($extraData->identity); $arrClientData = (array) $clientData; - $arrClientData["TitleID"] = $extraData->titleId; - - if($extraData->XUID !== ""){ + $arrClientData["titleId"] = $extraData->titleId; + if ($clientData instanceof WDPEClientData){ + $playerInfo = new WDPEPlayerInfo( + $clientData->Waterdog_XUID, + $extraData->displayName, + $clientData->Waterdog_IP, + $uuid, + $skin, + $clientData->LanguageCode, + $arrClientData + ); + }else if($extraData->XUID !== ""){ $playerInfo = new XboxLivePlayerInfo( $extraData->XUID, $extraData->displayName, @@ -184,7 +196,7 @@ protected function fetchAuthData(JwtChain $chain) : AuthenticationData{ /** * @throws PacketHandlingException */ - protected function parseClientData(string $clientDataJwt) : ClientData{ + protected function parseClientData(string $clientDataJwt) : ClientData|WDPEClientData{ try{ [, $clientDataClaims, ] = JwtUtils::parse($clientDataJwt); }catch(JwtException $e){ @@ -196,18 +208,30 @@ protected function parseClientData(string $clientDataJwt) : ClientData{ $mapper->bExceptionOnMissingData = true; $mapper->bExceptionOnUndefinedProperty = true; try{ - $clientData = $mapper->map($clientDataClaims, new ClientData()); + $clientData = $mapper->map($clientDataClaims, $this->server->isWaterdogepeSupport() ? new WDPEClientData() : new ClientData()); }catch(\JsonMapper_Exception $e){ throw PacketHandlingException::wrap($e); } return $clientData; } + /** + * @param ClientData|WDPEClientData $clientData + * @return Skin + * @throws InvalidArgumentException|InvalidSkinException + */ + protected function parseSkinInClientData(ClientData|WDPEClientData $clientData): Skin{ + if ($clientData instanceof WDPEClientData){ + return $this->session->getTypeConverter()->getSkinAdapter()->fromSkinData(WDPEClientDataToSkinDataHelper::fromClientData($clientData)); + } + return $this->session->getTypeConverter()->getSkinAdapter()->fromSkinData(ClientDataToSkinDataHelper::fromClientData($clientData)); + } + /** * TODO: This is separated for the purposes of allowing plugins (like Specter) to hack it and bypass authentication. * In the future this won't be necessary. * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ protected function processLogin(LoginPacket $packet, bool $authRequired) : void{ $this->server->getAsyncPool()->submitTask(new ProcessLoginTask($packet->chainDataJwt->chain, $packet->clientDataJwt, $authRequired, $this->authCallback)); diff --git a/start.sh b/start.sh index 0121f3887bb..d6db8eaf00d 100755 --- a/start.sh +++ b/start.sh @@ -33,8 +33,8 @@ if [ "$PHP_BINARY" == "" ]; then fi if [ "$POCKETMINE_FILE" == "" ]; then - if [ -f ./PocketMine-MP.phar ]; then - POCKETMINE_FILE="./PocketMine-MP.phar" + if [ -f ./Symply.phar ]; then + POCKETMINE_FILE="./Symply.phar" else echo "PocketMine-MP.phar not found" echo "Downloads can be found at https://github.com/pmmp/PocketMine-MP/releases" diff --git a/symply/YmlSymplyProperties.php b/symply/YmlSymplyProperties.php index cb33853ff30..8c06f956811 100644 --- a/symply/YmlSymplyProperties.php +++ b/symply/YmlSymplyProperties.php @@ -1,5 +1,29 @@ + * + * BedrockProtocol 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. + */ + +declare(strict_types=1); + +namespace symply\waterdogpe; + +/** + * Model class for LoginPacket JSON data for JsonMapper + */ +final class WDPEClientDataAnimationFrame{ + + /** @required */ + public int $ImageHeight; + + /** @required */ + public int $ImageWidth; + + /** @required */ + public float $Frames; + + /** @required */ + public int $Type; + + /** @required */ + public string $Image; + + /** @required */ + public int $AnimationExpression; +} diff --git a/symply/waterdogpe/WDPEClientDataPersonaPieceTintColor.php b/symply/waterdogpe/WDPEClientDataPersonaPieceTintColor.php new file mode 100644 index 00000000000..bf94dad8cba --- /dev/null +++ b/symply/waterdogpe/WDPEClientDataPersonaPieceTintColor.php @@ -0,0 +1,29 @@ + + * + * BedrockProtocol 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. + */ + +declare(strict_types=1); + +namespace symply\waterdogpe; + +/** + * Model class for LoginPacket JSON data for JsonMapper + */ +final class WDPEClientDataPersonaPieceTintColor{ + /** @required */ + public string $PieceType; + + /** + * @var string[] + * @required + */ + public array $Colors; +} diff --git a/symply/waterdogpe/WDPEClientDataPersonaSkinPiece.php b/symply/waterdogpe/WDPEClientDataPersonaSkinPiece.php new file mode 100644 index 00000000000..c02c0936bc6 --- /dev/null +++ b/symply/waterdogpe/WDPEClientDataPersonaSkinPiece.php @@ -0,0 +1,35 @@ + + * + * BedrockProtocol 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. + */ + +declare(strict_types=1); + +namespace symply\waterdogpe; + +/** + * Model class for LoginPacket JSON data for JsonMapper + */ +final class WDPEClientDataPersonaSkinPiece{ + /** @required */ + public string $PieceId; + + /** @required */ + public string $PieceType; + + /** @required */ + public string $PackId; + + /** @required */ + public bool $IsDefault; + + /** @required */ + public string $ProductId; +} diff --git a/symply/waterdogpe/WDPEClientDataToSkinDataHelper.php b/symply/waterdogpe/WDPEClientDataToSkinDataHelper.php new file mode 100644 index 00000000000..adb4d8c1013 --- /dev/null +++ b/symply/waterdogpe/WDPEClientDataToSkinDataHelper.php @@ -0,0 +1,84 @@ + + * + * BedrockProtocol 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. + */ + +declare(strict_types=1); + +namespace symply\waterdogpe; + +use pocketmine\network\mcpe\protocol\types\skin\PersonaPieceTintColor; +use pocketmine\network\mcpe\protocol\types\skin\PersonaSkinPiece; +use pocketmine\network\mcpe\protocol\types\skin\SkinAnimation; +use pocketmine\network\mcpe\protocol\types\skin\SkinData; +use pocketmine\network\mcpe\protocol\types\skin\SkinImage; +use function array_map; +use function base64_decode; + +final class WDPEClientDataToSkinDataHelper{ + + /** + * @throws \InvalidArgumentException + */ + private static function safeB64Decode(string $base64, string $context) : string{ + $result = base64_decode($base64, true); + if($result === false){ + throw new \InvalidArgumentException("$context: Malformed base64, cannot be decoded"); + } + return $result; + } + + /** + * @throws \InvalidArgumentException + */ + public static function fromClientData(WDPEClientData $clientData) : SkinData{ + /** @var SkinAnimation[] $animations */ + $animations = []; + foreach($clientData->AnimatedImageData as $k => $animation){ + $animations[] = new SkinAnimation( + new SkinImage( + $animation->ImageHeight, + $animation->ImageWidth, + self::safeB64Decode($animation->Image, "AnimatedImageData.$k.Image") + ), + $animation->Type, + $animation->Frames, + $animation->AnimationExpression + ); + } + return new SkinData( + $clientData->SkinId, + $clientData->PlayFabId, + self::safeB64Decode($clientData->SkinResourcePatch, "SkinResourcePatch"), + new SkinImage($clientData->SkinImageHeight, $clientData->SkinImageWidth, self::safeB64Decode($clientData->SkinData, "SkinData")), + $animations, + new SkinImage($clientData->CapeImageHeight, $clientData->CapeImageWidth, self::safeB64Decode($clientData->CapeData, "CapeData")), + self::safeB64Decode($clientData->SkinGeometryData, "SkinGeometryData"), + self::safeB64Decode($clientData->SkinGeometryDataEngineVersion, "SkinGeometryDataEngineVersion"), //yes, they actually base64'd the version! + self::safeB64Decode($clientData->SkinAnimationData, "SkinAnimationData"), + $clientData->CapeId, + null, + $clientData->ArmSize, + $clientData->SkinColor, + array_map(function(WDPEClientDataPersonaSkinPiece $piece) : PersonaSkinPiece{ + return new PersonaSkinPiece($piece->PieceId, $piece->PieceType, $piece->PackId, $piece->IsDefault, $piece->ProductId); + }, $clientData->PersonaPieces), + array_map(function(WDPEClientDataPersonaPieceTintColor $tint) : PersonaPieceTintColor{ + return new PersonaPieceTintColor($tint->PieceType, $tint->Colors); + }, $clientData->PieceTintColors), + true, + $clientData->PremiumSkin, + $clientData->PersonaSkin, + $clientData->CapeOnClassicSkin, + true, //assume this is true? there's no field for it ... + $clientData->OverrideSkin ?? true, + ); + } +} diff --git a/symply/waterdogpe/WDPEPlayerInfo.php b/symply/waterdogpe/WDPEPlayerInfo.php new file mode 100644 index 00000000000..3b68ebaf74c --- /dev/null +++ b/symply/waterdogpe/WDPEPlayerInfo.php @@ -0,0 +1,40 @@ +xuid = $xuid; + $this->realIp = $realIp; + } + + public function getXuid() : string{ + return $this->xuid; + } + + public function getRealIp(): string{ + return $this->realIp; + } + + /** + * Returns a new PlayerInfo with XBL player info stripped. This is used to ensure that non-XBL players can't spoof + * XBL data. + */ + public function withoutXboxData() : PlayerInfo{ + return new PlayerInfo( + $this->getUsername(), + $this->getUuid(), + $this->getSkin(), + $this->getLocale(), + $this->getExtraData() + ); + } +} \ No newline at end of file From 18957c16c3aed9911adf38568f6bf3bbe607cf99 Mon Sep 17 00:00:00 2001 From: Sensei Tarzan Date: Sun, 3 Dec 2023 01:24:26 +0100 Subject: [PATCH 04/10] fix php-cs-fixer and add new rule --- composer.json | 3 +- composer.lock | 1653 ++++++++++++++++- src/Server.php | 4 +- .../mcpe/handler/LoginPacketHandler.php | 6 +- symply/YmlSymplyProperties.php | 8 +- symply/waterdogpe/WDPEClientData.php | 42 +- .../WDPEClientDataAnimationFrame.php | 18 +- .../WDPEClientDataPersonaPieceTintColor.php | 18 +- .../WDPEClientDataPersonaSkinPiece.php | 18 +- .../WDPEClientDataToSkinDataHelper.php | 18 +- symply/waterdogpe/WDPEPlayerInfo.php | 28 +- 11 files changed, 1718 insertions(+), 98 deletions(-) diff --git a/composer.json b/composer.json index 8eed7f50407..a5674a2487d 100644 --- a/composer.json +++ b/composer.json @@ -52,6 +52,7 @@ "symfony/filesystem": "~6.3.0" }, "require-dev": { + "friendsofphp/php-cs-fixer": "^3.40", "phpstan/phpstan": "1.10.46", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.2.0", @@ -74,7 +75,7 @@ }, "config": { "platform": { - "php": "8.1.0" + "php": "8.2.0" }, "sort-packages": true }, diff --git a/composer.lock b/composer.lock index 40e56d90e3b..ad138e4dad3 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": "780ac4d9e381292b0a6b01dbe9fcdd07", + "content-hash": "eb22858a0fa7f989a2ba3beeafe4ae92", "packages": [ { "name": "adhocore/json-comment", @@ -1150,6 +1150,317 @@ } ], "packages-dev": [ + { + "name": "composer/pcre", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.1.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2023-10-11T07:11:09+00:00" + }, + { + "name": "composer/semver", + "version": "3.4.0", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", + "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.4", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.4.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2023-08-31T09:50:34+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "ced299686f41dce890debac69273b47ffe98a40c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", + "reference": "ced299686f41dce890debac69273b47ffe98a40c", + "shasum": "" + }, + "require": { + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-02-25T21:32:43+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v3.40.1", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "7002f09c9593f515625a9f9717b10c2ab64dd3d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7002f09c9593f515625a9f9717b10c2ab64dd3d5", + "reference": "7002f09c9593f515625a9f9717b10c2ab64dd3d5", + "shasum": "" + }, + "require": { + "composer/semver": "^3.4", + "composer/xdebug-handler": "^3.0.3", + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0", + "sebastian/diff": "^4.0 || ^5.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", + "symfony/finder": "^5.4 || ^6.0 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", + "symfony/polyfill-mbstring": "^1.28", + "symfony/polyfill-php80": "^1.28", + "symfony/polyfill-php81": "^1.28", + "symfony/process": "^5.4 || ^6.0 || ^7.0", + "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" + }, + "require-dev": { + "facile-it/paraunit": "^1.3 || ^2.0", + "justinrainbow/json-schema": "^5.2", + "keradus/cli-executor": "^2.1", + "mikey179/vfsstream": "^1.6.11", + "php-coveralls/php-coveralls": "^2.7", + "php-cs-fixer/accessible-object": "^1.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4", + "phpspec/prophecy": "^1.17", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.6", + "symfony/phpunit-bridge": "^6.3.8 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz RumiƄski", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "keywords": [ + "Static code analysis", + "fixer", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.40.1" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2023-12-02T23:18:26+00:00" + }, { "name": "myclabs/deep-copy", "version": "1.11.1", @@ -1962,123 +2273,276 @@ "time": "2023-09-19T05:42:37+00:00" }, { - "name": "sebastian/cli-parser", - "version": "2.0.0", + "name": "psr/container", + "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae" + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efdc130dbbbb8ef0b545a994fd811725c5282cae", - "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { - "php": ">=8.1" - }, - "require-dev": { - "phpunit/phpunit": "^10.0" + "php": ">=7.4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.0-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Psr\\Container\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "Library for parsing CLI options", - "homepage": "https://github.com/sebastianbergmann/cli-parser", + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], "support": { - "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.0" + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:58:15+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { - "name": "sebastian/code-unit", - "version": "2.0.0", + "name": "psr/event-dispatcher", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", - "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", "shasum": "" }, "require": { - "php": ">=8.1" - }, - "require-dev": { - "phpunit/phpunit": "^10.0" + "php": ">=7.2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.0-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], "support": { - "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:58:43+00:00" + "time": "2019-01-08T18:20:26+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", + "name": "psr/log", "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.0" + }, + "time": "2021-07-14T16:46:02+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efdc130dbbbb8ef0b545a994fd811725c5282cae", + "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:58:15+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:58:43+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" }, "dist": { @@ -2876,6 +3340,1071 @@ ], "time": "2023-02-07T11:34:05+00:00" }, + { + "name": "symfony/console", + "version": "v7.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "cdce5c684b2f920bb1343deecdfba356ffad83d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/cdce5c684b2f920bb1343deecdfba356ffad83d5", + "reference": "cdce5c684b2f920bb1343deecdfba356ffad83d5", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/polyfill-mbstring": "~1.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^6.4|^7.0" + }, + "conflict": { + "symfony/dependency-injection": "<6.4", + "symfony/dotenv": "<6.4", + "symfony/event-dispatcher": "<6.4", + "symfony/lock": "<6.4", + "symfony/process": "<6.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/lock": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/stopwatch": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v7.0.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-12-01T15:10:06+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-05-23T14:45:45+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v7.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "c459b40ffe67c49af6fd392aac374c9edf8a027e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/c459b40ffe67c49af6fd392aac374c9edf8a027e", + "reference": "c459b40ffe67c49af6fd392aac374c9edf8a027e", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/event-dispatcher-contracts": "^2.5|^3" + }, + "conflict": { + "symfony/dependency-injection": "<6.4", + "symfony/service-contracts": "<2.5" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/error-handler": "^6.4|^7.0", + "symfony/expression-language": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/stopwatch": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v7.0.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-07-27T16:29:09+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v3.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/a76aed96a42d2b521153fb382d418e30d18b59df", + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/event-dispatcher": "^1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-05-23T14:45:45+00:00" + }, + { + "name": "symfony/finder", + "version": "v7.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "6e5688d69f7cfc4ed4a511e96007e06c2d34ce56" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/6e5688d69f7cfc4ed4a511e96007e06c2d34ce56", + "reference": "6e5688d69f7cfc4ed4a511e96007e06c2d34ce56", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "symfony/filesystem": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v7.0.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-10-31T17:59:56+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v7.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "700ff4096e346f54cb628ea650767c8130f1001f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/700ff4096e346f54cb628ea650767c8130f1001f", + "reference": "700ff4096e346f54cb628ea650767c8130f1001f", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v7.0.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-08-08T10:20:21+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "875e90aeea2777b6f135677f618529449334a612" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", + "reference": "875e90aeea2777b6f135677f618529449334a612", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "7581cd600fa9fd681b797d00b02f068e2f13263b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/7581cd600fa9fd681b797d00b02f068e2f13263b", + "reference": "7581cd600fa9fd681b797d00b02f068e2f13263b", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/process", + "version": "v7.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "13bdb1670c7f510494e04fcb2bfa29af63db9c0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/13bdb1670c7f510494e04fcb2bfa29af63db9c0d", + "reference": "13bdb1670c7f510494e04fcb2bfa29af63db9c0d", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v7.0.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-11-20T16:43:42+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v3.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "b3313c2dbffaf71c8de2934e2ea56ed2291a3838" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/b3313c2dbffaf71c8de2934e2ea56ed2291a3838", + "reference": "b3313c2dbffaf71c8de2934e2ea56ed2291a3838", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/container": "^2.0" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v3.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-07-30T20:28:31+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v7.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "7bbfa3dd564a0ce12eb4acaaa46823c740f9cb7a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/7bbfa3dd564a0ce12eb4acaaa46823c740f9cb7a", + "reference": "7bbfa3dd564a0ce12eb4acaaa46823c740f9cb7a", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/service-contracts": "^2.5|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a way to profile code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v7.0.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-07-05T13:06:06+00:00" + }, + { + "name": "symfony/string", + "version": "v7.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "92bd2bfbba476d4a1838e5e12168bef2fd1e6620" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/92bd2bfbba476d4a1838e5e12168bef2fd1e6620", + "reference": "92bd2bfbba476d4a1838e5e12168bef2fd1e6620", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.5" + }, + "require-dev": { + "symfony/error-handler": "^6.4|^7.0", + "symfony/http-client": "^6.4|^7.0", + "symfony/intl": "^6.4|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v7.0.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-11-29T08:40:23+00:00" + }, { "name": "theseer/tokenizer", "version": "1.2.1", @@ -2962,7 +4491,7 @@ }, "platform-dev": [], "platform-overrides": { - "php": "8.1.0" + "php": "8.2.0" }, "plugin-api-version": "2.6.0" } diff --git a/src/Server.php b/src/Server.php index 5ef8000935d..dd07304a3ff 100644 --- a/src/Server.php +++ b/src/Server.php @@ -301,7 +301,7 @@ class Server{ * @phpstan-var array> */ private array $broadcastSubscribers = []; - private bool $waterdogeSupport= false; + private bool $waterdogeSupport = false; public function getName() : string{ return VersionInfo::NAME; @@ -414,7 +414,7 @@ public function isHardcore() : bool{ return $this->configGroup->getConfigBool(ServerProperties::HARDCORE, false); } - public function isWaterdogepeSupport(): bool{ + public function isWaterdogepeSupport() : bool{ return $this->waterdogeSupport; } diff --git a/src/network/mcpe/handler/LoginPacketHandler.php b/src/network/mcpe/handler/LoginPacketHandler.php index 81f5f5844fb..ab1ea2c3e60 100644 --- a/src/network/mcpe/handler/LoginPacketHandler.php +++ b/src/network/mcpe/handler/LoginPacketHandler.php @@ -98,7 +98,7 @@ public function handleLogin(LoginPacket $packet) : bool{ $clientData->LanguageCode, $arrClientData ); - }else if($extraData->XUID !== ""){ + }elseif($extraData->XUID !== ""){ $playerInfo = new XboxLivePlayerInfo( $extraData->XUID, $extraData->displayName, @@ -216,11 +216,9 @@ protected function parseClientData(string $clientDataJwt) : ClientData|WDPEClien } /** - * @param ClientData|WDPEClientData $clientData - * @return Skin * @throws InvalidArgumentException|InvalidSkinException */ - protected function parseSkinInClientData(ClientData|WDPEClientData $clientData): Skin{ + protected function parseSkinInClientData(ClientData|WDPEClientData $clientData) : Skin{ if ($clientData instanceof WDPEClientData){ return $this->session->getTypeConverter()->getSkinAdapter()->fromSkinData(WDPEClientDataToSkinDataHelper::fromClientData($clientData)); } diff --git a/symply/YmlSymplyProperties.php b/symply/YmlSymplyProperties.php index 8c06f956811..5fb38a61cfa 100644 --- a/symply/YmlSymplyProperties.php +++ b/symply/YmlSymplyProperties.php @@ -2,14 +2,14 @@ /* * - * _____ _ - * / ___| | | - * \ `--. _ _ _ __ ___ _ __ | |_ _ + * _____ _ + * / ___| | | + * \ `--. _ _ _ __ ___ _ __ | |_ _ * `--. \ | | | '_ ` _ \| '_ \| | | | | * /\__/ / |_| | | | | | | |_) | | |_| | * \____/ \__, |_| |_| |_| .__/|_|\__, | * __/ | | | __/ | - * |___/ |_| |___/ + * |___/ |_| |___/ * * 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 diff --git a/symply/waterdogpe/WDPEClientData.php b/symply/waterdogpe/WDPEClientData.php index 961d8579adb..3483d4e26a1 100644 --- a/symply/waterdogpe/WDPEClientData.php +++ b/symply/waterdogpe/WDPEClientData.php @@ -1,18 +1,38 @@ * - * BedrockProtocol is free software: you can redistribute it and/or modify + * _____ _ + * / ___| | | + * \ `--. _ _ _ __ ___ _ __ | |_ _ + * `--. \ | | | '_ ` _ \| '_ \| | | | | + * /\__/ / |_| | | | | | | |_) | | |_| | + * \____/ \__, |_| |_| |_| .__/|_|\__, | + * __/ | | | __/ | + * |___/ |_| |___/ + * + * 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 Symply Team + * @link http://www.symplymc.com/ + * + * */ declare(strict_types=1); diff --git a/symply/waterdogpe/WDPEClientDataPersonaPieceTintColor.php b/symply/waterdogpe/WDPEClientDataPersonaPieceTintColor.php index bf94dad8cba..594d0c7cee1 100644 --- a/symply/waterdogpe/WDPEClientDataPersonaPieceTintColor.php +++ b/symply/waterdogpe/WDPEClientDataPersonaPieceTintColor.php @@ -1,13 +1,25 @@ * - * BedrockProtocol is free software: you can redistribute it and/or modify + * _____ _ + * / ___| | | + * \ `--. _ _ _ __ ___ _ __ | |_ _ + * `--. \ | | | '_ ` _ \| '_ \| | | | | + * /\__/ / |_| | | | | | | |_) | | |_| | + * \____/ \__, |_| |_| |_| .__/|_|\__, | + * __/ | | | __/ | + * |___/ |_| |___/ + * + * 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 Symply Team + * @link http://www.symplymc.com/ + * + * */ declare(strict_types=1); diff --git a/symply/waterdogpe/WDPEClientDataPersonaSkinPiece.php b/symply/waterdogpe/WDPEClientDataPersonaSkinPiece.php index c02c0936bc6..dcffece6842 100644 --- a/symply/waterdogpe/WDPEClientDataPersonaSkinPiece.php +++ b/symply/waterdogpe/WDPEClientDataPersonaSkinPiece.php @@ -1,13 +1,25 @@ * - * BedrockProtocol is free software: you can redistribute it and/or modify + * _____ _ + * / ___| | | + * \ `--. _ _ _ __ ___ _ __ | |_ _ + * `--. \ | | | '_ ` _ \| '_ \| | | | | + * /\__/ / |_| | | | | | | |_) | | |_| | + * \____/ \__, |_| |_| |_| .__/|_|\__, | + * __/ | | | __/ | + * |___/ |_| |___/ + * + * 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 Symply Team + * @link http://www.symplymc.com/ + * + * */ declare(strict_types=1); diff --git a/symply/waterdogpe/WDPEClientDataToSkinDataHelper.php b/symply/waterdogpe/WDPEClientDataToSkinDataHelper.php index adb4d8c1013..7ca0ba0c54f 100644 --- a/symply/waterdogpe/WDPEClientDataToSkinDataHelper.php +++ b/symply/waterdogpe/WDPEClientDataToSkinDataHelper.php @@ -1,13 +1,25 @@ * - * BedrockProtocol is free software: you can redistribute it and/or modify + * _____ _ + * / ___| | | + * \ `--. _ _ _ __ ___ _ __ | |_ _ + * `--. \ | | | '_ ` _ \| '_ \| | | | | + * /\__/ / |_| | | | | | | |_) | | |_| | + * \____/ \__, |_| |_| |_| .__/|_|\__, | + * __/ | | | __/ | + * |___/ |_| |___/ + * + * 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 Symply Team + * @link http://www.symplymc.com/ + * + * */ declare(strict_types=1); diff --git a/symply/waterdogpe/WDPEPlayerInfo.php b/symply/waterdogpe/WDPEPlayerInfo.php index 3b68ebaf74c..a4d1f84a8c3 100644 --- a/symply/waterdogpe/WDPEPlayerInfo.php +++ b/symply/waterdogpe/WDPEPlayerInfo.php @@ -1,5 +1,29 @@ xuid; } - public function getRealIp(): string{ + public function getRealIp() : string{ return $this->realIp; } @@ -37,4 +61,4 @@ public function withoutXboxData() : PlayerInfo{ $this->getExtraData() ); } -} \ No newline at end of file +} From c2e68e64ed80a7033c536ee25b15fe59642c6d49 Mon Sep 17 00:00:00 2001 From: Sensei Tarzan Date: Sun, 3 Dec 2023 01:26:27 +0100 Subject: [PATCH 05/10] oups no commit rules for php-cs-fixer --- .php-cs-fixer.php | 125 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 123 insertions(+), 2 deletions(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 32af1ef4815..9b04805dcf5 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -1,11 +1,20 @@ in(__DIR__ . '/src') ->in(__DIR__ . '/build') ->in(__DIR__ . '/tests') ->in(__DIR__ . '/tools') ->notPath('plugins/DevTools') + ->notPath('symply') + ->notName('PocketMine.php'); + +$finderSimply = PhpCsFixer\Finder::create() + ->in(__DIR__ . '/symply') + ->notPath('/src') + ->notPath('build') + ->notPath('/tests') + ->notPath('/tools') ->notName('PocketMine.php'); return (new PhpCsFixer\Config) @@ -116,6 +125,118 @@ 'strict_param' => true, 'unary_operator_spaces' => true, ]) - ->setFinder($finder) + ->setFinder($finderPMMP) + ->setIndent("\t") + ->setLineEnding("\n") + ->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' => << 'after_open' + ], + 'indentation_type' => true, + 'logical_operators' => true, + 'native_constant_invocation' => [ + 'scope' => 'namespaced' + ], + '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_align' => [ + 'align' => 'vertical', + 'tags' => [ + 'param', + ] + ], + '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($finderSimply) ->setIndent("\t") ->setLineEnding("\n"); From 5a14dad13ccdc7b134ac95bf76620ad69a313777 Mon Sep 17 00:00:00 2001 From: Sensei Tarzan Date: Sun, 3 Dec 2023 01:40:51 +0100 Subject: [PATCH 06/10] fix rules and add support multi rules --- .github/workflows/main.yml | 7 +- .php-cs-fixer-symply.php | 125 +++++++++++++++++ .php-cs-fixer.php | 128 +----------------- .../generate-symply-yml-property-consts.php | 0 4 files changed, 135 insertions(+), 125 deletions(-) create mode 100644 .php-cs-fixer-symply.php rename build/{ => symply}/generate-symply-yml-property-consts.php (100%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b5e07399a23..fa4eae55fb8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -180,5 +180,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Run PHP-CS-Fixer - run: php-cs-fixer fix --dry-run --diff --ansi + - name: Run PHP-CS-Fixer PMMP + run: php-cs-fixer fix --config=.php-cs-fixer.php --dry-run --diff --ansi + + - name: Run PHP-CS-Fixer SYMPLY + run: php-cs-fixer fix --config=.php-cs-fixer-symply.php --dry-run --diff --ansi \ No newline at end of file diff --git a/.php-cs-fixer-symply.php b/.php-cs-fixer-symply.php new file mode 100644 index 00000000000..6bb5a11d406 --- /dev/null +++ b/.php-cs-fixer-symply.php @@ -0,0 +1,125 @@ +in(__DIR__ . '/symply') + ->in(__DIR__ . '/build/symply') + ->exclude(__DIR__ . '/src') + ->exclude(__DIR__ .'/tests') + ->exclude(__DIR__ . '/build') + ->exclude(__DIR__ . '/tools'); + +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' => << 'after_open' + ], + 'indentation_type' => true, + 'logical_operators' => true, + 'native_constant_invocation' => [ + 'scope' => 'namespaced' + ], + '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_align' => [ + 'align' => 'vertical', + 'tags' => [ + 'param', + ] + ], + '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"); diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 9b04805dcf5..5b48570f7f3 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -1,20 +1,14 @@ in(__DIR__ . '/src') ->in(__DIR__ . '/build') ->in(__DIR__ . '/tests') ->in(__DIR__ . '/tools') + ->exclude(__DIR__ . '/symply') + ->exclude(__DIR__ . '/build/symply') + ->exclude(__DIR__ . '/tests/symply') ->notPath('plugins/DevTools') - ->notPath('symply') - ->notName('PocketMine.php'); - -$finderSimply = PhpCsFixer\Finder::create() - ->in(__DIR__ . '/symply') - ->notPath('/src') - ->notPath('build') - ->notPath('/tests') - ->notPath('/tools') ->notName('PocketMine.php'); return (new PhpCsFixer\Config) @@ -125,118 +119,6 @@ 'strict_param' => true, 'unary_operator_spaces' => true, ]) - ->setFinder($finderPMMP) - ->setIndent("\t") - ->setLineEnding("\n") - ->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' => << 'after_open' - ], - 'indentation_type' => true, - 'logical_operators' => true, - 'native_constant_invocation' => [ - 'scope' => 'namespaced' - ], - '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_align' => [ - 'align' => 'vertical', - 'tags' => [ - 'param', - ] - ], - '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($finderSimply) + ->setFinder($finder) ->setIndent("\t") ->setLineEnding("\n"); diff --git a/build/generate-symply-yml-property-consts.php b/build/symply/generate-symply-yml-property-consts.php similarity index 100% rename from build/generate-symply-yml-property-consts.php rename to build/symply/generate-symply-yml-property-consts.php From 14ba82b2d33ce214fdd964eab800ad0f1ee186d9 Mon Sep 17 00:00:00 2001 From: Sensei Tarzan Date: Sun, 3 Dec 2023 01:43:35 +0100 Subject: [PATCH 07/10] fix rules for pmmp --- .php-cs-fixer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 5b48570f7f3..ac990faf394 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -5,9 +5,9 @@ ->in(__DIR__ . '/build') ->in(__DIR__ . '/tests') ->in(__DIR__ . '/tools') - ->exclude(__DIR__ . '/symply') - ->exclude(__DIR__ . '/build/symply') - ->exclude(__DIR__ . '/tests/symply') + ->exclude( __DIR__ . '/symply') + ->notPath( 'build/symply') + ->notPath('tests/symply') ->notPath('plugins/DevTools') ->notName('PocketMine.php'); From 4502f2f678f24f2b693ecb68a85e2f9b4a6a0906 Mon Sep 17 00:00:00 2001 From: Sensei Tarzan Date: Sun, 3 Dec 2023 02:07:47 +0100 Subject: [PATCH 08/10] fix finder for exclude file --- .github/workflows/main.yml | 4 ++-- .php-cs-fixer-symply.php | 6 +----- .php-cs-fixer.php | 5 ++--- .../generate-symply-yml-property-consts.php | 21 ------------------- 4 files changed, 5 insertions(+), 31 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fa4eae55fb8..70cb91b11c3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -181,7 +181,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run PHP-CS-Fixer PMMP - run: php-cs-fixer fix --config=.php-cs-fixer.php --dry-run --diff --ansi + run: "rm -fr .php-cs-fixer.cache && php-cs-fixer fix --config=.php-cs-fixer.php --dry-run --diff --ansi" - name: Run PHP-CS-Fixer SYMPLY - run: php-cs-fixer fix --config=.php-cs-fixer-symply.php --dry-run --diff --ansi \ No newline at end of file + run: "rm -fr .php-cs-fixer.cache && php-cs-fixer fix --config=.php-cs-fixer-symply.php --dry-run --diff --ansi" \ No newline at end of file diff --git a/.php-cs-fixer-symply.php b/.php-cs-fixer-symply.php index 6bb5a11d406..a9fb9fcb378 100644 --- a/.php-cs-fixer-symply.php +++ b/.php-cs-fixer-symply.php @@ -2,11 +2,7 @@ $finder = PhpCsFixer\Finder::create() ->in(__DIR__ . '/symply') - ->in(__DIR__ . '/build/symply') - ->exclude(__DIR__ . '/src') - ->exclude(__DIR__ .'/tests') - ->exclude(__DIR__ . '/build') - ->exclude(__DIR__ . '/tools'); + ->in(__DIR__ . '/build/symply'); return (new PhpCsFixer\Config) ->setRiskyAllowed(true) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index ac990faf394..628b44fc245 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -6,10 +6,9 @@ ->in(__DIR__ . '/tests') ->in(__DIR__ . '/tools') ->exclude( __DIR__ . '/symply') - ->notPath( 'build/symply') - ->notPath('tests/symply') ->notPath('plugins/DevTools') - ->notName('PocketMine.php'); + ->notName('PocketMine.php') + ->notName('generate-symply-yml-property-consts.php'); return (new PhpCsFixer\Config) ->setRiskyAllowed(true) diff --git a/build/symply/generate-symply-yml-property-consts.php b/build/symply/generate-symply-yml-property-consts.php index e40ca481f1c..842159b7d39 100644 --- a/build/symply/generate-symply-yml-property-consts.php +++ b/build/symply/generate-symply-yml-property-consts.php @@ -1,26 +1,5 @@ Date: Sun, 3 Dec 2023 02:10:32 +0100 Subject: [PATCH 09/10] fix cs --- .../generate-symply-yml-property-consts.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/build/symply/generate-symply-yml-property-consts.php b/build/symply/generate-symply-yml-property-consts.php index 842159b7d39..e40ca481f1c 100644 --- a/build/symply/generate-symply-yml-property-consts.php +++ b/build/symply/generate-symply-yml-property-consts.php @@ -1,5 +1,26 @@ Date: Sun, 3 Dec 2023 18:49:50 +0100 Subject: [PATCH 10/10] add system url resources pack in symply (#20) Co-authored-by: AzaleeX --- resources/resource_packs.yml | 7 ++ .../handler/ResourcePacksPacketHandler.php | 17 ++- src/resourcepacks/ResourcePack.php | 15 +++ src/resourcepacks/ResourcePackManager.php | 60 +++++++--- src/resourcepacks/ZippedResourcePack.php | 19 +++- .../InvalidPackChunkURLException.php | 32 ++++++ symply/resourcepacks/PackSizeUnavailable.php | 34 ++++++ symply/resourcepacks/URLResourcePack.php | 104 ++++++++++++++++++ symply/utils/Utils.php | 68 ++++++++++++ 9 files changed, 334 insertions(+), 22 deletions(-) create mode 100644 symply/resourcepacks/InvalidPackChunkURLException.php create mode 100644 symply/resourcepacks/PackSizeUnavailable.php create mode 100644 symply/resourcepacks/URLResourcePack.php create mode 100644 symply/utils/Utils.php diff --git a/resources/resource_packs.yml b/resources/resource_packs.yml index f236117d564..7a23a7ee0bf 100644 --- a/resources/resource_packs.yml +++ b/resources/resource_packs.yml @@ -9,5 +9,12 @@ resource_stack: #Example # - natural.zip # - vanilla.zip + # - path: file.zip + # encryptionKey: "your encrypt Key" <- is optionnal option + # - path: 'https://exemple.com/natural.zip' + # name: "name in manifest.json" + # uuid: "uuid in manifest.json" + # version: "version in manifest.json" + # encryptionKey: "your encrypt Key" <- is optionnal option #If you want to force clients to use vanilla resources, you must place a vanilla resource pack in your resources folder and add it to the stack here. #To specify a resource encryption key, put the key in the .key file alongside the resource pack. Example: vanilla.zip.key diff --git a/src/network/mcpe/handler/ResourcePacksPacketHandler.php b/src/network/mcpe/handler/ResourcePacksPacketHandler.php index 08ce53efe2c..ca64b7c70e6 100644 --- a/src/network/mcpe/handler/ResourcePacksPacketHandler.php +++ b/src/network/mcpe/handler/ResourcePacksPacketHandler.php @@ -38,6 +38,7 @@ use pocketmine\network\mcpe\protocol\types\resourcepacks\ResourcePackType; use pocketmine\resourcepacks\ResourcePack; use pocketmine\resourcepacks\ResourcePackManager; +use symply\resourcepacks\URLResourcePack; use function array_map; use function ceil; use function count; @@ -67,20 +68,19 @@ public function __construct( public function setUp() : void{ $resourcePackEntries = array_map(function(ResourcePack $pack) : ResourcePackInfoEntry{ //TODO: more stuff - $encryptionKey = $this->resourcePackManager->getPackEncryptionKey($pack->getPackId()); return new ResourcePackInfoEntry( $pack->getPackId(), $pack->getPackVersion(), $pack->getPackSize(), - $encryptionKey ?? "", + $pack->getEncryptionKey(), "", - $pack->getPackId(), + $pack->getContentId(), false ); }, $this->resourcePackManager->getResourceStack()); //TODO: support forcing server packs - $this->session->sendDataPacket(ResourcePacksInfoPacket::create($resourcePackEntries, [], $this->resourcePackManager->resourcePacksRequired(), false, false, [])); + $this->session->sendDataPacket(ResourcePacksInfoPacket::create($resourcePackEntries, [], $this->resourcePackManager->resourcePacksRequired(), false, false, $this->resourcePackManager->getPackUrl())); $this->session->getLogger()->debug("Waiting for client to accept resource packs"); } @@ -109,6 +109,10 @@ public function handleResourcePackClientResponse(ResourcePackClientResponsePacke $this->disconnectWithError("Unknown pack $uuid requested, available packs: " . implode(", ", $this->resourcePackManager->getPackIdList())); return false; } + if ($pack instanceof URLResourcePack){ + $this->disconnectWithError("Invalid URL for pack chunk in $uuid. Unable to use the getPackChunk method."); + return false; + } $this->session->sendDataPacket(ResourcePackDataInfoPacket::create( $pack->getPackId(), @@ -154,8 +158,11 @@ public function handleResourcePackChunkRequest(ResourcePackChunkRequestPacket $p $this->disconnectWithError("Invalid request for chunk $packet->chunkIndex of unknown pack $packet->packId, available packs: " . implode(", ", $this->resourcePackManager->getPackIdList())); return false; } - $packId = $pack->getPackId(); //use this because case may be different + if ($pack instanceof URLResourcePack){ + $this->disconnectWithError("Invalid URL for pack chunk in $packId. Unable to use the getPackChunk method."); + return false; + } if(isset($this->downloadedChunks[$packId][$packet->chunkIndex])){ $this->disconnectWithError("Duplicate request for chunk $packet->chunkIndex of pack $packet->packId"); diff --git a/src/resourcepacks/ResourcePack.php b/src/resourcepacks/ResourcePack.php index 04feeeb3d70..ce544fe0614 100644 --- a/src/resourcepacks/ResourcePack.php +++ b/src/resourcepacks/ResourcePack.php @@ -64,4 +64,19 @@ public function getSha256() : string; * @throws \InvalidArgumentException if the chunk does not exist */ public function getPackChunk(int $start, int $length) : string; + + /** + * Returns the EncryptionKey of ResourcesPack + */ + public function getEncryptionKey() : string; + + /** + * Returns the ContentId of ResourcesPack + */ + public function getContentId() : string; + + /** + * can set the EncryptionKey without pass by new system symplu + */ + public function setEncryptionKey(string $key) : void; } diff --git a/src/resourcepacks/ResourcePackManager.php b/src/resourcepacks/ResourcePackManager.php index 2df6750def6..61dc8f5d5f9 100644 --- a/src/resourcepacks/ResourcePackManager.php +++ b/src/resourcepacks/ResourcePackManager.php @@ -26,6 +26,8 @@ use pocketmine\utils\Config; use pocketmine\utils\Filesystem; use Symfony\Component\Filesystem\Path; +use symply\resourcepacks\URLResourcePack; +use symply\utils\Utils as UtilsSymply; use function array_keys; use function copy; use function count; @@ -56,7 +58,7 @@ class ResourcePackManager{ * @var string[] * @phpstan-var array */ - private array $encryptionKeys = []; + private array $packUrl = []; /** * @param string $path Path to resource-packs directory. @@ -88,17 +90,23 @@ public function __construct(string $path, \Logger $logger){ } foreach($resourceStack as $pos => $pack){ - if(!is_string($pack) && !is_int($pack) && !is_float($pack)){ + if(!(is_string($pack) || is_array($pack)) && !is_int($pack) && !is_float($pack)){ $logger->critical("Found invalid entry in resource pack list at offset $pos of type " . gettype($pack)); continue; } - $pack = (string) $pack; try{ - $newPack = $this->loadPackFromPath(Path::join($this->path, $pack)); - + if (is_string($pack)) { + $newPack = $this->loadPackFromPath(Path::join($this->path, (string) $pack)); + }else { + $newPack = $this->loadPackFromArray((array) $pack); + } $this->resourcePacks[] = $newPack; $index = strtolower($newPack->getPackId()); $this->uuidList[$index] = $newPack; + if ($newPack instanceof URLResourcePack){ + $this->addPackUrl($newPack); + return; + } $keyPath = Path::join($this->path, $pack . ".key"); if(file_exists($keyPath)){ @@ -111,7 +119,7 @@ public function __construct(string $path, \Logger $logger){ if(strlen($key) !== 32){ throw new ResourcePackException("Invalid encryption key length, must be exactly 32 bytes"); } - $this->encryptionKeys[$index] = $key; + $this->setPackEncryptionKey($index, $key); } }catch(ResourcePackException $e){ $logger->critical("Could not load resource pack \"$pack\": " . $e->getMessage()); @@ -140,6 +148,21 @@ private function loadPackFromPath(string $packPath) : ResourcePack{ throw new ResourcePackException("Format not recognized"); } + private function loadPackFromArray(array $info) : ResourcePack{ + $packPath = $info['path']; + if (UtilsSymply::isUrl($packPath)){ + return new URLResourcePack($info['name'], $info['uuid'], $info['version'], $packPath, UtilsSymply::getSizeOfResourcesPack($packPath), $info['encryptionKey'] ?? ""); + } + $packPath = Path::join($this->path, $packPath); + if(!file_exists($packPath)){ + throw new ResourcePackException("File or directory not found"); + } + if(is_dir($packPath)){ + throw new ResourcePackException("Directory resource packs are unsupported"); + } + return new ZippedResourcePack($packPath, $info['encryptionKey'] ?? ""); + } + /** * Returns the directory which resource packs are loaded from. */ @@ -207,29 +230,34 @@ public function getPackIdList() : array{ return array_keys($this->uuidList); } - /** - * Returns the key with which the pack was encrypted, or null if the pack has no key. - */ - public function getPackEncryptionKey(string $id) : ?string{ - return $this->encryptionKeys[strtolower($id)] ?? null; - } - /** * Sets the encryption key to use for decrypting the specified resource pack. The pack will **NOT** be decrypted by * PocketMine-MP; the key is simply passed to the client to allow it to decrypt the pack after downloading it. */ public function setPackEncryptionKey(string $id, ?string $key) : void{ $id = strtolower($id); + if (!isset($this->uuidList[$id])){ + throw new ResourcePackException("Resource pack with ID $id not found."); + } if($key === null){ - //allow deprovisioning keys for resource packs that have been removed - unset($this->encryptionKeys[$id]); + $this->uuidList[$id]->setEncryptionKey(""); }elseif(isset($this->uuidList[$id])){ if(strlen($key) !== 32){ throw new \InvalidArgumentException("Encryption key must be exactly 32 bytes long"); } - $this->encryptionKeys[$id] = $key; + $this->uuidList[$id]->setEncryptionKey($key); }else{ throw new \InvalidArgumentException("Unknown pack ID $id"); } } + + public function getPackUrl() : array + { + return $this->packUrl; + } + + public function addPackUrl(URLResourcePack $packUrl) : void + { + $this->packUrl[$packUrl->getRealName()] = $packUrl->getUrl(); + } } diff --git a/src/resourcepacks/ZippedResourcePack.php b/src/resourcepacks/ZippedResourcePack.php index 7ba5c467d5f..af83c184091 100644 --- a/src/resourcepacks/ZippedResourcePack.php +++ b/src/resourcepacks/ZippedResourcePack.php @@ -52,7 +52,7 @@ class ZippedResourcePack implements ResourcePack{ * @param string $zipPath Path to the resource pack zip * @throws ResourcePackException */ - public function __construct(string $zipPath){ + public function __construct(string $zipPath, protected string $encryptionKey = ""){ $this->path = $zipPath; if(!file_exists($zipPath)){ @@ -159,4 +159,21 @@ public function getPackChunk(int $start, int $length) : string{ } return Utils::assumeNotFalse(fread($this->fileResource, $length), "Already checked that we're not at EOF"); } + + public function getEncryptionKey() : string{ + return $this->encryptionKey; + } + + public function setEncryptionKey(string $key) : void{ + $this->encryptionKey = $key; + } + + private function hasEncryptionKey() : bool{ + return $this->encryptionKey != ""; + } + + public function getContentId() : string + { + return $this->hasEncryptionKey() ? $this->getPackId() : ""; + } } diff --git a/symply/resourcepacks/InvalidPackChunkURLException.php b/symply/resourcepacks/InvalidPackChunkURLException.php new file mode 100644 index 00000000000..89f774437aa --- /dev/null +++ b/symply/resourcepacks/InvalidPackChunkURLException.php @@ -0,0 +1,32 @@ +realName = "{$this->uuid}_{$this->version}"; + } + + public function getRealName() : string + { + return $this->realName; + } + + public function getPackName() : string + { + return $this->name; + } + + public function getPackId() : string + { + return $this->uuid; + } + + public function getPackSize() : int + { + return $this->size; + } + + public function getPackVersion() : string + { + return $this->version; + } + + public function getSha256() : string + { + return ""; + } + + /** + * @throws InvalidPackChunkURLException + */ + public function getPackChunk(int $start, int $length) : string + { + throw new InvalidPackChunkURLException("Invalid URL for pack chunk in {$this->getPackId()}. Unable to use the getPackChunk method."); + } + + public function getUrl() : string{ + return $this->url; + } + + public function getEncryptionKey() : string + { + return $this->encryptionKey; + } + public function hasEncryptionKey() : bool + { + return $this->encryptionKey !== ""; + } + public function getContentId() : string + { + return $this->hasEncryptionKey() ? $this->getPackId() : ""; + } + + public function setEncryptionKey(string $key) : void + { + $this->encryptionKey = $key; + } +} diff --git a/symply/utils/Utils.php b/symply/utils/Utils.php new file mode 100644 index 00000000000..2041c5c3529 --- /dev/null +++ b/symply/utils/Utils.php @@ -0,0 +1,68 @@ +