mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-12-28 03:17:51 +01:00
only change HoloDisplay lines if text changed
This commit is contained in:
parent
13865e10f0
commit
3b230a5d76
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user