Merge branch 'stable'

This commit is contained in:
Dylan K. Taylor 2021-10-29 19:04:01 +01:00
commit 8a2ecfe1d4
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
4 changed files with 11 additions and 3 deletions

View File

@ -253,10 +253,10 @@ jobs:
- uses: actions/checkout@v2
- name: Setup PHP and tools
uses: shivammathur/setup-php@2.9.0
uses: shivammathur/setup-php@2.15.0
with:
php-version: 8.0
tools: php-cs-fixer
tools: php-cs-fixer:3.2
- name: Run PHP-CS-Fixer
run: php-cs-fixer fix --dry-run --diff

View File

@ -61,6 +61,11 @@ return (new PhpCsFixer\Config)
],
'sort_algorithm' => 'alpha'
],
'phpdoc_line_span' => [
'property' => 'single',
'method' => null,
'const' => null
],
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'single_import_per_statement' => true,

View File

@ -1436,6 +1436,9 @@ abstract class Entity{
}
public function spawnTo(Player $player) : void{
if($player->getWorld() !== $this->getWorld()){
throw new \InvalidArgumentException("Player is not in the same world");
}
$id = spl_object_id($player);
//TODO: this will cause some visible lag during chunk resends; if the player uses a spawn egg in a chunk, the
//created entity won't be visible until after the resend arrives. However, this is better than possibly crashing

View File

@ -394,7 +394,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
}
public function spawnTo(Player $player) : void{
if($this->isAlive() and $player->isAlive() and $player->getWorld() === $this->getWorld() and $player->canSee($this) and !$this->isSpectator()){
if($this->isAlive() and $player->isAlive() and $player->canSee($this) and !$this->isSpectator()){
parent::spawnTo($player);
}
}