Fixed Double Chest behavior

This commit is contained in:
Shoghi Cervantes
2014-10-29 12:57:26 +01:00
parent 50cfeaa393
commit afaa2cf722
4 changed files with 46 additions and 9 deletions

View File

@ -55,8 +55,6 @@ class Chest extends Spawnable implements InventoryHolder, Container{
for($i = 0; $i < $this->getSize(); ++$i){
$this->inventory->setItem($i, $this->getItem($i));
}
$this->checkPairing();
}
public function close(){
@ -158,6 +156,9 @@ class Chest extends Spawnable implements InventoryHolder, Container{
* @return ChestInventory|DoubleChestInventory
*/
public function getInventory(){
if($this->isPaired() and $this->doubleInventory === null){
$this->checkPairing();
}
return $this->doubleInventory instanceof DoubleChestInventory ? $this->doubleInventory : $this->inventory;
}