DestroyItemAction
extends InventoryAction
in package
This action type shows up when a creative player puts an item into the creative inventory menu to destroy it.
The output is the item destroyed. You can think of this action type like setting an item into /dev/null
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
$sourceItem
protected
Item
$sourceItem
$targetItem
protected
Item
$targetItem
Methods
__construct()
public
__construct(Item $targetItem) : mixed
Parameters
- $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
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