Class AnvilContext

java.lang.Object
com.github.darksoulq.abyssallib.server.event.context.Context<org.bukkit.event.inventory.PrepareAnvilEvent>
com.github.darksoulq.abyssallib.server.event.context.item.AnvilContext

public class AnvilContext extends Context<org.bukkit.event.inventory.PrepareAnvilEvent>
Represents the context of an anvil preparation event, containing details about the player, the items in the anvil, the resulting item, the rename text, and the repair cost.

This class provides access to the player interacting with the anvil, the items involved, and the ability to modify the result and repair cost for the anvil operation.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final org.bukkit.inventory.ItemStack
    The item in the left slot of the anvil.
    final org.bukkit.entity.Player
    The player interacting with the anvil.
    final String
    The text entered by the player to rename the item.
    final int
    The repair cost associated with the anvil operation.
    final org.bukkit.inventory.ItemStack
    The item that would be the result of the anvil operation.
    final org.bukkit.inventory.ItemStack
    The item in the right slot of the anvil.

    Fields inherited from class Context

    event
  • Constructor Summary

    Constructors
    Constructor
    Description
    AnvilContext(org.bukkit.event.inventory.PrepareAnvilEvent event)
    Constructs a new AnvilContext with the given PrepareAnvilEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    repairCost(int levelCost)
    Sets the repair cost for the anvil operation.
    void
    result(org.bukkit.inventory.ItemStack result)
    Sets the result of the anvil operation.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • player

      public final org.bukkit.entity.Player player
      The player interacting with the anvil.
    • left

      public final org.bukkit.inventory.ItemStack left
      The item in the left slot of the anvil.
    • result

      public final org.bukkit.inventory.ItemStack result
      The item that would be the result of the anvil operation.
    • renameText

      public final String renameText
      The text entered by the player to rename the item.
    • repairCost

      public final int repairCost
      The repair cost associated with the anvil operation.
  • Constructor Details

    • AnvilContext

      public AnvilContext(org.bukkit.event.inventory.PrepareAnvilEvent event)
      Constructs a new AnvilContext with the given PrepareAnvilEvent. Initializes the context using the event data.
      Parameters:
      event - The PrepareAnvilEvent associated with this context.
  • Method Details

    • result

      public void result(org.bukkit.inventory.ItemStack result)
      Sets the result of the anvil operation.
      Parameters:
      result - The item to set as the result of the anvil operation.
    • repairCost

      public void repairCost(int levelCost)
      Sets the repair cost for the anvil operation.
      Parameters:
      levelCost - The level cost to set.