java.lang.Object
com.winterhavenmc.library.messagebuilder.pipeline.adapters.duration.DurationAdapter
All Implemented Interfaces:
Adapter

public class DurationAdapter extends Object implements Adapter
Adapter for objects that expose a Duration via the Durationable interface.

This adapter supports macro resolution for duration-based placeholders such as {OBJECT.DURATION}. It delegates all adaptation responsibilities to the object itself, requiring it to explicitly implement Durationable.

This design assumes that no Bukkit-provided types expose a getDuration() method by default. If such types are discovered in the future, they can be added to this adapter using additional instanceof branches or method references.

Adapter type: Adapter.BuiltIn.DURATION (single-value field).

See Also:
  • Constructor Details

    • DurationAdapter

      public DurationAdapter()
  • Method Details

    • adapt

      public Optional<Durationable> adapt(Object obj)
      Attempts to adapt the given object into a Durationable if it explicitly implements the interface.
      Specified by:
      adapt in interface Adapter
      Parameters:
      obj - the object to adapt
      Returns:
      an Optional<Durationable> if the object is a Durationable, otherwise empty