Fixed permission-related memory leak

This commit is contained in:
Shoghi Cervantes 2014-11-18 13:42:24 +01:00
parent c07b0ff35b
commit 9fd6a695f6
2 changed files with 10 additions and 0 deletions

View File

@ -1059,6 +1059,9 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$revert = true;
$this->nextChunkOrderRun = 0;
}else{
if($this->chunk instanceof FullChunk){
$this->chunk->removeEntity($this);
}
$this->chunk = $chunk;
}
}
@ -2340,12 +2343,18 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->loadQueue = [];
$this->hasSpawned = [];
$this->spawnPosition = null;
$this->perm->clearPermissions();
$this->perm = null;
unset($this->buffer);
}
$this->server->removePlayer($this);
}
public function __debugInfo(){
return [];
}
/**
* Handles player data saving
*/

View File

@ -176,6 +176,7 @@ abstract class Entity extends Location implements Metadatable{
$this->id = Entity::$entityCount++;
$this->justCreated = true;
$this->namedtag = $nbt;
$this->chunk = $chunk;
$this->setLevel($chunk->getProvider()->getLevel());
$this->server = $chunk->getProvider()->getLevel()->getServer();