Holographic Displays

Holographic Displays

3M Downloads

registerGlobalPlaceholder

DevSnx opened this issue · 4 comments

commented

Confirmation

Description

Placeholder loaded but not in Hologram..
My Code

private void registerInvidualPlaceholders(){ api.registerIndividualPlaceholder("statsapi_info", new IndividualPlaceholder() { @Override public @Nullable String getReplacement(@NotNull Player player, @Nullable String s) { return "§4StatsAPI §bv2.0.0" + " §7by §4DevSnx"; } @Override public int getRefreshIntervalTicks() { return 0; } }); }

private void registerNewPlaceholders(){ HolographicDisplaysAPI api = HolographicDisplaysAPI.get(StatsAPIAddon.getInstance()); api.registerGlobalPlaceholder("statsapi_info2", 30, new GlobalPlaceholderReplaceFunction() { @Override public @NotNull String getReplacement(@NotNull String s) { return "§4StatsAPI §bv2.0.0" + " §7by §4DevSnx"; } }); }

Holographic Displays version

newest

Additional information

No response

commented

Make sure to enable placeholders in a hologram if you're also creating them from your plugin. Placeholders are disabled by default in holograms created from the API.

commented

Also make sure that your method is actually called.

commented

Make sure to enable placeholders in a hologram if you're also creating them from your plugin. Placeholders are disabled by default in holograms created from the API.

Hi, it is not working for me also:

HolographicDisplaysAPI api = HolographicDisplaysAPI.get(this);
api.registerGlobalPlaceholder("reset-time", 20, s -> {
    return "TEST";
});

Hologram hologram = api.createHologram(location);
hologram.setPlaceholderSetting(PlaceholderSetting.ENABLE_ALL);

hologram.getLines().appendText("%reset-time%");

Bukkit.broadcastMessage(hologram.getPlaceholderSetting() + ""); // prints PlaceholderSetting.ENABLE_ALL

image

commented

nvm, it worked: {reset-time}