DropItemAction
extends InventoryAction
in package
Represents an action involving dropping an item into the world.
Table of Contents
- $sourceItem : Item
- $targetItem : Item
- __construct() : mixed
- execute() : void
- Drops the target item in front of the player.
- 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
$sourceItem
protected
Item
$sourceItem
$targetItem
protected
Item
$targetItem
Methods
__construct()
public
__construct(Item $targetItem) : mixed
Parameters
- $targetItem : Item
Return values
mixed —execute()
Drops the target item in front of the player.
public
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 —onAddToTransaction()
Called when the action is added to the specified InventoryTransaction.
public
onAddToTransaction(InventoryTransaction $transaction) : void
Parameters
- $transaction : InventoryTransaction
Return values
void —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 —validate()
Returns whether this action is currently valid. This should perform any necessary sanity checks.
public
validate(Player $source) : void
Parameters
- $source : Player