Documentation

InventoryAction
in package

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

Table of Contents

$sourceItem  : Item
$targetItem  : Item
__construct()  : mixed
execute()  : void
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.
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
Called when the action is added to the specified InventoryTransaction.
onPreExecute()  : bool
Called by inventory transactions before any actions are processed. If this returns false, the transaction will be cancelled.
validate()  : void
Returns whether this action is currently valid. This should perform any necessary sanity checks.

Properties

Methods

__construct()

public __construct(Item $sourceItem, Item $targetItem) : mixed
Parameters
$sourceItem : Item
$targetItem : Item
Return values
mixed

execute()

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.

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

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