Class DurabilityModifier

java.lang.Object
me.hsgamer.hscore.bukkit.item.modifier.DurabilityModifier
All Implemented Interfaces:
ItemComparator<org.bukkit.inventory.ItemStack>, ItemModifier<org.bukkit.inventory.ItemStack>

public class DurabilityModifier extends Object implements ItemComparator<org.bukkit.inventory.ItemStack>, ItemModifier<org.bukkit.inventory.ItemStack>
The durability modifier
  • Constructor Details

    • DurabilityModifier

      public DurabilityModifier()
  • Method Details

    • modify

      @NotNull public @NotNull org.bukkit.inventory.ItemStack modify(@NotNull @NotNull org.bukkit.inventory.ItemStack original, UUID uuid, @NotNull @NotNull StringReplacer stringReplacer)
      Description copied from interface: ItemModifier
      Modify the item
      Specified by:
      modify in interface ItemModifier<org.bukkit.inventory.ItemStack>
      Parameters:
      original - the original item
      uuid - the unique id
      stringReplacer - the string replacer
      Returns:
      the modified item
    • toObject

      public Object toObject()
      Description copied from interface: ItemModifier
      Serialize the modifier to an object
      Specified by:
      toObject in interface ItemModifier<org.bukkit.inventory.ItemStack>
      Returns:
      the object
    • loadFromObject

      public void loadFromObject(Object object)
      Description copied from interface: ItemModifier
      Load the modifier from an object
      Specified by:
      loadFromObject in interface ItemModifier<org.bukkit.inventory.ItemStack>
      Parameters:
      object - the object
    • loadFromItem

      public boolean loadFromItem(org.bukkit.inventory.ItemStack item)
      Description copied from interface: ItemModifier
      Load the modifier from an item
      Specified by:
      loadFromItem in interface ItemModifier<org.bukkit.inventory.ItemStack>
      Parameters:
      item - the item
      Returns:
      true if it can
    • compare

      public boolean compare(@NotNull @NotNull org.bukkit.inventory.ItemStack item, UUID uuid, @NotNull @NotNull StringReplacer stringReplacer)
      Description copied from interface: ItemComparator
      Compare the modifier of an item
      Specified by:
      compare in interface ItemComparator<org.bukkit.inventory.ItemStack>
      Parameters:
      item - the item
      uuid - the unique id
      stringReplacer - the string replacer
      Returns:
      true if it matches, otherwise false
    • setDurability

      @Contract("_ -> this") public DurabilityModifier setDurability(String durability)
      Set the durability
      Parameters:
      durability - the durability
      Returns:
      this for builder chain
    • setDurability

      @Contract("_ -> this") public DurabilityModifier setDurability(short durability)
      Set the durability
      Parameters:
      durability - the durability
      Returns:
      this for builder chain