Alright running into problems with HolographicDisplays when I tried making per player holograms, not sure why this wouldn't be working.
Currently using the latest version of HolographicDisplays on the server (2.4.4) and the server spigot is 1.8 based (Custom SportPaper fork).
There are no errors in console.
I originally tried to do it this way, which didn't work.
Then tried to do it this way by storing it in a HashMap and looping through the Holograms to hide them for all online players and showing the player's hologram to them and the hide it to other players online, but this didn't work either.
If anyone could help would highly appreciate it
Thanks
Currently using the latest version of HolographicDisplays on the server (2.4.4) and the server spigot is 1.8 based (Custom SportPaper fork).
There are no errors in console.
I originally tried to do it this way, which didn't work.
Code:
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Location location = ...
JavaPlugin plugin = ...
Hologram hologram = HologramsAPI.createHologram(plugin, location);
hologram.getVisibilityManager().setVisibleByDefault(false);
hologram.appendTextLine(ChatColor.GREEN + "Your Stats: " + event.getPlayer().getName());
hologram.getVisibilityManager().showTo(event.getPlayer());
}
Then tried to do it this way by storing it in a HashMap and looping through the Holograms to hide them for all online players and showing the player's hologram to them and the hide it to other players online, but this didn't work either.
Code:
private final Map<UUID, Hologram> holograms = new HashMap<>();
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Location location = ...
JavaPlugin plugin = ...
Hologram hologram = HologramsAPI.createHologram(plugin, location);
hologram.appendTextLine(ChatColor.GREEN + "Your Stats: " + event.getPlayer().getName());
Bukkit.getOnlinePlayers().forEach(player -> hologram.getVisibilityManager().hideTo(player));
holograms.values().forEach(loopHologram -> loopHologram.getVisibilityManager().hideTo(event.getPlayer()));
hologram.getVisibilityManager().showTo(event.getPlayer());
holograms.put(event.getPlayer().getUniqueId(), hologram);
}
If anyone could help would highly appreciate it
