Cancellable
public class EnchantItemEvent extends InventoryEvent implements Cancellable
Event.Result
transaction
Constructor | Description |
---|---|
EnchantItemEvent(Player enchanter,
InventoryView view,
Block table,
ItemStack item,
int level,
Map<Enchantment,Integer> enchants,
int i) |
Modifier and Type | Method | Description |
---|---|---|
Block |
getEnchantBlock() |
Gets the block being used to enchant the item
|
Player |
getEnchanter() |
Gets the player enchanting the item
|
Map<Enchantment,Integer> |
getEnchantsToAdd() |
Get map of enchantment (levels, keyed by type) to be added to item
(modify map returned to change values).
|
int |
getExpLevelCost() |
Gets the cost (minimum level) which is displayed as a number on the right
hand side of the enchantment offer.
|
static HandlerList |
getHandlerList() |
|
HandlerList |
getHandlers() |
|
ItemStack |
getItem() |
Gets the item to be enchanted (can be modified)
|
boolean |
isCancelled() |
Gets the cancellation state of this event.
|
void |
setCancelled(boolean cancel) |
Sets the cancellation state of this event.
|
void |
setExpLevelCost(int level) |
Sets the cost (minimum level) which is displayed as a number on the right
hand side of the enchantment offer.
|
int |
whichButton() |
Which button was pressed to initiate the enchanting.
|
getEventName, isAsynchronous
getInventory, getView, getViewers
public EnchantItemEvent(@NotNull Player enchanter, @NotNull InventoryView view, @NotNull Block table, @NotNull ItemStack item, int level, @NotNull Map<Enchantment,Integer> enchants, int i)
@NotNull public Player getEnchanter()
@NotNull public Block getEnchantBlock()
@NotNull public ItemStack getItem()
public int getExpLevelCost()
public void setExpLevelCost(int level)
level
- - cost in levels@NotNull public Map<Enchantment,Integer> getEnchantsToAdd()
public int whichButton()
public boolean isCancelled()
Cancellable
isCancelled
in interface Cancellable
public void setCancelled(boolean cancel)
Cancellable
setCancelled
in interface Cancellable
cancel
- true if you wish to cancel this event@NotNull public HandlerList getHandlers()
getHandlers
in class InventoryEvent
@NotNull public static HandlerList getHandlerList()
Copyright © 2019. All rights reserved.