Improved inventory and window allocation, fixes #2200

This commit is contained in:
Shoghi Cervantes
2014-10-20 09:48:11 +02:00
parent 2f8267aa1e
commit 15de0eece7
4 changed files with 39 additions and 9 deletions

View File

@@ -1185,8 +1185,8 @@ abstract class Entity extends Location implements Metadatable{
if($this->chunk instanceof FullChunk){
$this->chunk->removeEntity($this);
}
if(($level = $this->level) instanceof Level){
$level->removeEntity($this);
if($this->level instanceof Level){
$this->level->removeEntity($this);
}
$this->despawnFromAll();
$this->level = null;

View File

@@ -226,4 +226,15 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
return $d;
}
public function close(){
if(!$this->closed){
var_dump("CLOSED");
foreach($this->getInventory()->getViewers() as $player){
$this->getInventory()->close($player);
}
$this->inventory = null;
parent::close();
}
}
}