World: remove redundant checks

when entities are added and removed which are savable, the dirty flag is set anyway, so these checks aren't needed.
This commit is contained in:
Dylan K. Taylor 2019-06-14 17:47:39 +01:00
parent 9e9de1e8ba
commit 211836274f

View File

@ -1056,7 +1056,7 @@ class World implements ChunkManager, Metadatable{
$this->timings->syncChunkSaveTimer->startTiming();
try{
foreach($this->chunks as $chunk){
if(($chunk->hasChanged() or count($chunk->getTiles()) > 0 or count($chunk->getSavableEntities()) > 0) and $chunk->isGenerated()){
if($chunk->hasChanged() and $chunk->isGenerated()){
$this->provider->saveChunk($chunk);
$chunk->setChanged(false);
}
@ -2584,8 +2584,7 @@ class World implements ChunkManager, Metadatable{
return false;
}
if($trySave and $this->getAutoSave() and $chunk->isGenerated()){
if($chunk->hasChanged() or count($chunk->getTiles()) > 0 or count($chunk->getSavableEntities()) > 0){
if($trySave and $this->getAutoSave() and $chunk->isGenerated() and $chunk->hasChanged()){
$this->timings->syncChunkSaveTimer->startTiming();
try{
$this->provider->saveChunk($chunk);
@ -2593,7 +2592,6 @@ class World implements ChunkManager, Metadatable{
$this->timings->syncChunkSaveTimer->stopTiming();
}
}
}
foreach($this->getChunkListeners($x, $z) as $listener){
$listener->onChunkUnloaded($chunk);