java.lang.Object
com.winterhavenmc.library.messagebuilder.pipeline.adapters.owner.OwnerAdapter
All Implemented Interfaces:
Adapter

public class OwnerAdapter extends Object implements Adapter
Adapter that extracts ownership information from objects that either implement Ownable or are Tameable Bukkit entities.

This adapter enables support for the {OBJECT.OWNER} macro by wrapping objects that expose a semantic concept of ownership. It checks for two sources:

  • Objects that directly implement Ownable (e.g., plugin-defined types such as a "DeathChest")
  • Tameable entities, where ownership is derived from getOwner()

Use cases include pet ownership, data-bound entity or item ownership, and permission-based structures such as protected regions or storage blocks. Because Ownable defines ownership via an AnimalTamer, it supports OfflinePlayer references, allowing message replacement even for offline owners.

  • Constructor Details

    • OwnerAdapter

      public OwnerAdapter()
  • Method Details

    • adapt

      public Optional<Ownable> adapt(Object obj)
      Attempts to adapt the given object to the Ownable interface, either directly or by wrapping supported Bukkit types.
      Specified by:
      adapt in interface Adapter
      Parameters:
      obj - the object to adapt
      Returns:
      an Optional<Ownable> if the object is supported, otherwise Optional.empty()