Interface HolographicDisplaysAPI
Each API instance only manages the holograms and the placeholders of a specific plugin, see get(Plugin).
- Since:
- 1
-
Method Summary
Modifier and TypeMethodDescription@NotNull HologramcreateHologram(@NotNull Position position) Creates a hologram.@NotNull HologramcreateHologram(@NotNull org.bukkit.Location location) Creates a hologram.voidDeletes all the holograms.static @NotNull HolographicDisplaysAPIget(@NotNull org.bukkit.plugin.Plugin plugin) Returns the API instance for managing holograms and placeholders of the specified plugin.@NotNull Collection<Hologram> Returns all the holograms.@NotNull Collection<String> Returns all the registered placeholder identifiers.static intReturns the API version number, which is increased every time the API changes.booleanisRegisteredPlaceholder(@NotNull String identifier) Returns if a placeholder with a given identifier is registered.voidregisterGlobalPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull GlobalPlaceholderReplaceFunction replaceFunction) Registers a new global placeholder.voidregisterGlobalPlaceholder(@NotNull String identifier, @NotNull GlobalPlaceholder placeholder) Registers a new global placeholder.voidregisterGlobalPlaceholderFactory(@NotNull String identifier, @NotNull GlobalPlaceholderFactory placeholderFactory) Registers a new global placeholder factory.voidregisterIndividualPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull IndividualPlaceholderReplaceFunction replaceFunction) Registers a new individual placeholder.voidregisterIndividualPlaceholder(@NotNull String identifier, @NotNull IndividualPlaceholder placeholder) Registers a new individual placeholder.voidregisterIndividualPlaceholderFactory(@NotNull String identifier, @NotNull IndividualPlaceholderFactory placeholderFactory) Registers a new individual placeholder factory.voidunregisterPlaceholder(@NotNull String identifier) Unregisters the placeholder with a given identifier.voidUnregisters all placeholders.
-
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
Creates a hologram.- Parameters:
location- the initial location of the hologram- Returns:
- the created hologram
- Since:
- 1
-
createHologram
Creates a hologram.- Parameters:
position- the initial position of the hologram- Returns:
- the created hologram
- Since:
- 1
-
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 invokingHologram.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. SeeGlobalPlaceholderto 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 forPlaceholder.getRefreshIntervalTicks()- Parameters:
identifier- the case-insensitive identifier of the placeholderrefreshIntervalTicks- the minimum interval in ticks between invocations of the replace function (when the placeholder is in use), seePlaceholder.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. SeeGlobalPlaceholderto know more about global placeholders.- Parameters:
identifier- the case-insensitive identifier of the placeholderplaceholder- 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. SeeGlobalPlaceholderto 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
GlobalPlaceholderFactoryto know more about global placeholder factories.- Parameters:
identifier- the case-insensitive identifier of the placeholder factoryplaceholderFactory- 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. SeeIndividualPlaceholderto 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 forPlaceholder.getRefreshIntervalTicks()- Parameters:
identifier- the case-insensitive identifier of the placeholderrefreshIntervalTicks- the minimum interval in ticks between invocations of the replace function for each player (when the placeholder is in use), seePlaceholder.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. SeeIndividualPlaceholderto know more about individual placeholders.- Parameters:
identifier- the case-insensitive identifier of the placeholderplaceholder- 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. SeeIndividualPlaceholderto 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
IndividualPlaceholderFactoryto know more about individual placeholder factories.- Parameters:
identifier- the case-insensitive identifier of the placeholder factoryplaceholderFactory- the placeholder factory to register- Since:
- 1
-
isRegisteredPlaceholder
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
Returns all the registered placeholder identifiers.- Returns:
- an immutable copy of the registered placeholder identifiers
- Since:
- 1
-
unregisterPlaceholder
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
-