Interface Placeholder

All Known Subinterfaces:
GlobalPlaceholder, IndividualPlaceholder

public interface Placeholder
A placeholder is a dynamic text value that can be displayed in a text hologram line.

Placeholders can be global (show the same text to all players) or individual (show a different text to each player). Global placeholders are preferable when possible, as individual placeholders have a higher performance impact.

To add a placeholder a class must implement either GlobalPlaceholder or IndividualPlaceholder, then it must be registered with HolographicDisplaysAPI.registerGlobalPlaceholder(String, GlobalPlaceholder) or HolographicDisplaysAPI.registerIndividualPlaceholder(String, IndividualPlaceholder) by providing an identifier string.

The valid formats to display the placeholder inside a text line are:

  • {identifier}
  • {identifier: argument}
  • {plugin/identifier}
  • {plugin/identifier: argument}

The parts of the placeholder format are:

  • Identifier (required): the identifier used to register the placeholder.
  • Argument (optional): the argument passed to the replacement callback.
  • Plugin (optional): the name of the plugin to disambiguate if more plugins register the same identifier.

Placeholders are disabled by default and need to be enabled with Hologram.setPlaceholderSetting(PlaceholderSetting).

Since:
1
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the minimum interval in ticks between invocations of the replacement callback.
  • Method Details

    • getRefreshIntervalTicks

      int getRefreshIntervalTicks()
      Returns the minimum interval in ticks between invocations of the replacement callback. For individual placeholders the interval is counted separately for each player.

      Note that more ticks can pass between invocations if no player is near, do not use the replacement callback as a timer.

      Returns:
      the refresh interval in ticks
      Since:
      1