Cancellable
public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellable
Event.Result
transaction
Constructor | Description |
---|---|
PrepareItemEnchantEvent(Player enchanter,
InventoryView view,
Block table,
ItemStack item,
EnchantmentOffer[] offers,
int bonus) |
Modifier and Type | Method | Description |
---|---|---|
Block |
getEnchantBlock() |
Gets the block being used to enchant the item
|
Player |
getEnchanter() |
Gets the player enchanting the item
|
int |
getEnchantmentBonus() |
Get enchantment bonus in effect - corresponds to number of bookshelves
|
int[] |
getExpLevelCostsOffered() |
Deprecated.
Use
getOffers() instead of this method |
static HandlerList |
getHandlerList() |
|
HandlerList |
getHandlers() |
|
ItemStack |
getItem() |
Gets the item to be enchanted.
|
EnchantmentOffer[] |
getOffers() |
Get a list of available
EnchantmentOffer for the player. |
boolean |
isCancelled() |
Gets the cancellation state of this event.
|
void |
setCancelled(boolean cancel) |
Sets the cancellation state of this event.
|
callEvent, getEventName, isAsynchronous
getInventory, getView, getViewers
public PrepareItemEnchantEvent(@NotNull Player enchanter, @NotNull InventoryView view, @NotNull Block table, @NotNull ItemStack item, @NotNull EnchantmentOffer[] offers, int bonus)
@NotNull public Player getEnchanter()
@NotNull public Block getEnchantBlock()
@NotNull public ItemStack getItem()
@NotNull public int[] getExpLevelCostsOffered()
getOffers()
instead of this method@NotNull public EnchantmentOffer[] getOffers()
EnchantmentOffer
for the player. You can
modify the values to change the available offers for the player. An offer
may be null, if there isn't a enchantment offer at a specific slot. There
are 3 slots in the enchantment table available to modify.public int getEnchantmentBonus()
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 © 2020. All rights reserved.