From 97ef209c5fafd7553a249484c50d42e6d8c08c2e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 19 Dec 2022 16:26:36 +0000 Subject: [PATCH 1/5] HandlerList: added missing class-string type for constructor --- src/event/HandlerList.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/event/HandlerList.php b/src/event/HandlerList.php index 7d93c2ebe..0e16555b3 100644 --- a/src/event/HandlerList.php +++ b/src/event/HandlerList.php @@ -31,6 +31,10 @@ class HandlerList{ /** @var RegisteredListener[][] */ private array $handlerSlots = []; + /** + * @phpstan-template TEvent of Event + * @phpstan-param class-string $class + */ public function __construct( private string $class, private ?HandlerList $parentList From 1e5597f0d5d0b9f1aaa1c9db1acbfc9e498c4349 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 19 Dec 2022 20:20:52 +0000 Subject: [PATCH 2/5] World: account for null chunk edge case in tickChunk() the target chunk may no longer be loaded if it was unloaded during a previous chunk's tick (e.g. during BlockGrowEvent). Since the parent function iterates over a pre-selected array of chunks, the chunk will still be present in the list even if it's no longer loaded by the time it's reached. --- src/world/World.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/world/World.php b/src/world/World.php index 4c8d6a44c..54fd7863b 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -1222,7 +1222,8 @@ class World implements ChunkManager{ private function tickChunk(int $chunkX, int $chunkZ) : void{ $chunk = $this->getChunk($chunkX, $chunkZ); if($chunk === null){ - throw new \InvalidArgumentException("Chunk is not loaded"); + //the chunk may have been unloaded during a previous chunk's update (e.g. during BlockGrowEvent) + return; } foreach($this->getChunkEntities($chunkX, $chunkZ) as $entity){ $entity->onRandomUpdate(); From 17dde140a5f63593dbadff11c2037bc575477f8e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Dec 2022 15:23:10 +0000 Subject: [PATCH 3/5] Bump phpstan/phpstan-phpunit from 1.3.2 to 1.3.3 (#5465) Bumps [phpstan/phpstan-phpunit](https://github.com/phpstan/phpstan-phpunit) from 1.3.2 to 1.3.3. - [Release notes](https://github.com/phpstan/phpstan-phpunit/releases) - [Commits](https://github.com/phpstan/phpstan-phpunit/compare/1.3.2...1.3.3) --- updated-dependencies: - dependency-name: phpstan/phpstan-phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index b9626d576..fd1325531 100644 --- a/composer.lock +++ b/composer.lock @@ -1880,16 +1880,16 @@ }, { "name": "phpstan/phpstan-phpunit", - "version": "1.3.2", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "cd9c6938f8bbfcb6da3ed5a3c7ea60873825d088" + "reference": "54a24bd23e9e80ee918cdc24f909d376c2e273f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/cd9c6938f8bbfcb6da3ed5a3c7ea60873825d088", - "reference": "cd9c6938f8bbfcb6da3ed5a3c7ea60873825d088", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/54a24bd23e9e80ee918cdc24f909d376c2e273f7", + "reference": "54a24bd23e9e80ee918cdc24f909d376c2e273f7", "shasum": "" }, "require": { @@ -1926,9 +1926,9 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.3.2" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.3.3" }, - "time": "2022-12-13T15:08:22+00:00" + "time": "2022-12-21T15:25:00+00:00" }, { "name": "phpstan/phpstan-strict-rules", From 7d1d62042c60a6fb76f8571edb2dbce3444ce4de Mon Sep 17 00:00:00 2001 From: Dylan T Date: Thu, 22 Dec 2022 18:13:03 +0000 Subject: [PATCH 4/5] attempted fix for GitHub rate limiting php-cs-fixer installation from https://github.com/shivammathur/setup-php/issues/678#issuecomment-1363128626 --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 300f57eb3..653a56496 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -199,6 +199,8 @@ jobs: with: php-version: 8.0 tools: php-cs-fixer:3.11 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run PHP-CS-Fixer run: php-cs-fixer fix --dry-run --diff --ansi From 5d2b0acfc862f44f4cde96d1d705a1ede4c8e4fd Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 22 Dec 2022 18:38:10 +0000 Subject: [PATCH 5/5] GamemodeCommand: report failure if the target's game mode is already the desired game mode this has irritated me for years. --- src/command/defaults/GamemodeCommand.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/command/defaults/GamemodeCommand.php b/src/command/defaults/GamemodeCommand.php index 1363d34dc..81d4fd3f8 100644 --- a/src/command/defaults/GamemodeCommand.php +++ b/src/command/defaults/GamemodeCommand.php @@ -72,6 +72,11 @@ class GamemodeCommand extends VanillaCommand{ throw new InvalidCommandSyntaxException(); } + if($target->getGamemode()->equals($gameMode)){ + $sender->sendMessage(KnownTranslationFactory::pocketmine_command_gamemode_failure($target->getName())); + return true; + } + $target->setGamemode($gameMode); if(!$gameMode->equals($target->getGamemode())){ $sender->sendMessage(KnownTranslationFactory::pocketmine_command_gamemode_failure($target->getName()));