mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 11:45:30 +00:00
Player: fixed crash when stopping using a chunk before it's finished being generated
This commit is contained in:
parent
5ba09b6a25
commit
e056456dd1
@ -672,9 +672,12 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
$world = $world ?? $this->getWorld();
|
$world = $world ?? $this->getWorld();
|
||||||
$index = World::chunkHash($x, $z);
|
$index = World::chunkHash($x, $z);
|
||||||
if(isset($this->usedChunks[$index])){
|
if(isset($this->usedChunks[$index])){
|
||||||
foreach($world->getChunk($x, $z)->getEntities() as $entity){
|
$chunk = $world->getChunk($x, $z);
|
||||||
if($entity !== $this){
|
if($chunk !== null){ //this might be a chunk that hasn't been generated yet
|
||||||
$entity->despawnFrom($this);
|
foreach($chunk->getEntities() as $entity){
|
||||||
|
if($entity !== $this){
|
||||||
|
$entity->despawnFrom($this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->networkSession->stopUsingChunk($x, $z);
|
$this->networkSession->stopUsingChunk($x, $z);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user