Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Quantifiable
Represents objects that expose a numerical quantity for macro replacement.

This interface allows objects to contribute to the {OBJECT.QUANTITY} placeholder using an integer-based getQuantity() accessor. Implementing this interface enables plugins to automatically extract and localize quantity values from plugin-defined or Bukkit-provided objects.

Common examples of quantities include item stack sizes, inventory capacities, or collection sizes.

See Also:
  • Method Details

    • getQuantity

      int getQuantity()
      Returns the numeric quantity associated with this object.
      Returns:
      the quantity as an integer
    • extractQuantity

      default MacroStringMap extractQuantity(MacroKey baseKey, AdapterContextContainer ctx)
      Extracts a MacroStringMap containing the formatted quantity string. This value will be added using the subkey QUANTITY of the provided macro key.
      Parameters:
      baseKey - the macro key under which to store the formatted quantity
      ctx - the adapter context providing the number formatter
      Returns:
      a MacroStringMap with a formatted quantity string, or an empty map if the key cannot be derived
    • formatQuantity

      static Optional<String> formatQuantity(int quantity, NumberFormatter numberFormatter)
      Converts a raw integer quantity into a localized string using the provided number formatter.
      Parameters:
      quantity - the raw integer quantity
      numberFormatter - the number formatter used for localization
      Returns:
      an optional containing the formatted string