Remove redundant duplicated code for sendContents() and sendSlot()

This commit is contained in:
Dylan K. Taylor
2017-09-19 19:07:12 +01:00
parent 136ab1dba1
commit 1323d89139
3 changed files with 5 additions and 101 deletions

View File

@ -403,12 +403,14 @@ abstract class BaseInventory implements Inventory{
}
$pk = new InventoryContentPacket();
for($i = 0; $i < $this->getSize(); ++$i){
//Using getSize() here allows PlayerInventory to report that it's 4 slots smaller than it actually is (armor hack)
for($i = 0, $size = $this->getSize(); $i < $size; ++$i){
$pk->items[$i] = $this->getItem($i);
}
foreach($target as $player){
if(($id = $player->getWindowId($this)) === -1 or $player->spawned !== true){
if(($id = $player->getWindowId($this)) === ContainerIds::NONE or $player->spawned !== true){
$this->close($player);
continue;
}
@ -431,7 +433,7 @@ abstract class BaseInventory implements Inventory{
$pk->item = $this->getItem($index);
foreach($target as $player){
if(($id = $player->getWindowId($this)) === -1){
if(($id = $player->getWindowId($this)) === ContainerIds::NONE){
$this->close($player);
continue;
}