Skip to content

Commit

Permalink
update init and clear logic in FHHologram
Browse files Browse the repository at this point in the history
  • Loading branch information
HSGamer committed Dec 30, 2024
1 parent 0c3e83a commit 2441ee9
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class FHHologram implements PlayerVisibility, DisplayHologram<Location> {
*/
public FHHologram(String name, Location location) {
HologramData data = new TextHologramData(name, location);
data.setPersistent(false);
this.hologram = FancyHologramsPlugin.get().getHologramManager().create(data);
}

Expand All @@ -62,7 +63,7 @@ private void checkHologramInitialized() {
}

private void updateHologram() {
hologram.queueUpdate();
hologram.forceUpdate();
hologram.refreshForViewersInWorld();
}

Expand Down Expand Up @@ -129,14 +130,12 @@ public String getName() {
@Override
public void init() {
hologram.createHologram();
hologram.showHologram(Bukkit.getOnlinePlayers());
Bukkit.getOnlinePlayers().forEach(hologram::updateShownStateFor);
FancyHologramsPlugin.get().getHologramManager().addHologram(hologram);
}

@Override
public void clear() {
hologram.hideHologram(Bukkit.getOnlinePlayers());
hologram.deleteHologram();
FancyHologramsPlugin.get().getHologramManager().removeHologram(hologram);
}

Expand Down

0 comments on commit 2441ee9

Please sign in to comment.