Skip to content

SlotChangeAction ​

class · pocketmine\inventory\transaction\action\SlotChangeAction · source

Extends InventoryAction

Represents an action causing a change in an inventory slot.

Properties ​

$inventory ​

php
public \pocketmine\inventory\Inventory $inventory

Methods ​

__construct() ​

php
public function __construct(\pocketmine\inventory\Inventory $inventory, int $inventorySlot, \pocketmine\item\Item $sourceItem, \pocketmine\item\Item $targetItem)

execute() ​

php
public function execute(\pocketmine\player\Player $source) : void

Sets the item into the target inventory.

getInventory() ​

php
public function getInventory() : \pocketmine\inventory\Inventory

Returns the inventory involved in this action.

getSlot() ​

php
public function getSlot() : int

Returns the slot in the inventory which this action modified.

validate() ​

php
public function validate(\pocketmine\player\Player $source) : void

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

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