Package dev.mintychochip.mint.theme
Interface ThemeService
- All Superinterfaces:
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 TypeMethodDescriptionvoidcreateTheme(Theme theme) Registers a theme definition for use.net.kyori.adventure.text.ComponentcreateThemedComponent(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.getPlayerCurrentTheme(UUID playerId) 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 voidsendThemedActionBar(net.kyori.adventure.audience.Audience audience, String miniMessage) Sends a themed action bar to an audience with theme tags automatically resolved.default voidsendThemedMessage(net.kyori.adventure.audience.Audience audience, String miniMessage) Sends a themed message to an audience with theme tags automatically resolved.default voidsendThemedTitle(net.kyori.adventure.audience.Audience audience, String title, String subtitle) Sends a themed title to an audience with theme tags automatically resolved.voidSets the theme preference for a player, persisting the choice.
-
Method Details
-
getThemeFor
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
Returns the default theme. -
getTheme
Returns a theme by displayName, if registered. -
getPlayerCurrentTheme
Returns the player's current theme. Returns default theme if player has none selected.- Throws:
IllegalStateException- if default theme is not configured
-
getAllThemes
Returns all registered themes. -
setTheme
Sets the theme preference for a player, persisting the choice. -
createTheme
Registers a theme definition for use. -
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 forminiMessage- 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 recipientminiMessage- 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 recipientminiMessage- 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 recipienttitle- the title text with theme tagssubtitle- the subtitle text with theme tags
-