TradeTransaction 5.46.0
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() : voidgetOffer()
php
public function getOffer() : \pocketmine\entity\npc\TradeOffergetTimes()
php
public function getTimes() : intvalidate()
php
public function validate() : void