Interface ContextualFormat<T>

Type Parameters:
T - the type of the result produced when this format is applied
All Superinterfaces:
Format<T>

public interface ContextualFormat<T> extends Format<T>
Extends Format to support transformations that depend on a collection of players rather than a single player or none.

ContextualFormat introduces the core method accept(Collection, String) which receives the full player context for formats that need to broadcast or aggregate across multiple players at once.

  • Method Summary

    Modifier and Type
    Method
    Description
    accept(Collection<? extends org.bukkit.entity.Player> players, String string)
    Transform the given text using this format in the context of multiple players.
    default T
    accept(org.bukkit.entity.Player player, String string)
    Convenience overload for a single player context.

    Methods inherited from interface me.croabeast.takion.format.Format

    accept, getRegex, isFormatted, matcher, removeFormat, toFormattedString
  • Method Details

    • accept

      @NotNull T accept(Collection<? extends org.bukkit.entity.Player> players, String string)
      Transform the given text using this format in the context of multiple players.

      Implementations must override this method to perform the desired logic based on the raw input string and the full player collection.

      Parameters:
      players - the player contexts (may be null or empty)
      string - the text to transform (never null)
      Returns:
      the result of applying this format across the given players
    • accept

      @NotNull default T accept(org.bukkit.entity.Player player, String string)
      Convenience overload for a single player context.

      Delegates to accept(Collection, String) by wrapping the given Player into a singleton collection. Override only if single-player handling must differ.

      Specified by:
      accept in interface Format<T>
      Parameters:
      player - the player context
      string - the text to transform
      Returns:
      the result of applying this format