Class DropItemAction
java.lang.Object
cn.nukkit.inventory.transaction.action.InventoryAction
cn.nukkit.inventory.transaction.action.DropItemAction
- Author:
- CreeperFace
-
Field Summary
Fields inherited from class cn.nukkit.inventory.transaction.action.InventoryAction
sourceItem, targetItem
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Drops the target item in front of the player.boolean
Verifies that the source item of a drop-item action must be air.void
onExecuteFail
(Player source) Performs additional actions when this inventory-action did not complete successfully.void
onExecuteSuccess
(Player source) Performs additional actions when this inventory-action completed successfully.boolean
onPreExecute
(Player source) Called by inventory transactions before any actions are processed.toString()
Methods inherited from class cn.nukkit.inventory.transaction.action.InventoryAction
getCreationTime, getSourceItem, getTargetItem, onAddToTransaction
-
Constructor Details
-
DropItemAction
-
-
Method Details
-
isValid
Verifies that the source item of a drop-item action must be air. This is not strictly necessary, just a sanity check.- Specified by:
isValid
in classInventoryAction
- Parameters:
source
- player- Returns:
- valid
-
onPreExecute
Description copied from class:InventoryAction
Called by inventory transactions before any actions are processed. If this returns false, the transaction will be cancelled.- Overrides:
onPreExecute
in classInventoryAction
- Parameters:
source
- player- Returns:
- cancelled
-
execute
Drops the target item in front of the player.- Specified by:
execute
in classInventoryAction
- Parameters:
source
- player- Returns:
- successfully executed
-
onExecuteSuccess
Description copied from class:InventoryAction
Performs additional actions when this inventory-action completed successfully.- Specified by:
onExecuteSuccess
in classInventoryAction
- Parameters:
source
- player
-
onExecuteFail
Description copied from class:InventoryAction
Performs additional actions when this inventory-action did not complete successfully.- Specified by:
onExecuteFail
in classInventoryAction
- Parameters:
source
- player
-
toString
- Overrides:
toString
in classInventoryAction
-