mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 17:29:44 +00:00
Fixed a crash when saving chunks
This commit is contained in:
parent
5ca4f5416c
commit
298b973604
@ -2159,6 +2159,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
if($chunk !== null and $this->getAutoSave()){
|
||||||
$entities = 0;
|
$entities = 0;
|
||||||
foreach($chunk->getEntities() as $e){
|
foreach($chunk->getEntities() as $e){
|
||||||
if($e instanceof Player){
|
if($e instanceof Player){
|
||||||
@ -2167,11 +2168,11 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
++$entities;
|
++$entities;
|
||||||
}
|
}
|
||||||
|
|
||||||
$save = ($chunk->hasChanged() or count($chunk->getTiles()) > 0 or $entities > 0);
|
if($chunk->hasChanged() or count($chunk->getTiles()) > 0 or $entities > 0){
|
||||||
if($chunk !== null and $this->getAutoSave() and $save){
|
|
||||||
$this->provider->setChunk($x, $z, $chunk);
|
$this->provider->setChunk($x, $z, $chunk);
|
||||||
$this->provider->saveChunk($x, $z);
|
$this->provider->saveChunk($x, $z);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$this->provider->unloadChunk($x, $z, $safe);
|
$this->provider->unloadChunk($x, $z, $safe);
|
||||||
}catch(\Exception $e){
|
}catch(\Exception $e){
|
||||||
$logger = $this->server->getLogger();
|
$logger = $this->server->getLogger();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user