程序包 org.bukkit.enchantments

# 类 Enchantment

java.lang.Object
org.bukkit.enchantments.Enchantment

所有已实现的接口:
  `Keyed`, `Translatable`

直接已知子类:
  `EnchantmentWrapper`

public abstract class Enchantment extends Object implements Keyed, Translatable
附魔类.

- ## 字段概要

  字段
  修饰符和类型
  字段
  说明
  `static final Enchantment`
  `AQUA_AFFINITY`
  附魔：水下速掘
  `static final Enchantment`
  `BANE_OF_ARTHROPODS`
  附魔：节肢杀手
  `static final Enchantment`
  `BINDING_CURSE`
  附魔：绑定诅咒
  `static final Enchantment`
  `BLAST_PROTECTION`
  附魔：爆炸保护
  `static final Enchantment`
  `BREACH`
  Reduces armor effectiveness against maces
  `static final Enchantment`
  `CHANNELING`
  附魔：引雷 (三叉戟)
  `static final Enchantment`
  `DENSITY`
  Increases fall damage of maces
  `static final Enchantment`
  `DEPTH_STRIDER`
  附魔：深海探索者
  `static final Enchantment`
  `EFFICIENCY`
  附魔：效率
  `static final Enchantment`
  `FEATHER_FALLING`
  附魔：摔落保护
  `static final Enchantment`
  `FIRE_ASPECT`
  附魔：火焰附加
  `static final Enchantment`
  `FIRE_PROTECTION`
  附魔：火焰保护
  `static final Enchantment`
  `FLAME`
  附魔：火矢 (弓)
  `static final Enchantment`
  `FORTUNE`
  附魔：时运
  `static final Enchantment`
  `FROST_WALKER`
  附魔：冰霜行者
  `static final Enchantment`
  `IMPALING`
  附魔：穿刺 (三叉戟)
  `static final Enchantment`
  `INFINITY`
  附魔：无限 (弓)
  `static final Enchantment`
  `KNOCKBACK`
  附魔：击退
  `static final Enchantment`
  `LOOTING`
  附魔：抢夺
  `static final Enchantment`
  `LOYALTY`
  附魔：忠诚 (三叉戟)
  `static final Enchantment`
  `LUCK_OF_THE_SEA`
  附魔：海之眷顾 (钓鱼杆)
  `static final Enchantment`
  `LURE`
  附魔：饵钓 (钓鱼杆)
  `static final Enchantment`
  `MENDING`
  附魔：经验修补
  `static final Enchantment`
  `MULTISHOT`
  附魔：多重射击 (弩)
  `static final Enchantment`
  `PIERCING`
  附魔：穿透 (弩)
  `static final Enchantment`
  `POWER`
  附魔：力量 (弓)
  `static final Enchantment`
  `PROJECTILE_PROTECTION`
  附魔：弹射物保护
  `static final Enchantment`
  `PROTECTION`
  附魔：保护
  `static final Enchantment`
  `PUNCH`
  附魔：冲击 (弓)
  `static final Enchantment`
  `QUICK_CHARGE`
  附魔：快速装填 (弩)
  `static final Enchantment`
  `RESPIRATION`
  附魔：水下呼吸
  `static final Enchantment`
  `RIPTIDE`
  附魔：激流 (三叉戟)
  `static final Enchantment`
  `SHARPNESS`
  附魔：锋利
  `static final Enchantment`
  `SILK_TOUCH`
  附魔：精准采集
  `static final Enchantment`
  `SMITE`
  附魔：亡灵杀手
  `static final Enchantment`
  `SOUL_SPEED`
  附魔：灵魂疾行
  `static final Enchantment`
  `SWEEPING_EDGE`
  附魔：横扫之刃
  `static final Enchantment`
  `SWIFT_SNEAK`
  附魔：迅捷潜行
  `static final Enchantment`
  `THORNS`
  附魔：荆棘
  `static final Enchantment`
  `UNBREAKING`
  附魔：耐久
  `static final Enchantment`
  `VANISHING_CURSE`
  附魔：消失诅咒
  `static final Enchantment`
  `WIND_BURST`
  Emits wind burst upon hitting enemy

- ## 构造器概要

  构造器
  构造器
  说明
  `Enchantment()`

