类 Enchantment

java.lang.Object
org.bukkit.enchantments.Enchantment
所有已实现的接口:
Keyed
直接已知子类:
EnchantmentWrapper

public abstract class Enchantment extends Object implements Keyed
附魔类.
  • 字段详细资料

    • PROTECTION_ENVIRONMENTAL

      public static final Enchantment PROTECTION_ENVIRONMENTAL
      附魔:保护
    • PROTECTION_FIRE

      public static final Enchantment PROTECTION_FIRE
      附魔:火焰保护
    • PROTECTION_FALL

      public static final Enchantment PROTECTION_FALL
      附魔:摔落保护
    • PROTECTION_EXPLOSIONS

      public static final Enchantment PROTECTION_EXPLOSIONS
      附魔:爆炸保护
    • PROTECTION_PROJECTILE

      public static final Enchantment PROTECTION_PROJECTILE
      附魔:弹射物保护
    • OXYGEN

      public static final Enchantment OXYGEN
      附魔:水下呼吸
    • WATER_WORKER

      public static final Enchantment WATER_WORKER
      附魔:水下速掘
    • 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
      附魔:绑定诅咒
    • DAMAGE_ALL

      public static final Enchantment DAMAGE_ALL
      附魔:锋利
    • DAMAGE_UNDEAD

      public static final Enchantment DAMAGE_UNDEAD
      附魔:亡灵杀手
    • DAMAGE_ARTHROPODS

      public static final Enchantment DAMAGE_ARTHROPODS
      附魔:节肢杀手
    • KNOCKBACK

      public static final Enchantment KNOCKBACK
      附魔:击退
    • FIRE_ASPECT

      public static final Enchantment FIRE_ASPECT
      附魔:火焰附加
    • LOOT_BONUS_MOBS

      public static final Enchantment LOOT_BONUS_MOBS
      附魔:抢夺
    • SWEEPING_EDGE

      public static final Enchantment SWEEPING_EDGE
      附魔:横扫之刃
    • DIG_SPEED

      public static final Enchantment DIG_SPEED
      附魔:效率
    • SILK_TOUCH

      public static final Enchantment SILK_TOUCH
      附魔:精准采集
    • DURABILITY

      public static final Enchantment DURABILITY
      附魔:耐久
    • LOOT_BONUS_BLOCKS

      public static final Enchantment LOOT_BONUS_BLOCKS
      附魔:时运
    • ARROW_DAMAGE

      public static final Enchantment ARROW_DAMAGE
      附魔:力量 (弓)
    • ARROW_KNOCKBACK

      public static final Enchantment ARROW_KNOCKBACK
      附魔:冲击 (弓)
    • ARROW_FIRE

      public static final Enchantment ARROW_FIRE
      附魔:火矢 (弓)
    • ARROW_INFINITE

      public static final Enchantment ARROW_INFINITE
      附魔:无限 (弓)
    • LUCK

      public static final Enchantment LUCK
      附魔:海之眷顾 (钓鱼杆)
    • 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
      附魔:穿透 (弩)
    • 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
      附魔:迅捷潜行
  • 构造器详细资料

  • 方法详细资料

    • getKey

      @NotNull public @NotNull NamespacedKey getKey()
      从接口复制的说明: Keyed
      返回用于此对象的命名空间标识符.

      原文:Return the namespaced identifier for this object.

      指定者:
      getKey 在接口中 Keyed
      返回:
      标识此对象的 key
    • getName

      @NotNull @Deprecated public abstract @NotNull String getName()
      已过时。
      这些附魔的命名简直糟透了, 建议使用 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 public abstract @NotNull EnchantmentTarget getItemTarget()
      得到这个附魔所支持的 物品 ItemStack.

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

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

      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_CURSEVANISHING_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。
    • equals

      public boolean equals(Object obj)
      覆盖:
      equals 在类中 Object
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object
    • registerEnchantment

      public static void registerEnchantment(@NotNull @NotNull Enchantment enchantment)
      注册一个附魔的ID和对象.

      一般不在插件中使用.

      原文: Registers an enchantment with the given ID and object.

      Generally not to be used from within a plugin.

      参数:
      enchantment - 用于注册的附魔
    • isAcceptingRegistrations

      public static boolean isAcceptingRegistrations()
      检查是否接受附魔注册.

      原文: Checks if this is accepting Enchantment registrations.

      返回:
      如果服务器可能实现添加附魔则返回True
    • stopAcceptingRegistrations

      public static void stopAcceptingRegistrations()
      停止接受任何附魔注册.

      原文: Stops accepting any enchantment registrations

    • getByKey

      @Contract("null -> null") @Nullable public static @Nullable Enchantment getByKey(@Nullable @Nullable NamespacedKey key)
      通过指定键值获取附魔.

      原文: 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 public static @NotNull Enchantment[] values()
      得到所有已经注册了的附魔(Enchantment).

      原文: Gets an array of all the registered Enchantments

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