Interface GlobalPlaceholderFactory


public interface GlobalPlaceholderFactory
Advanced class to create separate GlobalPlaceholder instances depending on the placeholder argument, instead of providing a single one when registering the placeholder.

This is mostly used for performance reasons, to parse the argument only when necessary, instead of doing it every time the method GlobalPlaceholder.getReplacement(String) is invoked. For example, the argument might consist of multiple comma-separated values, be a JSON string, or require a regular expression to parse it.

Another less common use case is to keep a separate internal state for each different argument.

Since:
1
  • Method Summary

    Modifier and Type
    Method
    Description
    getPlaceholder(@Nullable String argument)
    Returns the placeholder instance to provide the replacement for the given argument.
  • Method Details

    • getPlaceholder

      @Nullable @Nullable GlobalPlaceholder getPlaceholder(@Nullable @Nullable String argument)
      Returns the placeholder instance to provide the replacement for the given argument. This method might be invoked again for the same argument if the placeholder is temporarily unused (not displayed to any player).
      Parameters:
      argument - the argument for which the placeholder instance will provide the replacement
      Returns:
      the placeholder instance
      Since:
      1