Class DropItemAction

java.lang.Object
cn.nukkit.inventory.transaction.action.InventoryAction
cn.nukkit.inventory.transaction.action.DropItemAction

public class DropItemAction extends InventoryAction
Author:
CreeperFace
  • Constructor Details

    • DropItemAction

      public DropItemAction(Item source, Item target)
  • Method Details

    • isValid

      public boolean isValid(Player source)
      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 class InventoryAction
      Parameters:
      source - player
      Returns:
      valid
    • onPreExecute

      public boolean onPreExecute(Player source)
      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 class InventoryAction
      Parameters:
      source - player
      Returns:
      cancelled
    • execute

      public boolean execute(Player source)
      Drops the target item in front of the player.
      Specified by:
      execute in class InventoryAction
      Parameters:
      source - player
      Returns:
      successfully executed
    • onExecuteSuccess

      public void onExecuteSuccess(Player source)
      Description copied from class: InventoryAction
      Performs additional actions when this inventory-action completed successfully.
      Specified by:
      onExecuteSuccess in class InventoryAction
      Parameters:
      source - player
    • onExecuteFail

      public void onExecuteFail(Player source)
      Description copied from class: InventoryAction
      Performs additional actions when this inventory-action did not complete successfully.
      Specified by:
      onExecuteFail in class InventoryAction
      Parameters:
      source - player
    • toString

      public String toString()
      Overrides:
      toString in class InventoryAction