Interface ThemeService

All Superinterfaces:
Service

@Experimental @AvailableSince("1.3") public interface ThemeService extends Service
Service for managing text themes for players.

Handling Removed Themes

When a theme is removed from the configuration, players who had that theme selected will be automatically migrated to the default theme on the next call to getThemeFor(Audience). The service will clear the orphaned preference.

Since:
1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Registers a theme definition for use.
    net.kyori.adventure.text.Component
    createThemedComponent(net.kyori.adventure.audience.Audience audience, String miniMessage)
    Creates a themed component with theme tags automatically resolved.
    Returns all registered themes.
    Returns the color role registry used for theme tag resolution.
    Returns the default theme.
    Returns the player's current theme.
    Returns a theme by displayName, if registered.
    getThemeFor(net.kyori.adventure.audience.Audience audience)
    Returns the audience's theme (player's selected or default, console/default).
    default void
    sendThemedActionBar(net.kyori.adventure.audience.Audience audience, String miniMessage)
    Sends a themed action bar to an audience with theme tags automatically resolved.
    default void
    sendThemedMessage(net.kyori.adventure.audience.Audience audience, String miniMessage)
    Sends a themed message to an audience with theme tags automatically resolved.
    default void
    sendThemedTitle(net.kyori.adventure.audience.Audience audience, String title, String subtitle)
    Sends a themed title to an audience with theme tags automatically resolved.
    void
    setTheme(UUID playerId, String themeName)
    Sets the theme preference for a player, persisting the choice.

    Methods inherited from interface dev.mintychochip.mint.Service

    name
  • Method Details

    • getThemeFor

      @AvailableSince("1.3") Theme getThemeFor(net.kyori.adventure.audience.Audience audience)
      Returns the audience's theme (player's selected or default, console/default). Clears orphaned preferences and returns default if the selected theme was removed.
    • getDefaultTheme

      @AvailableSince("1.3") Theme getDefaultTheme()
      Returns the default theme.
    • getTheme

      @AvailableSince("1.3") Optional<Theme> getTheme(String name)
      Returns a theme by displayName, if registered.
    • getPlayerCurrentTheme

      @AvailableSince("1.3") Theme getPlayerCurrentTheme(UUID playerId)
      Returns the player's current theme. Returns default theme if player has none selected.
      Throws:
      IllegalStateException - if default theme is not configured
    • getAllThemes

      @AvailableSince("1.3") List<Theme> getAllThemes()
      Returns all registered themes.
    • setTheme

      @AvailableSince("1.3") void setTheme(UUID playerId, String themeName)
      Sets the theme preference for a player, persisting the choice.
    • createTheme

      @AvailableSince("1.3") void createTheme(Theme theme)
      Registers a theme definition for use.
    • getColorRoleRegistry

      @AvailableSince("1.3") Registry<String,ColorRole> getColorRoleRegistry()
      Returns the color role registry used for theme tag resolution.
    • createThemedComponent

      @AvailableSince("1.3") net.kyori.adventure.text.Component createThemedComponent(net.kyori.adventure.audience.Audience audience, String miniMessage)
      Creates a themed component with theme tags automatically resolved.

      Available theme tags: <accent>, <primary>, <secondary>, <neutral>, <success>, <error>, <warning>, <info>

      Parameters:
      audience - the audience to resolve the theme for
      miniMessage - the MiniMessage text with theme tags
      Returns:
      the themed Component
    • sendThemedMessage

      @AvailableSince("1.3") default void sendThemedMessage(net.kyori.adventure.audience.Audience audience, String miniMessage)
      Sends a themed message to an audience with theme tags automatically resolved.

      Available theme tags: <accent>, <primary>, <secondary>, <neutral>, <success>, <error>, <warning>, <info>

      Parameters:
      audience - the message recipient
      miniMessage - the MiniMessage text with theme tags
    • sendThemedActionBar

      @AvailableSince("1.3") default void sendThemedActionBar(net.kyori.adventure.audience.Audience audience, String miniMessage)
      Sends a themed action bar to an audience with theme tags automatically resolved.
      Parameters:
      audience - the message recipient
      miniMessage - the MiniMessage text with theme tags
    • sendThemedTitle

      @AvailableSince("1.3") default void sendThemedTitle(net.kyori.adventure.audience.Audience audience, String title, String subtitle)
      Sends a themed title to an audience with theme tags automatically resolved.
      Parameters:
      audience - the message recipient
      title - the title text with theme tags
      subtitle - the subtitle text with theme tags