Interface HolographicDisplaysAPI


public interface HolographicDisplaysAPI
Main entry point for accessing the Holographic Displays API.

Each API instance only manages the holograms and the placeholders of a specific plugin, see get(Plugin).

Since:
1
  • Method Details

    • getVersion

      static int getVersion()
      Returns the API version number, which is increased every time the API changes.

      All public API classes and methods are documented with the Javadoc tag @since, indicating in which API version that element was introduced.

      This number can be used it to require a minimum version, as features may be added (rarely removed) in future versions. The first version of the API is 1.

      The API version is unrelated to the standard plugin version.

      Returns:
      the current API version
      Since:
      1
    • get

      @NotNull static @NotNull HolographicDisplaysAPI get(@NotNull @NotNull org.bukkit.plugin.Plugin plugin)
      Returns the API instance for managing holograms and placeholders of the specified plugin.

      Holograms and placeholders created by other plugins are completely separate, each API instance can only manage and retrieve the ones of the specified plugin. Unless for very specific reasons, a plugin should only use its own API instance.

      Parameters:
      plugin - the plugin using the API
      Returns:
      an API instance for the specified plugin
      Since:
      1
    • createHologram

      @NotNull @NotNull Hologram createHologram(@NotNull @NotNull org.bukkit.Location location)
      Creates a hologram.
      Parameters:
      location - the initial location of the hologram
      Returns:
      the created hologram
      Since:
      1
    • createHologram

      @NotNull @NotNull Hologram createHologram(@NotNull @NotNull Position position)
      Creates a hologram.
      Parameters:
      position - the initial position of the hologram
      Returns:
      the created hologram
      Since:
      1
    • getHolograms

      @NotNull @NotNull Collection<Hologram> getHolograms()
      Returns all the holograms. Deleted holograms are not included.
      Returns:
      an immutable copy of all the holograms
      Since:
      1
    • deleteHolograms

      void deleteHolograms()
      Deletes all the holograms. Equivalent to invoking Hologram.delete() on each hologram.
      Since:
      1
    • registerGlobalPlaceholder

      void registerGlobalPlaceholder(@NotNull @NotNull String identifier, int refreshIntervalTicks, @NotNull @NotNull GlobalPlaceholderReplaceFunction replaceFunction)
      Registers a new global placeholder. Any previously registered element (global or individual) with the same identifier is overwritten. See GlobalPlaceholder to know more about global placeholders.

      This is a simplified method to register a placeholder by providing separately its replace function for GlobalPlaceholder.getReplacement(String) and a fixed refresh interval for Placeholder.getRefreshIntervalTicks()

      Parameters:
      identifier - the case-insensitive identifier of the placeholder
      refreshIntervalTicks - the minimum interval in ticks between invocations of the replace function (when the placeholder is in use), see Placeholder.getRefreshIntervalTicks()
      replaceFunction - the callback function to provide the replacement text to display
      Since:
      1
    • registerGlobalPlaceholder

      void registerGlobalPlaceholder(@NotNull @NotNull String identifier, @NotNull @NotNull GlobalPlaceholder placeholder)
      Registers a new global placeholder. Any previously registered element (global or individual) with the same identifier is overwritten. See GlobalPlaceholder to know more about global placeholders.
      Parameters:
      identifier - the case-insensitive identifier of the placeholder
      placeholder - the placeholder to register
      Since:
      1
    • registerGlobalPlaceholderFactory

      void registerGlobalPlaceholderFactory(@NotNull @NotNull String identifier, @NotNull @NotNull GlobalPlaceholderFactory placeholderFactory)
      Registers a new global placeholder factory. Any previously registered element (global or individual) with the same identifier is overwritten. See GlobalPlaceholder to know more about global placeholders.

      This method is more complex and not usually needed: it is necessary if parsing the argument of the placeholder is performance intensive, for example a mathematical expression or a JSON string.

      See GlobalPlaceholderFactory to know more about global placeholder factories.

      Parameters:
      identifier - the case-insensitive identifier of the placeholder factory
      placeholderFactory - the placeholder factory to register
      Since:
      1
    • registerIndividualPlaceholder

      void registerIndividualPlaceholder(@NotNull @NotNull String identifier, int refreshIntervalTicks, @NotNull @NotNull IndividualPlaceholderReplaceFunction replaceFunction)
      Registers a new individual placeholder. Any previously registered element (global or individual) with the same identifier is overwritten. See IndividualPlaceholder to know more about individual placeholders.

      This is a simplified method to register a placeholder by providing separately its replace function for IndividualPlaceholder.getReplacement(Player, String) and a fixed refresh interval for Placeholder.getRefreshIntervalTicks()

      Parameters:
      identifier - the case-insensitive identifier of the placeholder
      refreshIntervalTicks - the minimum interval in ticks between invocations of the replace function for each player (when the placeholder is in use), see Placeholder.getRefreshIntervalTicks()
      replaceFunction - the callback function to provide the replacement text to display
      Since:
      1
    • registerIndividualPlaceholder

      void registerIndividualPlaceholder(@NotNull @NotNull String identifier, @NotNull @NotNull IndividualPlaceholder placeholder)
      Registers a new individual placeholder. Any previously registered element (global or individual) with the same identifier is overwritten. See IndividualPlaceholder to know more about individual placeholders.
      Parameters:
      identifier - the case-insensitive identifier of the placeholder
      placeholder - the placeholder to register
      Since:
      1
    • registerIndividualPlaceholderFactory

      void registerIndividualPlaceholderFactory(@NotNull @NotNull String identifier, @NotNull @NotNull IndividualPlaceholderFactory placeholderFactory)
      Registers a new individual placeholder factory. Any previously registered element (global or individual) with the same identifier is overwritten. See IndividualPlaceholder to know more about individual placeholders.

      This method is more complex and not usually needed: it is necessary if parsing the argument of the placeholder is performance intensive, for example a mathematical expression or a JSON string.

      See IndividualPlaceholderFactory to know more about individual placeholder factories.

      Parameters:
      identifier - the case-insensitive identifier of the placeholder factory
      placeholderFactory - the placeholder factory to register
      Since:
      1
    • isRegisteredPlaceholder

      boolean isRegisteredPlaceholder(@NotNull @NotNull String identifier)
      Returns if a placeholder with a given identifier is registered.
      Parameters:
      identifier - the case-insensitive identifier of the placeholder
      Returns:
      if the given placeholder identifier exists
      Since:
      1
    • getRegisteredPlaceholders

      @NotNull @NotNull Collection<String> getRegisteredPlaceholders()
      Returns all the registered placeholder identifiers.
      Returns:
      an immutable copy of the registered placeholder identifiers
      Since:
      1
    • unregisterPlaceholder

      void unregisterPlaceholder(@NotNull @NotNull String identifier)
      Unregisters the placeholder with a given identifier.
      Parameters:
      identifier - the identifier of the placeholder to unregister, case-insensitive
      Since:
      1
    • unregisterPlaceholders

      void unregisterPlaceholders()
      Unregisters all placeholders.
      Since:
      1