类 PotionEffectType

java.lang.Object
org.bukkit.potion.PotionEffectType
所有已实现的接口:
Keyed
直接已知子类:
PotionEffectTypeWrapper

public abstract class PotionEffectType extends Object implements Keyed
代表应用于实体上的药水和效果类型.
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • createEffect

      @NotNull public @NotNull PotionEffect createEffect(int duration, int amplifier)
      以本效果类型创建一个药水效果, 并应用持续时间与倍率.

      原文:Creates a PotionEffect from this PotionEffectType, applying duration modifiers and checks.

      参数:
      duration - 效果持续时间, 以 tick 为单位
      amplifier - 效果的倍率
      返回:
      创建的药水效果
      另请参阅:
    • getDurationModifier

      @Deprecated public abstract double getDurationModifier()
      已过时。
      未被使用, 总是 1.0
      返回应用于此效果类型的持续时间.

      原文:Returns the duration modifier applied to effects of this type.

      返回:
      持续时间
    • getId

      @Deprecated public int getId()
      已过时。
      魔法值
      返回本状态效果类型的唯一 ID.

      原文:Returns the unique ID of this type.

      返回:
      唯一 ID
    • getKey

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

      原文:Return the namespaced identifier for this object.

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

      @NotNull public abstract @NotNull String getName()
      返回本状态效果类型的名称.

      原文:Returns the name of this effect type.

      返回:
      状态效果名
    • isInstant

      public abstract boolean isInstant()
      返回本效果是否为瞬时型效果.

      原文:Returns whether the effect of this type happens once, immediately.

      返回:
      是否为瞬时型效果
    • getColor

      @NotNull public abstract @NotNull Color getColor()
      返回本效果的颜色.

      原文:Returns the color of this effect type.

      返回:
      颜色
    • equals

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

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

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

      @Contract("null -> null") @Nullable public static @Nullable PotionEffectType getByKey(@Nullable @Nullable NamespacedKey key)
      根据指定 key 获取效果.

      原文:Gets the PotionEffectType at the specified key

      参数:
      key - 效果键名
      返回:
      对应的效果类型, 如果找不到返回 null
    • getById

      @Deprecated @Nullable public static @Nullable PotionEffectType getById(int id)
      已过时。
      魔法值
      根据唯一 ID 获取效果.

      原文:Gets the effect type specified by the unique id.

      参数:
      id - 唯一 ID
      返回:
      对应的效果类型, 如果找不到返回 null
    • getByName

      @Nullable public static @Nullable PotionEffectType getByName(@NotNull @NotNull String name)
      根据指定名称获取效果.

      原文:Gets the effect type specified by the given name.

      参数:
      name - 状态效果名
      返回:
      对应的效果类型, 如果找不到返回 null
    • registerPotionEffectType

      public static void registerPotionEffectType(@NotNull @NotNull PotionEffectType type)
      注册给定的状态效果类型对象.

      通常不由插件使用.

      原文:Registers an effect type with the given object.

      Generally not to be used from within a plugin.

      参数:
      type - 要注册的类型
    • stopAcceptingRegistrations

      public static void stopAcceptingRegistrations()
      停止接受任何新效果的注册.

      原文:Stops accepting any effect type registrations.

    • values

      @NotNull public static @NotNull PotionEffectType[] values()
      返回一个所有已注册效果类型的数组. 此数组不一定按特定顺序编排.

      原文:Returns an array of all the registered PotionEffectTypes. This array is not necessarily in any particular order.

      返回:
      所有已注册效果类型的数组