registerGlobalPlaceholder
DevSnx opened this issue · 4 comments
Confirmation
- I have read the documentation.
- I have read the FAQ.
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
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.
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