接口 PotionMeta

所有超级接口:
Cloneable, ConfigurationSerializable, ItemMeta, PersistentDataHolder

public interface PotionMeta extends ItemMeta
代表药水和有自定义药水效果的物品.
  • 方法详细资料

    • setBasePotionData

      @Deprecated(since="1.20.6") void setBasePotionData(@Nullable @Nullable PotionData data)
      已过时。
      升级/延长的药水现在是独立的 PotionType,请使用 setBasePotionType(org.bukkit.potion.PotionType) 代替.
      设置底层药水数据.

      原文:Sets the underlying potion data

      参数:
      data - 要设置的基础药水状态的 PotionData
    • getBasePotionData

      @Nullable @Deprecated(since="1.20.6") @Nullable PotionData getBasePotionData()
      已过时。
      升级/延长的药水现在是独立的 PotionType,请使用 getBasePotionType() 代替.
      返回关于基础药水的药水数据.

      原文:Returns the potion data about the base potion

      返回:
      PotionData 对象
    • setBasePotionType

      void setBasePotionType(@Nullable @Nullable PotionType type)
      设置基础药水(主药水)的类型.

      原文: Sets the underlying potion type

      参数:
      type - 基础药水类型
    • getBasePotionType

      @Nullable @Nullable PotionType getBasePotionType()
      返回关于这个基础药水(主药水)的药水类型.

      原文: Returns the potion type about the base potion

      返回:
      PotionType 对象
    • hasBasePotionType

      boolean hasBasePotionType()
      检查是否存在基础药水类型.

      原文:Checks for the presence of a base potion type

      返回:
      如果存在基础药水类型则为 true
    • hasCustomEffects

      boolean hasCustomEffects()
      检测这个药水是否存在药水效果.

      原文: Checks for the presence of custom potion effects.

      返回:
      这个药水是否存在药水效果
    • getCustomEffects

      @NotNull @NotNull List<PotionEffect> getCustomEffects()
      获取这个药水的全部自定义效果.

      插件应该在调用这个方法之前检查 hasCustomEffects() 是否返回 true.

      原文: Gets an immutable list containing all custom potion effects applied to this potion.

      Plugins should check that hasCustomEffects() returns true before calling this method.

      返回:
      自定义效果列表 (不可变)
    • addCustomEffect

      boolean addCustomEffect(@NotNull @NotNull PotionEffect effect, boolean overwrite)
      向此药水添加一个自定义药水效果.

      原文: Adds a custom potion effect to this potion.

      参数:
      effect - 要添加的药水效果
      overwrite - 如要覆盖已有的同类药水效果就设为 true
      返回:
      如果药水的属性改变了则为 true
    • removeCustomEffect

      boolean removeCustomEffect(@NotNull @NotNull PotionEffectType type)
      移除这个药水的一个自定义效果.

      原文: Removes a custom potion effect from this potion.

      参数:
      type - 要移除的药水效果类型
      返回:
      如果药水的属性改变了则为 true
    • hasCustomEffect

      boolean hasCustomEffect(@NotNull @NotNull PotionEffectType type)
      检查这个药水是否有指定的药水效果.

      原文: Checks for a specific custom potion effect type on this potion.

      参数:
      type - 要检查的药水效果
      返回:
      存在此药水效果则返回 true
    • setMainEffect

      @Deprecated(since="1.9") boolean setMainEffect(@NotNull @NotNull PotionEffectType type)
      移动一个药水效果至这个药水效果列表的顶端.

      这将会使客户端上的药水名称显示成设置的药水效果.

      译注: 第一句不好理解? 比如有三个效果, 有个效果在最后面是最主要的效果, 我们就可以把这个效果移动到最顶上, 这样玩家第一眼看到的就是这个效果啦.

      原文: Moves a potion effect to the top of the potion effect list.

      This causes the client to display the potion effect in the potion's name.

      参数:
      type - 要移动的药水效果
      返回:
      如果药水的属性改变了则为 true
    • clearCustomEffects

      boolean clearCustomEffects()
      移除这个药水的全部自定义药水效果.

      原文: Removes all custom potion effects from this potion.

      返回:
      如果药水的属性改变了则为 true
    • hasColor

      boolean hasColor()
      检查药水是否设置了自定义颜色.

      原文: Checks for existence of a potion color.

      返回:
      是否设置了自定义颜色
    • getColor

      获取为这瓶药水设置的颜色. 此颜色可在物品栏中药水物品的格子内观察到.

      插件应该在调用这个方法之前检查 hasColor() 是否返回 true.

      原文: Gets the potion color that is set. A custom potion color will alter the display of the potion in an inventory slot.

      Plugins should check that hasColor() returns true before calling this method.

      返回:
      药水颜色
    • setColor

      void setColor(@Nullable @Nullable Color color)
      设置药水的颜色. 此颜色可在物品栏中药水物品的格子内观察到.

      原文: Sets the potion color. A custom potion color will alter the display of the potion in an inventory slot.

      参数:
      color - 颜色
    • hasCustomName

      boolean hasCustomName()
      检查是否存在自定义药水名称翻译后缀.

      原文:Checks for existence of a custom potion name translation suffix.

      返回:
      如果存在自定义药水名称则为 true
    • getCustomName

      @Nullable @Nullable String getCustomName()
      获取已设置的药水名称翻译后缀.

      插件应该在调用此方法之前检查 hasCustomName() 是否返回 true.

      原文:Gets the potion name translation suffix that is set. Plugins should check that hasCustomName() returns true before calling this method.

      返回:
      已设置的药水名称
    • setCustomName

      void setCustomName(@Nullable @Nullable String name)
      设置药水名称翻译后缀.

      原文:Sets the potion name translation suffix.

      参数:
      name - 要设置的名称
    • hasDurationScale

      boolean hasDurationScale()
      检查是否存在药水持续时间缩放.

      原文:Checks for existence of a potion duration scale.

      返回:
      如果存在药水持续时间缩放则为 true
    • getDurationScale

      @Nullable @org.jetbrains.annotations.Nullable float getDurationScale()
      获取已设置的药水持续时间缩放.

      插件应该在调用此方法之前检查 hasDurationScale() 是否返回 true.

      原文:Gets the potion duration scale that is set. Plugins should check that hasDurationScale() returns true before calling this method.

      返回:
      应用于所有药水效果持续时间的缩放因子
    • setDurationScale

      void setDurationScale(@Nullable @Nullable Float scale)
      设置药水持续时间缩放.

      原文:Sets the potion duration scale.

      参数:
      scale - 应用于所有药水效果持续时间的缩放因子
    • clone

      PotionMeta clone()
      指定者:
      clone 在接口中 ItemMeta