mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 16:24:05 +00:00
Entity::spawnTo(): verify that the target player belongs to the same world as the entity
this should never be hit in the PM case, but it's an InvalidArgument rather than AssumptionFailedError because plugins can and do call this with bad things.
This commit is contained in:
parent
f1cc168d26
commit
089e62b44e
@ -563,7 +563,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
public function spawnTo(Player $player) : void{
|
||||
if($this->spawned and $player->spawned and $this->isAlive() and $player->isAlive() and $player->getLevelNonNull() === $this->level and $player->canSee($this) and !$this->isSpectator()){
|
||||
if($this->spawned and $player->spawned and $this->isAlive() and $player->isAlive() and $player->canSee($this) and !$this->isSpectator()){
|
||||
parent::spawnTo($player);
|
||||
}
|
||||
}
|
||||
|
@ -1950,6 +1950,9 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
}
|
||||
|
||||
public function spawnTo(Player $player) : void{
|
||||
if($player->getLevelNonNull() !== $this->level){
|
||||
throw new \InvalidArgumentException("Player is not in the same world");
|
||||
}
|
||||
if(
|
||||
!isset($this->hasSpawned[$player->getLoaderId()]) and
|
||||
$this->chunk !== null and
|
||||
|
Loading…
x
Reference in New Issue
Block a user