PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
pocketmine\inventory\transaction\action\InventoryAction Class Reference
+ Inheritance diagram for pocketmine\inventory\transaction\action\InventoryAction:
+ Collaboration diagram for pocketmine\inventory\transaction\action\InventoryAction:

Public Member Functions

 __construct (protected Item $sourceItem, protected Item $targetItem)
 
 execute (Player $source)
 
 getSourceItem ()
 
 getTargetItem ()
 
 onAddToTransaction (InventoryTransaction $transaction)
 
 onPreExecute (Player $source)
 
 validate (Player $source)
 

Detailed Description

Represents an action involving a change that applies in some way to an inventory or other item-source.

Definition at line 34 of file InventoryAction.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\inventory\transaction\action\InventoryAction::__construct ( protected Item  $sourceItem,
protected Item  $targetItem 
)

Definition at line 35 of file InventoryAction.php.

Member Function Documentation

◆ execute()

pocketmine\inventory\transaction\action\InventoryAction::execute ( Player  $source)
abstract

Performs 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.

Reimplemented in pocketmine\inventory\transaction\action\CreateItemAction, pocketmine\inventory\transaction\action\DestroyItemAction, pocketmine\inventory\transaction\action\DropItemAction, and pocketmine\inventory\transaction\action\SlotChangeAction.

◆ getSourceItem()

pocketmine\inventory\transaction\action\InventoryAction::getSourceItem ( )

Returns the item that was present before the action took place.

Definition at line 43 of file InventoryAction.php.

◆ getTargetItem()

pocketmine\inventory\transaction\action\InventoryAction::getTargetItem ( )

Returns the item that the action attempted to replace the source item with.

Definition at line 50 of file InventoryAction.php.

◆ onAddToTransaction()

pocketmine\inventory\transaction\action\InventoryAction::onAddToTransaction ( InventoryTransaction  $transaction)

Called when the action is added to the specified InventoryTransaction.

Reimplemented in pocketmine\inventory\transaction\action\SlotChangeAction.

Definition at line 64 of file InventoryAction.php.

◆ onPreExecute()

pocketmine\inventory\transaction\action\InventoryAction::onPreExecute ( Player  $source)

Called by inventory transactions before any actions are processed. If this returns false, the transaction will be cancelled.

Reimplemented in pocketmine\inventory\transaction\action\DropItemAction.

Definition at line 72 of file InventoryAction.php.

◆ validate()

pocketmine\inventory\transaction\action\InventoryAction::validate ( Player  $source)
abstract

The documentation for this class was generated from the following file: