only change Holograms lines if text changed

This commit is contained in:
jascotty2 2019-09-08 16:12:15 -05:00
parent 3b230a5d76
commit 478be3f7d4

View File

@ -70,6 +70,14 @@ public class HologramsHolograms extends Holograms {
location = fixLocation(location);
Hologram hologram = hologramPlugin.getHologramManager().getHologram(locStr(location));
if (hologram != null) {
// only update if there is a change to the text
boolean isChanged = lines.size() != hologram.getLines().size();
if(!isChanged) {
// double-check the lines
for(int i = 0; !isChanged && i < lines.size(); ++i) {
isChanged = !hologram.getLine(i).getRaw().equals(lines.get(i));
}
}
for(HologramLine line : hologram.getLines().toArray(new HologramLine[0])) {
hologram.removeLine(line);
}