- ## 方法概要

  修饰符和类型
  方法
  说明
  `abstract boolean`
  `canEnchantItem(@NotNull ItemStack item)`
  检查该附魔支不支持某物品.
  `abstract boolean`
  `conflictsWith(@NotNull Enchantment other)`
  检查这个附魔是否与另外的附魔冲突.
  `static @Nullable Enchantment`
  `getByKey(@Nullable NamespacedKey key)`
  已过时。
  仅为保障作向后兼容性, 请使用 `Registry.get(NamespacedKey)` instead
  `static @Nullable Enchantment`
  `getByName(@Nullable String name)`
  已过时。
  这些附魔的命名简直糟透了，建议使用 `getByKey(org.bukkit.NamespacedKey)`.
  `abstract @NotNull EnchantmentTarget`
  `getItemTarget()`
  已过时。
  附魔分组现由标签管理, 而非分类
  `abstract int`
  `getMaxLevel()`
  得到这个附魔所支持的最大等级.
  `abstract @NotNull String`
  `getName()`
  已过时。
  这些附魔的命名简直糟透了, 建议使用 `Keyed.getKey()`.
  `abstract int`
  `getStartLevel()`
  得到这个附魔的最小等级.
  `abstract boolean`
  `isCursed()`
  已过时。
  诅咒附魔不再是特殊的.
  `abstract boolean`
  `isTreasure()`
  已过时。
  附魔类型现由标签管理
  `static @NotNull Enchantment[]`
  `values()`
  已过时。
  请使用 `Registry.ENCHANTMENT.iterator()`

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

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

  ### 从接口继承的方法 org.bukkit.Keyed

  `getKey`

  ### 从接口继承的方法 org.bukkit.Translatable

  `getTranslationKey`

- ## 字段详细资料

  - ### PROTECTION

    public static final Enchantment PROTECTION
    附魔：保护

  - ### FIRE_PROTECTION

    public static final Enchantment FIRE_PROTECTION
    附魔：火焰保护

  - ### FEATHER_FALLING

    public static final Enchantment FEATHER_FALLING
    附魔：摔落保护

  - ### BLAST_PROTECTION

    public static final Enchantment BLAST_PROTECTION
    附魔：爆炸保护

  - ### PROJECTILE_PROTECTION

    public static final Enchantment PROJECTILE_PROTECTION
    附魔：弹射物保护

  - ### RESPIRATION

    public static final Enchantment RESPIRATION
    附魔：水下呼吸

  - ### AQUA_AFFINITY

    public static final Enchantment AQUA_AFFINITY
    附魔：水下速掘

  - ### THORNS

    public static final Enchantment THORNS
    附魔：荆棘

  - ### DEPTH_STRIDER

    public static final Enchantment DEPTH_STRIDER
    附魔：深海探索者

  - ### FROST_WALKER

    public static final Enchantment FROST_WALKER
    附魔：冰霜行者

  - ### BINDING_CURSE

    public static final Enchantment BINDING_CURSE
    附魔：绑定诅咒

  - ### SHARPNESS

    public static final Enchantment SHARPNESS
    附魔：锋利

  - ### SMITE

    public static final Enchantment SMITE
    附魔：亡灵杀手

  - ### BANE_OF_ARTHROPODS

    public static final Enchantment BANE_OF_ARTHROPODS
    附魔：节肢杀手

  - ### KNOCKBACK

    public static final Enchantment KNOCKBACK
    附魔：击退

  - ### FIRE_ASPECT

    public static final Enchantment FIRE_ASPECT
    附魔：火焰附加

  - ### LOOTING

    public static final Enchantment LOOTING
    附魔：抢夺

  - ### SWEEPING_EDGE

    public static final Enchantment SWEEPING_EDGE
    附魔：横扫之刃

  - ### EFFICIENCY

    public static final Enchantment EFFICIENCY
    附魔：效率

  - ### SILK_TOUCH

    public static final Enchantment SILK_TOUCH
    附魔：精准采集

  - ### UNBREAKING

    public static final Enchantment UNBREAKING
    附魔：耐久

  - ### FORTUNE

    public static final Enchantment FORTUNE
    附魔：时运

  - ### POWER

    public static final Enchantment POWER
    附魔：力量 (弓)

  - ### PUNCH

    public static final Enchantment PUNCH
    附魔：冲击 (弓)

  - ### FLAME

    public static final Enchantment FLAME
    附魔：火矢 (弓)

  - ### INFINITY

    public static final Enchantment INFINITY
    附魔：无限 (弓)

  - ### LUCK_OF_THE_SEA

    public static final Enchantment LUCK_OF_THE_SEA
    附魔：海之眷顾 (钓鱼杆)

  - ### LURE

    public static final Enchantment LURE
    附魔：饵钓 (钓鱼杆)

  - ### LOYALTY

    public static final Enchantment LOYALTY
    附魔：忠诚 (三叉戟)

  - ### IMPALING

    public static final Enchantment IMPALING
    附魔：穿刺 (三叉戟)

  - ### RIPTIDE

    public static final Enchantment RIPTIDE
    附魔：激流 (三叉戟)

  - ### CHANNELING

    public static final Enchantment CHANNELING
    附魔：引雷 (三叉戟)

  - ### MULTISHOT

    public static final Enchantment MULTISHOT
    附魔：多重射击 (弩)

  - ### QUICK_CHARGE

    public static final Enchantment QUICK_CHARGE
    附魔：快速装填 (弩)

  - ### PIERCING

    public static final Enchantment PIERCING
    附魔：穿透 (弩)

  - ### DENSITY

    public static final Enchantment DENSITY
    Increases fall damage of maces

  - ### BREACH

    public static final Enchantment BREACH
    Reduces armor effectiveness against maces

  - ### WIND_BURST

    public static final Enchantment WIND_BURST
    Emits wind burst upon hitting enemy

  - ### MENDING

    public static final Enchantment MENDING
    附魔：经验修补

  - ### VANISHING_CURSE

    public static final Enchantment VANISHING_CURSE
    附魔：消失诅咒

  - ### SOUL_SPEED

    public static final Enchantment SOUL_SPEED
    附魔：灵魂疾行

  - ### SWIFT_SNEAK

    public static final Enchantment SWIFT_SNEAK
    附魔：迅捷潜行

