Interface UnitMappable<U extends ConfigurableUnit,C extends Collection<U>,UM extends UnitMappable<U,C,UM>>

Type Parameters:
U - The type of configurable unit stored.
C - The type of collection that holds the configurable units.
UM - The type of the implementing UnitMappable instance.
All Superinterfaces:
BaseBuilder<UM>, Copyable<UM>, Iterable<Map.Entry<Integer,C>>, Map<Integer,C>, Mappable<U,C,UM>
All Known Subinterfaces:
UnitMappable.List<U>, UnitMappable.Set<U>

public interface UnitMappable<U extends ConfigurableUnit,C extends Collection<U>,UM extends UnitMappable<U,C,UM>> extends Mappable<U,C,UM>
Represents a mappable collection of configurable units.

UnitMappable extends Mappable to provide a specialized mapping where integer keys are associated with collections of ConfigurableUnit objects. It adds factory methods for creating new instances with specific backing collection types and supports operations such as merging values from multiple keys.

Important: For full functionality, you must implement the base UnitMappable interface. However, its nested sub-interfaces UnitMappable.Set and UnitMappable.List are designed to be directly instantiated using the provided static factory methods asSet(Map) and asList(Map), which return ready-to-use implementations.

See Also:
  • Method Details

    • getUnit

      @Nullable default U getUnit(@Nullable @Nullable org.bukkit.entity.Player player)
    • asSet

      static <U extends ConfigurableUnit> UnitMappable.Set<U> asSet(Map<Integer,Set<U>> map)
      Creates a new UnitMappable.Set instance from the given map.
      Type Parameters:
      U - the type of configurable unit.
      Parameters:
      map - the map containing integer keys mapping to sets of ConfigurableUnit objects.
      Returns:
      a new UnitMappable.Set instance populated with the provided map.
    • asSet

      static <U extends ConfigurableUnit> UnitMappable.Set<U> asSet()
      Creates an empty UnitMappable.Set instance.
      Type Parameters:
      U - the type of configurable unit.
      Returns:
      a new empty UnitMappable.Set instance.
    • asList

      static <U extends ConfigurableUnit> UnitMappable.List<U> asList(Map<Integer,List<U>> map)
      Creates a new UnitMappable.List instance from the given map.
      Type Parameters:
      U - the type of configurable unit.
      Parameters:
      map - the map containing integer keys mapping to lists of ConfigurableUnit objects.
      Returns:
      a new UnitMappable.List instance populated with the provided map.
    • asList

      static <U extends ConfigurableUnit> UnitMappable.List<U> asList()
      Creates an empty UnitMappable.List instance.
      Type Parameters:
      U - the type of configurable unit.
      Returns:
      a new empty UnitMappable.List instance.