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 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", 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())); 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 diff --git a/src/world/World.php b/src/world/World.php index 8c14c7fc1..b6651fc6f 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -1264,7 +1264,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();