Skip to content
This repository has been archived by the owner on Apr 11, 2022. It is now read-only.

Commit

Permalink
Fixed #9
Browse files Browse the repository at this point in the history
  • Loading branch information
MinecrafterJPN committed Jan 4, 2015
1 parent 4250161 commit ad4660a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/ChestShop/EventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use pocketmine\level\Position;
use pocketmine\math\Vector3;
use pocketmine\tile\Chest as TileChest;
use pocketmine\block\Chest as BlockChest;

class EventListener implements Listener
{
Expand Down Expand Up @@ -55,7 +54,7 @@ public function onPlayerInteract(PlayerInteractEvent $event)
$itemNum = 0;
$pID = $shopInfo['productID'];
$pMeta = $shopInfo['productMeta'];
for ($i = 0; $i < BlockChest::SLOTS; $i++) {
for ($i = 0; $i < $chest->getSize(); $i++) {
$item = $chest->getInventory()->getItem($i);
// use getDamage() method to get metadata of item
if ($item->getID() === $pID and $item->getDamage() === $pMeta) $itemNum += $item->getCount();
Expand All @@ -72,7 +71,7 @@ public function onPlayerInteract(PlayerInteractEvent $event)
$player->getInventory()->addItem(clone Item::get((int)$shopInfo['productID'], (int)$shopInfo['productMeta'], (int)$shopInfo['saleNum']));

$tmpNum = $shopInfo['saleNum'];
for ($i = 0; $i < BlockChest::SLOTS; $i++) {
for ($i = 0; $i < $chest->getSize(); $i++) {
$item = $chest->getInventory()->getItem($i);
// Use getDamage() method to get metadata of item
if ($item->getID() === $pID and $item->getDamage() === $pMeta) {
Expand Down

0 comments on commit ad4660a

Please sign in to comment.