only change HoloDisplay lines if text changed

This commit is contained in:
jascotty2 2019-09-08 16:00:50 -05:00
parent 13865e10f0
commit 3b230a5d76

View File

@ -51,9 +51,19 @@ public class HolographicDisplaysHolograms extends Holograms {
if (hologram.getX() != location.getX()
|| hologram.getY() != location.getY()
|| hologram.getZ() != location.getZ()) continue;
hologram.clearLines();
for (String line : lines) {
hologram.appendTextLine(line);
// only update if there is a change to the text
boolean isChanged = lines.size() != hologram.size();
if(!isChanged) {
// double-check the lines
for(int i = 0; !isChanged && i < lines.size(); ++i) {
isChanged = !hologram.getLine(i).toString().equals("CraftTextLine [text=" + lines.get(i) + "]");
}
}
if(isChanged) {
hologram.clearLines();
for (String line : lines) {
hologram.appendTextLine(line);
}
}
return;
}