- ## 构造器详细资料

  - ### Enchantment

    public Enchantment()

- ## 方法详细资料

  - ### getName

    @NotNull @Deprecated public abstract @NotNull String getName()
    已过时。
    这些附魔的命名简直糟透了, 建议使用 `Keyed.getKey()`.
    得到这个附魔的名称.

    原文： Gets the unique name of this enchantment

    返回:
      独一无二的名称

  - ### getMaxLevel

    public abstract int getMaxLevel()
    得到这个附魔所支持的最大等级.

    原文： Gets the maximum level that this Enchantment may become.

    返回:
      这个附魔的最大等级

  - ### getStartLevel

    public abstract int getStartLevel()
    得到这个附魔的最小等级.

    原文： Gets the level that this Enchantment should start at

    返回:
      这个附魔最小等级

  - ### getItemTarget

    @NotNull @Deprecated public abstract @NotNull EnchantmentTarget getItemTarget()
    已过时。
    附魔分组现由标签管理, 而非分类
    得到这个附魔所支持的 物品 `ItemStack`.

    原文： Gets the type of `ItemStack` that may fit this Enchantment.

    返回:
      这个附魔的目标物品.

  - ### isTreasure

    @Deprecated public abstract boolean isTreasure()
    已过时。
    附魔类型现由标签管理
    检查该附魔是否为宝藏附魔.
    宝藏附魔只能通过掠夺、交易或垂钓获得.

    原文:Checks if this enchantment is a treasure enchantment.
    Treasure enchantments can only be received via looting, trading, or fishing.

    返回:
      是否为宝藏附魔

  - ### isCursed

    @Deprecated public abstract boolean isCursed()
    已过时。
    诅咒附魔不再是特殊的. 当且仅当附魔为`BINDING_CURSE` 或 `VANISHING_CURSE` 时才会返回true
    检查该附魔是否为诅咒附魔.
    诅咒附魔的获取途径与宝藏附魔一致.

    原文:Checks if this enchantment is a cursed enchantment
    Cursed enchantments are found the same way treasure enchantments are

    返回:
      是否为诅咒附魔

  - ### conflictsWith

    public abstract boolean conflictsWith(@NotNull @NotNull Enchantment other)
    检查这个附魔是否与另外的附魔冲突.

    原文： Check if this enchantment conflicts with another enchantment.

    参数:
      `other` - 另外一个附魔
    返回:
      如果这两个附魔是冲突的则返回true

  - ### canEnchantItem

    public abstract boolean canEnchantItem(@NotNull @NotNull ItemStack item)
    检查该附魔支不支持某物品.

    这并不检查任何物品上与它冲突的附魔。

    原文：Checks if this Enchantment may be applied to the given `ItemStack`.

    This does not check if it conflicts with any enchantments already applied to the item.

    参数:
      `item` - 物品
    返回:
      如果该附魔适用该物品,则返回true。

  - ### getByKey

    @Contract("null -> null") @Nullable @Deprecated public static @Nullable Enchantment getByKey(@Nullable @Nullable NamespacedKey key)
    已过时。
    仅为保障作向后兼容性, 请使用 `Registry.get(NamespacedKey)` instead
    通过指定键值获取附魔.

    原文： Gets the Enchantment at the specified key

    参数:
      `key` - 附魔键值key
    返回:
      返回该key所对应的附魔,要是没有所对应的的附魔则返回null.

  - ### getByName

    @Deprecated @Contract("null -> null") @Nullable public static @Nullable Enchantment getByName(@Nullable @Nullable String name)
    已过时。
    这些附魔的命名简直糟透了，建议使用 `getByKey(org.bukkit.NamespacedKey)`.
    以指定名称获取附魔.

    原文： Gets the Enchantment at the specified name

    参数:
      `name` - 名称
    返回:
      返回该名称所对应的附魔,要是没有所对应的的附魔则返回null.

  - ### values

    @NotNull @Deprecated public static @NotNull Enchantment[] values()
    已过时。
    请使用 `Registry.ENCHANTMENT.iterator()`
    得到所有已经注册了的附魔(`Enchantment`).

    原文： Gets an array of all the registered `Enchantment`s

    返回:
      一个包含所有已注册附魔的数组