Class PlaceholderManager

java.lang.Object
me.remigio07.chatplugin.api.server.util.manager.PlaceholderManager
All Implemented Interfaces:
Runnable, ChatPluginManager

public abstract class PlaceholderManager extends Object implements ChatPluginManager, Runnable
Manager that handles ChatPlugin's integrated (and its integrations') placeholders.
See Also:
  • Constructor Details

    • PlaceholderManager

      public PlaceholderManager()
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Description copied from interface: ChatPluginManager
      Checks if this manager is enabled.
      Specified by:
      isEnabled in interface ChatPluginManager
      Returns:
      Whether this manager is enabled
    • getTimerTaskID

      public long getTimerTaskID()
      Gets the update task's ID.

      You can interact with it through TaskManager's methods.

      Returns:
      Update task's ID
    • translatePlaceholders

      public String translatePlaceholders(String input, ChatPluginServerPlayer player, List<PlaceholderType> placeholderTypes)
      Translates an input string with placeholders, formatted for the specified player and translated for the player's language.

      You have to indicate what placeholder types you need for the string to be translated. Color and formatting codes are already translated.

      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      placeholderTypes - Placeholder types present in the input
      Returns:
      Translated placeholders
      See Also:
    • translatePlaceholders

      public String translatePlaceholders(String input, ChatPluginServerPlayer player, Language language, List<PlaceholderType> placeholderTypes)
      Translates an input string with placeholders, formatted for the specified player and translated for the specified language.

      You have to indicate what placeholder types you need for the string to be translated. Color and formatting codes are already translated.

      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      language - Language used to translate the placeholders
      placeholderTypes - Placeholder types present in the input
      Returns:
      Translated placeholders
      See Also:
    • translatePlaceholders

      public List<String> translatePlaceholders(List<String> input, ChatPluginServerPlayer player, List<PlaceholderType> placeholderTypes)
      Translates an input string list with placeholders, formatted for the specified player and translated for the player's language.

      You have to indicate what placeholder types you need for the string to be translated. Color and formatting codes are already translated.

      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      placeholderTypes - Placeholder types present in the input
      Returns:
      Translated placeholders
      See Also:
    • translatePlaceholders

      public List<String> translatePlaceholders(List<String> input, ChatPluginServerPlayer player, Language language, List<PlaceholderType> placeholderTypes)
      Translates an input string list with placeholders, formatted for the specified player and translated for the specified language.

      You have to indicate what placeholder types you need for the string to be translated. Color and formatting codes are already translated.

      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      language - Language used to translate the placeholders
      placeholderTypes - Placeholder types present in the input
      Returns:
      Translated placeholders
      See Also:
    • translatePlayerPlaceholders

      public String translatePlayerPlaceholders(String input, ChatPluginServerPlayer player)
      Translates an input string with PlaceholderType.PLAYER placeholders, formatted for the specified player and translated for the player's language.

      Color and formatting codes are already translated.

      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      Returns:
      Translated placeholders
      See Also:
    • translatePlayerPlaceholders

      public String translatePlayerPlaceholders(String input, ChatPluginServerPlayer player, Language language)
      Translates an input string with PlaceholderType.PLAYER placeholders, specified player and translated for the specified language.

      Color and formatting codes are already translated.

      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      language - Language used to translate the placeholders
      Returns:
      Translated placeholders
      See Also:
    • translatePlayerPlaceholders

      public List<String> translatePlayerPlaceholders(List<String> input, ChatPluginServerPlayer player)
      Translates an input string list with PlaceholderType.PLAYER placeholders, formatted for the specified player and translated for the player's language.

      Color and formatting codes are already translated.

      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      Returns:
      Translated placeholders
      See Also:
    • translatePlayerPlaceholders

      public List<String> translatePlayerPlaceholders(List<String> input, ChatPluginServerPlayer player, Language language)
      Translates an input string list with PlaceholderType.PLAYER placeholders, formatted for the specified player and translated for the specified language.

      Color and formatting codes are already translated.

      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      language - Language used to translate the placeholders
      Returns:
      Translated placeholders
      See Also:
    • translateServerPlaceholders

      public String translateServerPlaceholders(String input, Language language)
      Translates an input string with PlaceholderType.SERVER placeholders, translated for the specified language.

      Color and formatting codes are already translated.

      Parameters:
      input - Input containing placeholders
      language - Language used to translate the placeholders
      Returns:
      Translated placeholders
      See Also:
    • translateServerPlaceholders

      public List<String> translateServerPlaceholders(List<String> input, Language language)
      Translates an input string list with PlaceholderType.SERVER placeholders, translated for the specified language.

      Color and formatting codes are already translated.

      Parameters:
      input - Input containing placeholders
      language - Language used to translate the placeholders
      Returns:
      Translated placeholders
      See Also:
    • translateIntegrationsPlaceholders

      public String translateIntegrationsPlaceholders(String input, ChatPluginServerPlayer player)
      Translates an input string with PlaceholderType.INTEGRATIONS placeholders, formatted for the specified player and translated for the player's language.

      Color and formatting codes are already translated.

      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      Returns:
      Translated placeholders
      See Also:
    • translateIntegrationsPlaceholders

      public String translateIntegrationsPlaceholders(String input, ChatPluginServerPlayer player, Language language)
      Translates an input string with PlaceholderType.INTEGRATIONS placeholders, formatted for the specified player and translated for the specified language.

      Color and formatting codes are already translated.

      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      language - Language used to translate the placeholders
      Returns:
      Translated placeholders
      See Also:
    • translateIntegrationsPlaceholders

      public List<String> translateIntegrationsPlaceholders(List<String> input, ChatPluginServerPlayer player)
      Translates an input string list with PlaceholderType.INTEGRATIONS placeholders, formatted for the specified player and translated for the player's language.

      Color and formatting codes are already translated.

      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      Returns:
      Translated placeholders
      See Also:
    • translateIntegrationsPlaceholders

      public List<String> translateIntegrationsPlaceholders(List<String> input, ChatPluginServerPlayer player, Language language)
      Translates an input string list with PlaceholderType.INTEGRATIONS placeholders, formatted for the specified player and translated for the specified language.

      Color and formatting codes are already translated.

      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      language - Language used to translate the placeholders
      Returns:
      Translated placeholders
      See Also:
    • getInstance

      public static PlaceholderManager getInstance()
      Gets this manager's instance.
      Returns:
      Manager's instance
    • run

      public abstract void run()
      Storage's placeholders updater, called once every settings.storage-placeholders-update-timeout in config.yml.
      Specified by:
      run in interface Runnable
    • translatePlaceholders

      public abstract String translatePlaceholders(String input, ChatPluginServerPlayer player, Language language, List<PlaceholderType> placeholderTypes, boolean translateColors)
      Translates an input string with placeholders, formatted for the specified player and translated for the specified language.

      You have to indicate what placeholder types you need for the string to be translated.

      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      language - Language used to translate the placeholders
      placeholderTypes - Placeholder types present in the input
      translateColors - Whether to ChatColor.translate(String) the output
      Returns:
      Translated placeholders
      See Also:
    • translatePlayerPlaceholders

      public abstract String translatePlayerPlaceholders(String input, ChatPluginServerPlayer player, Language language, boolean translateColors)
      Translates an input string with PlaceholderType.PLAYER placeholders, formatted for the specified player and translated for the specified language.
      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      language - Language used to translate the placeholders
      translateColors - Whether to ChatColor.translate(String) the output
      Returns:
      Translated placeholders
      See Also:
    • translateServerPlaceholders

      public abstract String translateServerPlaceholders(String input, Language language, boolean translateColors)
      Translates an input string with PlaceholderType.SERVER placeholders, translated for the specified language.
      Parameters:
      input - Input containing placeholders
      language - Language used to translate the placeholders
      translateColors - Whether to ChatColor.translate(String) the output
      Returns:
      Translated placeholders
      See Also:
    • translateIntegrationsPlaceholders

      public abstract String translateIntegrationsPlaceholders(String input, ChatPluginServerPlayer player, Language language, boolean translateColors)
      Translates an input string with PlaceholderType.INTEGRATIONS placeholders, formatted for the specified player and translated for the specified language.
      Parameters:
      input - Input containing placeholders
      player - Player whose placeholders need to be translated
      language - Language used to translate the placeholders
      translateColors - Whether to ChatColor.translate(String) the output
      Returns:
      Translated placeholders
      See Also: