add inShown check to new holograms

stops holograms stacking
This commit is contained in:
Gatt 2020-07-16 22:28:37 +10:00
parent 75f680c480
commit 92d3403b51
1 changed files with 6 additions and 4 deletions

View File

@ -87,10 +87,12 @@ public abstract class NPCBase implements NPC, NPCPacketHandler {
originalhologram.hide(targetPlayer); // essentially destroy the hologram
textDisplayHolograms.remove(targetPlayer.getUniqueId()); // remove the old obj
}
Hologram hologram = getPlayerHologram(targetPlayer); //
List<Object> updatePackets = hologram.getUpdatePackets(getPlayerLines(targetPlayer));
hologram.update(targetPlayer, updatePackets);
if (isShown(targetPlayer)) { //only show hologram if the player is in range
Hologram hologram = getPlayerHologram(targetPlayer);
List<Object> updatePackets = hologram.getUpdatePackets(getPlayerLines(targetPlayer));
hologram.update(targetPlayer, updatePackets);
}
}
return this;
}