java.lang.Object
com.winterhavenmc.library.messagebuilder.adapters.pipeline.accessors.quantity.BukkitQuantityAccessor
All Implemented Interfaces:
Accessor

public class BukkitQuantityAccessor extends Object implements Accessor
Accessor implementation for extracting quantity values from supported objects.

This adapter enables macro substitution for {OBJECT.QUANTITY} by adapting known types into Quantifiable instances. Supported types include:

  • Quantifiable — directly implemented by plugins
  • ItemStack — maps to getAmount()
  • Chest — maps to inventory size via getInventory().getSize()
  • Inventory — maps to inventory size via getSize()
  • Collection — maps to size()

Plugins may implement Quantifiable directly to add custom macro support for other object types.

See Also:
  • Constructor Details

    • BukkitQuantityAccessor

      public BukkitQuantityAccessor()
  • Method Details

    • adapt

      public Optional<Quantifiable> adapt(Object obj)
      Attempts to adapt the given object into a Quantifiable instance.
      Specified by:
      adapt in interface Accessor
      Parameters:
      obj - the object to adapt
      Returns:
      an Optional<Quantifiable> if the object is supported, otherwise empty