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
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
FieldsModifier and TypeFieldDescriptionfinal org.bukkit.inventory.ItemStackThe item in the left slot of the anvil.final org.bukkit.entity.PlayerThe player interacting with the anvil.final StringThe text entered by the player to rename the item.final intThe repair cost associated with the anvil operation.final org.bukkit.inventory.ItemStackThe item that would be the result of the anvil operation.final org.bukkit.inventory.ItemStackThe item in the right slot of the anvil. -
Constructor Summary
ConstructorsConstructorDescriptionAnvilContext(org.bukkit.event.inventory.PrepareAnvilEvent event) Constructs a new AnvilContext with the given PrepareAnvilEvent. -
Method Summary
Modifier and TypeMethodDescriptionvoidrepairCost(int levelCost) Sets the repair cost for the anvil operation.voidresult(org.bukkit.inventory.ItemStack result) Sets the result of the anvil operation.
-
Field Details
-
player
public final org.bukkit.entity.Player playerThe player interacting with the anvil. -
right
public final org.bukkit.inventory.ItemStack rightThe item in the right slot of the anvil. -
left
public final org.bukkit.inventory.ItemStack leftThe item in the left slot of the anvil. -
result
public final org.bukkit.inventory.ItemStack resultThe item that would be the result of the anvil operation. -
renameText
The text entered by the player to rename the item. -
repairCost
public final int repairCostThe 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.
-