程序包 org.bukkit.event.enchantment

# 类 EnchantItemEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.inventory.InventoryEvent
org.bukkit.event.enchantment.EnchantItemEvent

所有已实现的接口:
  `Cancellable`

public class EnchantItemEvent extends InventoryEvent implements Cancellable
成功附魔物品的事件 (在附魔台里面附魔的)

- ## 嵌套类概要

  ## 从类继承的嵌套类/接口 org.bukkit.event.Event

  `Event.Result`

- ## 字段概要

  ### 从类继承的字段 org.bukkit.event.inventory.InventoryEvent

  `transaction`

- ## 构造器概要

  构造器
  构造器
  说明
  `EnchantItemEvent(@NotNull Player enchanter, @NotNull InventoryView view, @NotNull Block table, @NotNull ItemStack item, int level, @NotNull Map<Enchantment,Integer> enchants, @NotNull Enchantment enchantmentHint, int levelHint, int i)`

- ## 方法概要

  修饰符和类型
  方法
  说明
  `@NotNull Block`
  `getEnchantBlock()`
  获取附魔这个物品的方块。
  `@NotNull Player`
  `getEnchanter()`
  获取附魔这个物品的玩家。
  `@NotNull Enchantment`
  `getEnchantmentHint()`
  Get the `Enchantment` that was displayed as a hint to the player on the selected enchantment offer.
  `@NotNull Map<Enchantment,Integer>`
  `getEnchantsToAdd()`
  获取被加到物品中的附魔的Map (等级, 附魔种类)（若要修改请直接修改Map） .
  `int`
  `getExpLevelCost()`
  获取花费的经验等级(最低), 这个等级以数字形式显示在附魔台界面中附魔选项的右侧.
  `static @NotNull HandlerList`
  `getHandlerList()`
  `@NotNull HandlerList`
  `getHandlers()`
  `@NotNull ItemStack`
  `getItem()`
  获取被附魔的物品(可改动).
  `int`
  `getLevelHint()`
  Get the level of the enchantment that was displayed as a hint to the player on the selected enchantment offer.
  `boolean`
  `isCancelled()`
  获取这个事件是否被取消.一个被取消的事件不会在服务器里执行，但是仍然会传递事件到其他插件.
  `void`
  `setCancelled(boolean cancel)`
  取消这个事件.
  `void`
  `setExpLevelCost(int level)`
  设置花费的经验等级(最低), 这个等级以数字形式显示在附魔台界面中附魔选项的右侧.
  `int`
  `whichButton()`
  获取玩家点击的附魔的按钮。

  ### 从类继承的方法 org.bukkit.event.inventory.InventoryEvent

  `getInventory, getView, getViewers`

  ### 从类继承的方法 org.bukkit.event.Event

  `getEventName, isAsynchronous`

  ### 从类继承的方法 java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 构造器详细资料

  - ### EnchantItemEvent

    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, @NotNull @NotNull Enchantment enchantmentHint, int levelHint, int i)

- ## 方法详细资料

  - ### getEnchanter

    @NotNull public @NotNull Player getEnchanter()
    获取附魔这个物品的玩家。

    原文: Gets the player enchanting the item

    返回:
      附魔这个物品的玩家

  - ### getEnchantBlock

    @NotNull public @NotNull Block getEnchantBlock()
    获取附魔这个物品的方块。

    原文: Gets the block being used to enchant the item

    返回:
      附魔这个物品的方块

  - ### getItem

    @NotNull public @NotNull ItemStack getItem()
    获取被附魔的物品(可改动).

    原文: Gets the item to be enchanted (can be modified)

    返回:
      被附魔的物品

  - ### getExpLevelCost

    public int getExpLevelCost()
    获取花费的经验等级(最低), 这个等级以数字形式显示在附魔台界面中附魔选项的右侧.

    原文: Gets the cost (minimum level) which is displayed as a number on the right hand side of the enchantment offer.

    返回:
      花费的经验等级

  - ### setExpLevelCost

    public void setExpLevelCost(int level)
    设置花费的经验等级(最低), 这个等级以数字形式显示在附魔台界面中附魔选项的右侧.

    原文: Sets the cost (minimum level) which is displayed as a number on the right hand side of the enchantment offer.

    参数:
      `level` - - 花费的经验等级

  - ### getEnchantsToAdd

    @NotNull public @NotNull Map<Enchantment,Integer> getEnchantsToAdd()
    获取被加到物品中的附魔的Map (等级, 附魔种类)（若要修改请直接修改Map） . 注意: 不能被添加 到物品中的附魔会被忽略哦。

    原文: Get map of enchantment (levels, keyed by type) to be added to item - (modify map returned to change values). Note: Any enchantments not - allowed for the item will be ignored

    返回:
      被加到物品中的附魔的Map (等级, 附魔种类)

  - ### getEnchantmentHint

    @NotNull public @NotNull Enchantment getEnchantmentHint()
    Get the `Enchantment` that was displayed as a hint to the player on the selected enchantment offer.
    返回:
      the hinted enchantment

  - ### getLevelHint

    public int getLevelHint()
    Get the level of the enchantment that was displayed as a hint to the player on the selected enchantment offer.
    返回:
      the level of the hinted enchantment

  - ### whichButton

    public int whichButton()
    获取玩家点击的附魔的按钮。

    原文: Which button was pressed to initiate the enchanting.

    返回:
      按钮的序号 (0, 1, 2).

  - ### isCancelled

    public boolean isCancelled()
    从接口复制的说明: `Cancellable`
    获取这个事件是否被取消.一个被取消的事件不会在服务器里执行，但是仍然会传递事件到其他插件.

    原文：Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

    指定者:
      `isCancelled` 在接口中 `Cancellable`
    返回:
      如果事件已经被取消，则为true

  - ### setCancelled

    public void setCancelled(boolean cancel)
    从接口复制的说明: `Cancellable`
    取消这个事件. 一个被取消的事件不会在 服务器里执行，但是仍然会传递事件到其他插件.

    原文：Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

    指定者:
      `setCancelled` 在接口中 `Cancellable`
    参数:
      `cancel` - 如果你想取消这个事件，则为true

  - ### getHandlers

    @NotNull public @NotNull HandlerList getHandlers()
    覆盖:
      `getHandlers` 在类中 `InventoryEvent`

  - ### getHandlerList

    @NotNull public static @NotNull HandlerList getHandlerList()