Class PrepareAnvilEvent


public class PrepareAnvilEvent extends PrepareResultEvent
Called when an item is put in a slot for repair by an anvil.
  • Constructor Details

    • PrepareAnvilEvent

      @Internal public PrepareAnvilEvent(@NotNull @NotNull AnvilView inventory, @Nullable @Nullable ItemStack result)
  • Method Details

    • getInventory

      @NotNull public @NotNull AnvilInventory getInventory()
      Description copied from class: InventoryEvent
      Gets the primary Inventory involved in this transaction
      Overrides:
      getInventory in class InventoryEvent
      Returns:
      The upper inventory.
    • setResult

      public void setResult(@Nullable @Nullable ItemStack result)
      Set result item, may be null.

      Note: by default custom recipes in anvil are disabled you should define a repair cost on the anvil inventory greater or equals to zero in order to allow that.

      Overrides:
      setResult in class PrepareResultEvent
      Parameters:
      result - result item
    • getView

      @NotNull public @NotNull AnvilView getView()
      Description copied from class: InventoryEvent
      Gets the view object itself
      Overrides:
      getView in class InventoryEvent
      Returns:
      InventoryView