PocketMine-MP 5.44.4 git-bc94a0da0c87abe7eb99d229a9ec672b3c405d11
Loading...
Searching...
No Matches
pocketmine\inventory\transaction\action\SlotChangeAction Class Reference
+ Inheritance diagram for pocketmine\inventory\transaction\action\SlotChangeAction:
+ Collaboration diagram for pocketmine\inventory\transaction\action\SlotChangeAction:

Public Member Functions

 __construct (protected InventoryWindow $inventoryWindow, private int $inventorySlot, Item $sourceItem, Item $targetItem)
 
 execute (Player $source)
 
 getInventoryWindow ()
 
 getSlot ()
 
 getSourceItem ()
 
 getTargetItem ()
 
 onPreExecute (Player $source)
 
 validate (Player $source)
 

Detailed Description

Represents an action causing a change in an inventory slot.

Definition at line 36 of file SlotChangeAction.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\inventory\transaction\action\SlotChangeAction::__construct ( protected InventoryWindow $inventoryWindow,
private int $inventorySlot,
Item $sourceItem,
Item $targetItem )

Definition at line 37 of file SlotChangeAction.php.

Member Function Documentation

◆ execute()

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

Sets the item into the target inventory.

Reimplemented from pocketmine\inventory\transaction\action\InventoryAction.

Definition at line 92 of file SlotChangeAction.php.

◆ getInventoryWindow()

pocketmine\inventory\transaction\action\SlotChangeAction::getInventoryWindow ( )

Returns the inventory window involved in this action.

Definition at line 49 of file SlotChangeAction.php.

◆ getSlot()

pocketmine\inventory\transaction\action\SlotChangeAction::getSlot ( )

Returns the slot in the inventory which this action modified.

Definition at line 56 of file SlotChangeAction.php.

◆ getSourceItem()

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

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

Definition at line 42 of file InventoryAction.php.

◆ getTargetItem()

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

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

Definition at line 49 of file InventoryAction.php.

◆ onPreExecute()

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

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 64 of file InventoryAction.php.

◆ validate()

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

Checks if the item in the inventory at the specified slot is the same as this action's source item.

Exceptions
TransactionValidationException

Reimplemented from pocketmine\inventory\transaction\action\InventoryAction.

Definition at line 65 of file SlotChangeAction.php.


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