Interface PlaceholderData<T>

Type Parameters:
T - type of placeholder item.

public interface PlaceholderData<T>
Represent placeholder found in string, it contains full string to replace, object name and placeholder item.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Object[]
    Empty object array.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Object
    apply(T obj)
    Delegated method from BasePlaceholderItem
    default boolean
    Returns true if this placeholder contains sub-placeholders used as arguments.
    default Object[]
    Returns array of arguments used by this placeholder.
    default Object[]
    Returns array of parsed arguments used by this placeholder.
    Returns full string to replace.
    Returns placeholder item used in this placeholder.
    Returns object name, like "player" for player.name, or "killer" for player#killer.name.
    parseString(org.bukkit.plugin.Plugin api, String str, boolean warn)
    Get collectiona of used placeholders grouped by object name in given string.
    default String
    replace(String str, T obj)
    Uses this placeholder on given string.
    default net.md_5.bungee.api.chat.BaseComponent
    replace(net.md_5.bungee.api.chat.BaseComponent component, T obj)
    Uses this placeholder on given BaseComponent.
    static <T> PlaceholderData<T>
    valueOf(String fullName, String objectName, PlaceholderItem<T> item)
     
  • Field Details

    • EMPTY_OBJECTS

      static final Object[] EMPTY_OBJECTS
      Empty object array.
  • Method Details

    • getFullName

      String getFullName()
      Returns full string to replace.
      Returns:
      full string to replace.
    • getObjectName

      String getObjectName()
      Returns object name, like "player" for player.name, or "killer" for player#killer.name.
      Returns:
      object name.
    • getItem

      PlaceholderItem<T> getItem()
      Returns placeholder item used in this placeholder.
      Returns:
      placeholder item used in this placeholder.
    • getArguments

      default Object[] getArguments()
      Returns array of arguments used by this placeholder.
      Returns:
      array of arguments used by this placeholder.
    • containsSubPlaceholders

      default boolean containsSubPlaceholders()
      Returns true if this placeholder contains sub-placeholders used as arguments.
      Returns:
      true if this placeholder contains sub-placeholders used as arguments.
    • getArguments

      default Object[] getArguments(T obj)
      Returns array of parsed arguments used by this placeholder.
      Parameters:
      obj - data object used by placeholder.
      Returns:
      array of parsed arguments used by this placeholder.
    • apply

      default Object apply(T obj)
      Delegated method from BasePlaceholderItem
      Parameters:
      obj - object to fetch the data needed for placeholder.
      Returns:
      Object to use instead of placeholder.
      See Also:
    • replace

      default String replace(String str, T obj)
      Uses this placeholder on given string.
      Parameters:
      str - string to use.
      obj - object to fetch the data needed for placeholder.
      Returns:
      string with replaced placeholder.
    • replace

      default net.md_5.bungee.api.chat.BaseComponent replace(net.md_5.bungee.api.chat.BaseComponent component, T obj)
      Uses this placeholder on given BaseComponent.
      NOTE: placeholder is replaced without duplicating given component, it will make all changes on given component.
      Parameters:
      component - component to use.
      obj - object to fetch the data needed for placeholder.
      Returns:
      this same component as given.
    • valueOf

      static <T> PlaceholderData<T> valueOf(String fullName, String objectName, PlaceholderItem<T> item)
    • parseString

      static Map<String,Collection<PlaceholderData<?>>> parseString(org.bukkit.plugin.Plugin api, String str, boolean warn)
      Get collectiona of used placeholders grouped by object name in given string.
      Will return null if null string is given.
      Parameters:
      api - instance of api.
      str - string to parse.
      warn - if true, method will print warnings about invalid placeholders to console.
      Returns:
      collection of used placeholders. BasePlaceholderData