java.lang.Object
studio.magemonkey.divinity.stats.items.api.ItemLoreStat<double[]>
studio.magemonkey.divinity.stats.items.attributes.stats.DurabilityStat
All Implemented Interfaces:
TypedStat

public class DurabilityStat extends ItemLoreStat<double[]> implements TypedStat
  • Constructor Details

    • DurabilityStat

      public DurabilityStat(@NotNull String name, @NotNull String format, double cap)
  • Method Details

    • getParameterClass

      @NotNull public Class<double[]> getParameterClass()
      Specified by:
      getParameterClass in class ItemLoreStat<double[]>
    • getType

      @NotNull public TypedStat.Type getType()
      Specified by:
      getType in interface TypedStat
    • getCapability

      public double getCapability()
      Specified by:
      getCapability in interface TypedStat
    • setCapability

      public void setCapability(double cap)
      Specified by:
      setCapability in interface TypedStat
    • getItemType

      @NotNull public SimpleStat.ItemType getItemType()
      Specified by:
      getItemType in interface TypedStat
    • isPercent

      public boolean isPercent()
      Specified by:
      isPercent in interface TypedStat
    • canBeNegative

      public boolean canBeNegative()
      Specified by:
      canBeNegative in interface TypedStat
    • isMainItem

      @Deprecated public boolean isMainItem(@NotNull org.bukkit.inventory.ItemStack item)
      Deprecated.
      Specified by:
      isMainItem in interface TypedStat
    • getDependStat

      @Nullable public TypedStat.Type getDependStat()
      Specified by:
      getDependStat in interface TypedStat
    • isUnbreakable

      public boolean isUnbreakable(@NotNull org.bukkit.inventory.ItemStack item)
    • isDamaged

      public boolean isDamaged(@NotNull org.bukkit.inventory.ItemStack item)
    • isBroken

      public boolean isBroken(@NotNull org.bukkit.inventory.ItemStack item)
    • reduceDurability

      public boolean reduceDurability(@NotNull org.bukkit.entity.LivingEntity li, @NotNull org.bukkit.inventory.ItemStack item, int amount)
    • formatValue

      @NotNull public String formatValue(@NotNull org.bukkit.inventory.ItemStack item, double[] values)
      Specified by:
      formatValue in class ItemLoreStat<double[]>
    • syncVanillaBar

      public void syncVanillaBar(@NotNull org.bukkit.inventory.ItemStack item, double current, double maxCustom)
      Syncs the durability stat with the vanilla durability bar. Should be called after any change to the durability stat. Note: This method assumes that the durability stat is already updated with the new values before calling it.
      Parameters:
      item - the item that needs updating
      current - the current durability value on the item
      maxCustom - the max value possible to be set for the item