mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 03:35:33 +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();
|
||||
$index = World::chunkHash($x, $z);
|
||||
if(isset($this->usedChunks[$index])){
|
||||
foreach($world->getChunk($x, $z)->getEntities() as $entity){
|
||||
if($entity !== $this){
|
||||
$entity->despawnFrom($this);
|
||||
$chunk = $world->getChunk($x, $z);
|
||||
if($chunk !== null){ //this might be a chunk that hasn't been generated yet
|
||||
foreach($chunk->getEntities() as $entity){
|
||||
if($entity !== $this){
|
||||
$entity->despawnFrom($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->networkSession->stopUsingChunk($x, $z);
|
||||
|
Loading…
x
Reference in New Issue
Block a user