接口 PotionMeta

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

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

    • setBasePotionData

      void setBasePotionData(@NotNull @NotNull PotionData data)
      设置基础药水(主药水)的数据.

      原文: Sets the underlying potion data

      参数:
      data - 基础药水数据
    • getBasePotionData

      @NotNull @NotNull PotionData getBasePotionData()
      返回关于这个基础药水(主药水)的药水数据.

      原文: Returns the potion data about the base potion

      返回:
      PotionData 对象
    • 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 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 - 颜色
    • clone

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