Class MessageService

java.lang.Object
com.zetaplugins.zetacore.services.MessageService

public final class MessageService extends Object
Service for handling messages and localization
  • Constructor Details

    • MessageService

      public MessageService(LocalizationService localizationService)
      Constructor for MessageService
      Parameters:
      localizationService - The LocalizationService instance to use for fetching localized messages
  • Method Details

    • formatMsg

      public static net.kyori.adventure.text.Component formatMsg(String msg, MessageService.Replaceable<?>... replaceables)
      Formats a message with placeholders
      Parameters:
      msg - The message to format
      replaceables - The placeholders to replace
      Returns:
      The formatted message
    • getAndFormatMsg

      public net.kyori.adventure.text.Component getAndFormatMsg(boolean addPrefix, String path, String fallback, MessageService.Replaceable<?>... replaceables)
      Gets and formats a message from the config
      Parameters:
      addPrefix - Whether to add the prefix to the message
      path - The path to the message in the config
      fallback - The fallback message
      replaceables - The placeholders to replace
      Returns:
      The formatted message
    • getAndFormatMsgList

      public List<net.kyori.adventure.text.Component> getAndFormatMsgList(String path, MessageService.Replaceable<?>... replaceables)
    • getAccentColor

      public String getAccentColor()
      Gets the accent color
      Returns:
      The accent color
    • replacePlaceholders

      @NotNull public static @NotNull String replacePlaceholders(String msg, MessageService.Replaceable<?>... replaceables)
    • replacePlaceholdersWithAccentColors

      @NotNull public @NotNull String replacePlaceholdersWithAccentColors(String msg, MessageService.Replaceable<?>... replaceables)
    • convertToLegacy

      public String convertToLegacy(String input)