java.lang.Object
com.winterhavenmc.library.messagebuilder.pipeline.adapters.uuid.UniqueIdAdapter
All Implemented Interfaces:
Adapter

public class UniqueIdAdapter extends Object implements Adapter
Adapter for identifying objects with a unique UUID.

This adapter supports Bukkit types that expose UUIDs directly, including:

  • Entity
  • OfflinePlayer
  • PlayerProfile
  • World

It also supports any object implementing the Identifiable interface.

  • Constructor Details

    • UniqueIdAdapter

      public UniqueIdAdapter()
  • Method Details

    • adapt

      public Optional<Identifiable> adapt(Object obj)
      Attempts to adapt the given object to an Identifiable instance.

      This method supports the following object types:

      • Identifiable — returned directly
      • Entity — adapts via getUniqueId()
      • OfflinePlayer — adapts via getUniqueId()
      • PlayerProfile — adapts via getUniqueId()
      • World — adapts via getUID()
      Specified by:
      adapt in interface Adapter
      Parameters:
      obj - the object to adapt
      Returns:
      an Optional containing an Identifiable instance if the object is supported; otherwise an empty Optional