Cancellable
public class EnchantItemEvent extends InventoryEvent implements Cancellable
Event.Result
transaction
Constructor | Description |
---|---|
EnchantItemEvent(@NotNull Player enchanter,
@NotNull InventoryView view,
@NotNull Block table,
@NotNull ItemStack item,
int level,
@NotNull Map<Enchantment,Integer> enchants,
int i) |
Modifier and Type | Method | Description |
---|---|---|
@NotNull Block |
getEnchantBlock() |
Gets the block being used to enchant the item
|
@NotNull Player |
getEnchanter() |
Gets the player enchanting the item
|
@NotNull 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 @NotNull HandlerList |
getHandlerList() |
|
@NotNull HandlerList |
getHandlers() |
|
@NotNull 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.
|
callEvent, getEventName, isAsynchronous
getInventory, getView, getViewers
public EnchantItemEvent(@NotNull @NotNull Player enchanter, @NotNull @NotNull InventoryView view, @NotNull @NotNull Block table, @NotNull @NotNull ItemStack item, int level, @NotNull @NotNull Map<Enchantment,Integer> enchants, int i)
@NotNull public @NotNull Player getEnchanter()
@NotNull public @NotNull Block getEnchantBlock()
@NotNull public @NotNull ItemStack getItem()
public int getExpLevelCost()
public void setExpLevelCost(int level)
level
- - cost in levels@NotNull public @NotNull 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 @NotNull HandlerList getHandlers()
getHandlers
in class InventoryEvent
@NotNull public static @NotNull HandlerList getHandlerList()
Copyright © 2020. All rights reserved.