InventoryAction
Represents an action involving a change that applies in some way to an inventory or other item-source.
Properties
$sourceItem
php
public \pocketmine\item\Item $sourceItem$targetItem
php
public \pocketmine\item\Item $targetItemMethods
__construct()
php
public function __construct(\pocketmine\item\Item $sourceItem, \pocketmine\item\Item $targetItem)execute()
php
abstract public function execute(\pocketmine\player\Player $source) : voidPerforms actions needed to complete the inventory-action server-side. This will only be called if the transaction which it is part of is considered valid.
getSourceItem()
php
public function getSourceItem() : \pocketmine\item\ItemReturns the item that was present before the action took place.
getTargetItem()
php
public function getTargetItem() : \pocketmine\item\ItemReturns the item that the action attempted to replace the source item with.
onAddToTransaction()
php
public function onAddToTransaction(\pocketmine\inventory\transaction\InventoryTransaction $transaction) : voidDeprecated
Deprecated.
Called when the action is added to the specified InventoryTransaction.
onPreExecute()
php
public function onPreExecute(\pocketmine\player\Player $source) : boolCalled by inventory transactions before any actions are processed. If this returns false, the transaction will be cancelled.
validate()
php
abstract public function validate(\pocketmine\player\Player $source) : voidReturns whether this action is currently valid. This should perform any necessary sanity checks.
