diff --git a/src/command/defaults/ParticleCommand.php b/src/command/defaults/ParticleCommand.php index 814c7e0bc..5560cbe41 100644 --- a/src/command/defaults/ParticleCommand.php +++ b/src/command/defaults/ParticleCommand.php @@ -93,7 +93,7 @@ class ParticleCommand extends VanillaCommand{ if($sender instanceof Player){ $senderPos = $sender->getPosition(); - $world = $senderPos->getWorld(); + $world = $senderPos->getWorldNonNull(); $pos = new Vector3( $this->getRelativeDouble($senderPos->getX(), $sender, $args[1]), $this->getRelativeDouble($senderPos->getY(), $sender, $args[2], 0, World::Y_MAX), diff --git a/src/command/defaults/SetWorldSpawnCommand.php b/src/command/defaults/SetWorldSpawnCommand.php index 45534184a..36241ea8a 100644 --- a/src/command/defaults/SetWorldSpawnCommand.php +++ b/src/command/defaults/SetWorldSpawnCommand.php @@ -52,7 +52,7 @@ class SetWorldSpawnCommand extends VanillaCommand{ if(count($args) === 0){ if($sender instanceof Player){ $location = $sender->getPosition(); - $world = $location->getWorld(); + $world = $location->getWorldNonNull(); $pos = $location->asVector3()->round(); }else{ $sender->sendMessage(TextFormat::RED . "You can only perform this command as a player"); diff --git a/src/command/defaults/SpawnpointCommand.php b/src/command/defaults/SpawnpointCommand.php index 91813c24c..3879ced83 100644 --- a/src/command/defaults/SpawnpointCommand.php +++ b/src/command/defaults/SpawnpointCommand.php @@ -83,7 +83,7 @@ class SpawnpointCommand extends VanillaCommand{ }elseif(count($args) <= 1){ if($sender instanceof Player){ $cpos = $sender->getPosition(); - $pos = Position::fromObject($cpos->floor(), $cpos->getWorld()); + $pos = Position::fromObject($cpos->floor(), $cpos->getWorldNonNull()); $target->setSpawn($pos); Command::broadcastCommandMessage($sender, new TranslationContainer("commands.spawnpoint.success", [$target->getName(), round($pos->x, 2), round($pos->y, 2), round($pos->z, 2)])); diff --git a/src/item/Bow.php b/src/item/Bow.php index 98a43b00b..db4968284 100644 --- a/src/item/Bow.php +++ b/src/item/Bow.php @@ -63,7 +63,7 @@ class Bow extends Tool{ $baseForce = min((($p ** 2) + $p * 2) / 3, 1); /** @var ArrowEntity $entity */ - $entity = EntityFactory::getInstance()->create(ArrowEntity::class, $location->getWorld(), $nbt, $player, $baseForce >= 1); + $entity = EntityFactory::getInstance()->create(ArrowEntity::class, $location->getWorldNonNull(), $nbt, $player, $baseForce >= 1); $infinity = $this->hasEnchantment(Enchantment::INFINITY()); if($infinity){ diff --git a/src/item/ProjectileItem.php b/src/item/ProjectileItem.php index 027b6b86e..a881e07ac 100644 --- a/src/item/ProjectileItem.php +++ b/src/item/ProjectileItem.php @@ -60,7 +60,7 @@ abstract class ProjectileItem extends Item{ Utils::testValidInstance($class, Throwable::class); /** @var Throwable $projectile */ - $projectile = EntityFactory::getInstance()->create($class, $location->getWorld(), $nbt, $player); + $projectile = EntityFactory::getInstance()->create($class, $location->getWorldNonNull(), $nbt, $player); $projectile->setMotion($projectile->getMotion()->multiply($this->getThrowForce())); $projectileEv = new ProjectileLaunchEvent($projectile); diff --git a/tests/phpstan/configs/l8-baseline.neon b/tests/phpstan/configs/l8-baseline.neon index f5211c84b..84cf6b1c8 100644 --- a/tests/phpstan/configs/l8-baseline.neon +++ b/tests/phpstan/configs/l8-baseline.neon @@ -300,11 +300,6 @@ parameters: count: 1 path: ../../../src/inventory/transaction/CraftingTransaction.php - - - message: "#^Parameter \\#2 \\$world of method pocketmine\\\\entity\\\\EntityFactory\\:\\:create\\(\\) expects pocketmine\\\\world\\\\World, pocketmine\\\\world\\\\World\\|null given\\.$#" - count: 1 - path: ../../../src/item/Bow.php - - message: "#^Method pocketmine\\\\item\\\\Item\\:\\:getNamedTag\\(\\) should return pocketmine\\\\nbt\\\\tag\\\\CompoundTag but returns pocketmine\\\\nbt\\\\tag\\\\CompoundTag\\|null\\.$#" count: 1 @@ -325,11 +320,6 @@ parameters: count: 1 path: ../../../src/item/Item.php - - - message: "#^Parameter \\#2 \\$world of method pocketmine\\\\entity\\\\EntityFactory\\:\\:create\\(\\) expects pocketmine\\\\world\\\\World, pocketmine\\\\world\\\\World\\|null given\\.$#" - count: 1 - path: ../../../src/item/ProjectileItem.php - - message: "#^Method pocketmine\\\\item\\\\enchantment\\\\Enchantment\\:\\:BLAST_PROTECTION\\(\\) should return pocketmine\\\\item\\\\enchantment\\\\Enchantment but returns pocketmine\\\\item\\\\enchantment\\\\Enchantment\\|null\\.$#" count: 1