Documentation

SlotChangeAction extends InventoryAction
in package

Represents an action causing a change in an inventory slot.

Table of Contents

$inventory  : Inventory
$sourceItem  : Item
$targetItem  : Item
$inventorySlot  : int
__construct()  : mixed
execute()  : void
Sets the item into the target inventory.
getInventory()  : Inventory
Returns the inventory involved in this action.
getSlot()  : int
Returns the slot in the inventory which this action modified.
getSourceItem()  : Item
Returns the item that was present before the action took place.
getTargetItem()  : Item
Returns the item that the action attempted to replace the source item with.
onAddToTransaction()  : void
Adds this action's target inventory to the transaction's inventory list.
onPreExecute()  : bool
Called by inventory transactions before any actions are processed. If this returns false, the transaction will be cancelled.
validate()  : void
Checks if the item in the inventory at the specified slot is the same as this action's source item.

Properties

Methods

execute()

Sets the item into the target inventory.

public execute(Player $source) : void
Parameters
$source : Player
Return values
void

getSlot()

Returns the slot in the inventory which this action modified.

public getSlot() : int
Return values
int

getSourceItem()

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

public getSourceItem() : Item
Return values
Item

getTargetItem()

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

public getTargetItem() : Item
Return values
Item

onPreExecute()

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

public onPreExecute(Player $source) : bool
Parameters
$source : Player
Return values
bool

Search results