Skip to content

TradeTransaction 5.46.0 ​

class · pocketmine\inventory\transaction\TradeTransaction · source

Extends InventoryTransaction

Making a trade with a villager or wandering trader: the items consumed from the payment slots must pay for the trade $times times, and the item taken must be what the trade gives. On success the trade's uses go up, the trader gains experience and the player gets 3-6 experience per trade (vanilla).

Methods ​

__construct() ​

php
public function __construct(\pocketmine\player\Player $source, \pocketmine\entity\npc\Trader $trader, \pocketmine\entity\npc\TradeOffer $offer, int $times, array $actions = [])

execute() ​

php
public function execute() : void

getOffer() ​

php
public function getOffer() : \pocketmine\entity\npc\TradeOffer

getTimes() ​

php
public function getTimes() : int

validate() ​

php
public function validate() : void

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.