java.lang.Object
org.cloudburstmc.server.inventory.transaction.action.InventoryAction
org.cloudburstmc.server.inventory.transaction.action.DropItemAction

public class DropItemAction extends InventoryAction
Author:
CreeperFace
  • Constructor Details

    • DropItemAction

      public DropItemAction(org.cloudburstmc.api.item.ItemStack source, org.cloudburstmc.api.item.ItemStack target)
  • Method Details

    • isValid

      public boolean isValid(CloudPlayer 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(CloudPlayer 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(CloudPlayer 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(CloudPlayer 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(CloudPlayer 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