Add isRegisteredPlaceholder method to the API

This commit is contained in:
filoghost 2021-05-03 15:44:11 +02:00
parent a7a7fcc68b
commit 588e2ed394
3 changed files with 16 additions and 0 deletions

View File

@ -66,6 +66,11 @@ public interface HolographicDisplaysAPI {
*/
void registerPlaceholder(@NotNull String identifier, int refreshIntervalTicks, @NotNull PlaceholderReplacer replacer);
/**
* @since 1
*/
boolean isRegisteredPlaceholder(@NotNull String identifier);
/**
* Returns all the registered placeholder identifiers.
*

View File

@ -47,6 +47,13 @@ public class DefaultHolographicDisplaysAPI implements HolographicDisplaysAPI {
placeholderRegistry.registerReplacer(plugin, identifier, refreshIntervalTicks, replacer);
}
@Override
public boolean isRegisteredPlaceholder(String identifier) {
Preconditions.notNull(identifier, "identifier");
return placeholderRegistry.isRegisteredIdentifier(plugin, identifier);
}
@Override
public Collection<Hologram> getHolograms() {
return apiHologramManager.getHologramsByPlugin(plugin);

View File

@ -87,4 +87,8 @@ public class PlaceholderRegistry {
return identifiers;
}
public boolean isRegisteredIdentifier(Plugin plugin, String identifier) {
return placeholderExpansions.contains(new PlaceholderIdentifier(identifier), new PluginName(plugin));
}
}