Improved chunk saving times by not marking it as changed when Players are added/removed

This commit is contained in:
Shoghi Cervantes 2015-01-04 23:07:08 +01:00
parent c8b5c023cd
commit 7a0118820c
No known key found for this signature in database
GPG Key ID: 78464DB0A7837F89
2 changed files with 6 additions and 4 deletions

View File

@ -766,8 +766,6 @@ abstract class Entity extends Location implements Metadatable{
$this->despawnFromAll();
if($this instanceof Player){
foreach($this->usedChunks as $index => $d){
$X = null;
$Z = null;
Level::getXZ($index, $X, $Z);
$this->unloadChunk($X, $Z);
}

View File

@ -244,12 +244,16 @@ abstract class BaseFullChunk implements FullChunk{
public function addEntity(Entity $entity){
$this->entities[$entity->getId()] = $entity;
$this->hasChanged = true;
if(!($entity instanceof Player)){
$this->hasChanged = true;
}
}
public function removeEntity(Entity $entity){
unset($this->entities[$entity->getId()]);
$this->hasChanged = true;
if(!($entity instanceof Player)){
$this->hasChanged = true;
}
}
public function addTile(Tile $tile){