Code: PHP: public function onTransaction(InventoryTransactionEvent $event) { $trans = $event->getTransaction()->getTransactions(); $inv = $event->getTransaction()->getInventories(); $player = null; $chestBlock = null; foreach ($trans as $t) { foreach ($inv as $inventory) { $chest = $inventory->getHolder(); if ($chest instanceof Chest) { $chestBlock = $chest->getBlock(); $transaction = $t; } if ($chest instanceof Player) { $player = $chest; } } } if ($player != null && $chestBlock != null && isset($transaction)) { if($this->inArena($player)) { $config = new Config($this->getDataFolder() . "shop.yml", Config::YAML); $all = $config->get("Shop"); /* if(in_array($transaction->getTargetItem()->getId(), $all)){ $this->isShopping[$player->getName()] = "ja"; } */ $arena = $this->getArena($player); $chestTile = $player->getLevel()->getTile($chestBlock); if ($chestTile instanceof Chest) { $TargetItemID = $transaction->getTargetItem()->getId(); $TargetItemDamage = $transaction->getTargetItem()->getDamage(); $TargetItem = $transaction->getTargetItem(); $inventoryTrans = $chestTile->getInventory(); if($this->isShopping[$player->getName()] != "ja") { $zahl = 0; for ($i = 0; $i < count($all); $i += 2) { if ($TargetItemID == $all[$i]) { $zahl++; } } if($zahl == count($all)){ $this->isShopping[$player->getName()] = "ja"; } } if($this->isShopping[$player->getName()] != "ja") { $secondslot = $inventoryTrans->getItem(1)->getId(); if ($secondslot == Item::IRON_INGOT || $secondslot == Item::GOLD_INGOT || $secondslot == Item::BRICK) { $this->isShopping[$player->getName()] = "ja"; } } if($this->isShopping[$player->getName()] == "ja"){ if ($TargetItemID == Item::WOOL && $TargetItemDamage == 14) { $event->setCancelled(true); $config = new Config($this->getDataFolder() . "shop.yml", Config::YAML); $all = $config->get("Shop"); $chestTile->getInventory()->clearAll(); for ($i = 0; $i < count($all); $i = $i + 2) { $slot = $i / 2; $chestTile->getInventory()->setItem($slot, Item::get($all[$i], 0, 1)); } } $TransactionSlot = 0; for ($i = 0; $i < $inventoryTrans->getSize(); $i++) { if ($inventoryTrans->getItem($i)->getId() == $TargetItemID) { $TransactionSlot = $i; break; } } $secondslot = $inventoryTrans->getItem(1)->getId(); if ($TransactionSlot % 2 != 0 && ($secondslot == Item::IRON_INGOT || $secondslot == Item::GOLD_INGOT || $secondslot == Item::BRICK)) { $event->setCancelled(true); } if ($TargetItemID == Item::IRON_INGOT || $TargetItemID == Item::GOLD_INGOT || $TargetItemID == Item::BRICK) { $event->setCancelled(true); } if ($TransactionSlot % 2 == 0 && ($secondslot == Item::IRON_INGOT || $secondslot == Item::GOLD_INGOT || $secondslot == Item::BRICK)) { $iCost = $inventoryTrans->getItem($TransactionSlot + 1)->getId(); $aCost = $inventoryTrans->getItem($TransactionSlot + 1)->getCount(); $aoI = $player->getInventory()->all(Item::get($iCost)); $yourmoney = 0; foreach ($aoI as $currently) { $yourmoney += $currently->getCount(); } if ($yourmoney >= $aCost) { for ($i = 0; $i < $player->getInventory()->getMaxStackSize(); $i++) { if ($player->getInventory()->getItem($i)->getId() == $iCost) { $itemToRemove = $player->getInventory()->getItem($i); if ($itemToRemove->getCount() <= 1) { $player->getInventory()->clear($i); } else { $player->getInventory()->setItem($i, Item::get($iCost, 0, $itemToRemove->getCount() - $aCost)); } break; } } $player->getInventory()->addItem(clone Item::get($inventoryTrans->getItem($TransactionSlot)->getId(), $inventoryTrans->getItem($TransactionSlot)->getDamage(), $inventoryTrans->getItem($TransactionSlot)->getCount())); } $event->setCancelled(true); } if ($secondslot != Item::BRICK && $secondslot != Item::IRON_INGOT && $secondslot != Item::GOLD_INGOT) { $event->setCancelled(true); $config = new Config($this->getDataFolder() . "shop.yml", Config::YAML); $all = $config->get("Shop"); for ($i = 0; $i < count($all); $i += 2) { if ($TargetItemID == $all[$i]) { $chestTile->getInventory()->clearAll(); $suball = $all[$i + 1]; $slot = 0; for ($j = 0; $j < count($suball); $j++) { $chestTile->getInventory()->setItem($slot, Item::get($suball[$j][0], 0, $suball[$j][1])); $slot++; $chestTile->getInventory()->setItem($slot, Item::get($suball[$j][2], 0, $suball[$j][3])); $slot++; } break; } } $chestTile->getInventory()->setItem($chestTile->getInventory()->getSize() - 1, Item::get(Item::WOOL, 14, 1)); } } } } } }
Code: 2017-09-30 [12:15:54] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\inventory\InventoryTransactionEvent' to 'Bedwars v1.0.0': Call to undefined method pocketmine\inventory\transaction\InventoryTransaction::getTransactions() on BlawoHD\Bedwars 2017-09-30 [12:15:54] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\inventory\transaction\InventoryTransaction::getTransactions()" (EXCEPTION) in "BedWars - BlawoHD/src/BlawoHD/Bedwars" at line 903 2017-09-30 [12:15:54] [Server thread/DEBUG]: #0 src/pocketmine/plugin/MethodEventExecutor(38): BlawoHD\Bedwars->onTransaction(pocketmine\event\inventory\InventoryTransactionEvent object) 2017-09-30 [12:15:54] [Server thread/DEBUG]: #1 src/pocketmine/plugin/RegisteredListener(98): pocketmine\plugin\MethodEventExecutor->execute(BlawoHD\Bedwars object, pocketmine\event\inventory\InventoryTransactionEvent object) 2017-09-30 [12:15:54] [Server thread/DEBUG]: #2 src/pocketmine/plugin/PluginManager(721): pocketmine\plugin\RegisteredListener->callEvent(pocketmine\event\inventory\InventoryTransactionEvent object) 2017-09-30 [12:15:54] [Server thread/DEBUG]: #3 src/pocketmine/inventory/transaction/InventoryTransaction(245): pocketmine\plugin\PluginManager->callEvent(pocketmine\event\inventory\InventoryTransactionEvent object) 2017-09-30 [12:15:54] [Server thread/DEBUG]: #4 src/pocketmine/inventory/transaction/InventoryTransaction(257): pocketmine\inventory\transaction\InventoryTransaction->callExecuteEvent() 2017-09-30 [12:15:54] [Server thread/DEBUG]: #5 src/pocketmine/Player(2262): pocketmine\inventory\transaction\InventoryTransaction->execute() 2017-09-30 [12:15:54] [Server thread/DEBUG]: #6 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(131): pocketmine\Player->handleInventoryTransaction(pocketmine\network\mcpe\protocol\InventoryTransactionPacket object) 2017-09-30 [12:15:54] [Server thread/DEBUG]: #7 src/pocketmine/network/mcpe/protocol/InventoryTransactionPacket(149): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleInventoryTransaction(pocketmine\network\mcpe\protocol\InventoryTransactionPacket object) 2017-09-30 [12:15:54] [Server thread/DEBUG]: #8 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(91): pocketmine\network\mcpe\protocol\InventoryTransactionPacket->handle(pocketmine\network\mcpe\PlayerNetworkSessionAdapter object) 2017-09-30 [12:15:54] [Server thread/DEBUG]: #9 src/pocketmine/network/mcpe/protocol/BatchPacket(115): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(pocketmine\network\mcpe\protocol\InventoryTransactionPacket object) 2017-09-30 [12:15:54] [Server thread/DEBUG]: #10 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(91): pocketmine\network\mcpe\protocol\BatchPacket->handle(pocketmine\network\mcpe\PlayerNetworkSessionAdapter object) 2017-09-30 [12:15:54] [Server thread/DEBUG]: #11 src/pocketmine/Player(3001): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(pocketmine\network\mcpe\protocol\BatchPacket object) 2017-09-30 [12:15:54] [Server thread/DEBUG]: #12 src/pocketmine/network/mcpe/RakLibInterface(143): pocketmine\Player->handleDataPacket(pocketmine\network\mcpe\protocol\BatchPacket object) 2017-09-30 [12:15:54] [Server thread/DEBUG]: #13 src/raklib/server/ServerHandler(97): pocketmine\network\mcpe\RakLibInterface->handleEncapsulated(string 194.230.159.117:35339, raklib\protocol\EncapsulatedPacket object, integer 0) 2017-09-30 [12:15:54] [Server thread/DEBUG]: #14 src/pocketmine/network/mcpe/RakLibInterface(82): raklib\server\ServerHandler->handlePacket() 2017-09-30 [12:15:54] [Server thread/DEBUG]: #15 src/pocketmine/network/Network(89): pocketmine\network\mcpe\RakLibInterface->process() 2017-09-30 [12:15:54] [Server thread/DEBUG]: #16 src/pocketmine/Server(2498): pocketmine\network\Network->processInterfaces() 2017-09-30 [12:15:54] [Server thread/DEBUG]: #17 src/pocketmine/Server(2251): pocketmine\Server->tick() 2017-09-30 [12:15:54] [Server thread/DEBUG]: #18 src/pocketmine/Server(2130): pocketmine\Server->tickProcessor() 2017-09-30 [12:15:54] [Server thread/DEBUG]: #19 src/pocketmine/Server(1712): pocketmine\Server->start() 2017-09-30 [12:15:54] [Server thread/DEBUG]: #20 src/pocketmine/PocketMine(556): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string phar:///home/MCPE/BedWars/PocketMine-MP.phar/, string /home/MCPE/BedWars/, string /home/MCPE/BedWars/plugins/) 2017-09-30 [12:15:54] [Server thread/DEBUG]: #21 /home/MCPE/BedWars/PocketMine-MP.phar(1): require(string phar:///home/MCPE/BedWars/PocketMine-MP.phar/src/pocketmine/PocketMine.php)
Change this: PHP: $trans = $event->getTransaction()->getTransactions(); to this: PHP: $trans = $event->getTransaction()->getActions(); There was a little API change in PocketMine