Fixed holograms when dynamic line, that is not the last one, disappears

This commit is contained in:
Eric 2017-05-30 21:10:57 +02:00
parent d4da428bc1
commit 0f1d68e0c1
2 changed files with 8 additions and 6 deletions

View File

@ -55,6 +55,10 @@ public class Hologram {
public void addLine(int line, String text) {
if (text == null || text.isEmpty()) return;
if (line >= armorStands.size()) {
line = armorStands.size();
}
text = ChatColor.translateAlternateColorCodes('&', text);
if (config.hologram_fixed_bottom) {
@ -69,10 +73,6 @@ public class Hologram {
}
}
if (line >= armorStands.size()) {
line = armorStands.size();
}
Location location = this.location.clone();
if (!config.hologram_fixed_bottom) {
@ -152,7 +152,7 @@ public class Hologram {
Location loc = location.clone().add(0, 0.4, 0);
try {
ArmorStand armorStand = (ArmorStand) location.getWorld().spawnEntity(loc, EntityType.ARMOR_STAND);
ArmorStand armorStand = (ArmorStand) loc.getWorld().spawnEntity(loc, EntityType.ARMOR_STAND);
armorStand.setGravity(false);
armorStand.setVisible(false);

View File

@ -231,7 +231,9 @@ public class Shop {
format = format.replace(regex.toString(), replace);
}
lines.add(format);
if (!format.isEmpty()) {
lines.add(format);
}
}
return lines.toArray(new String[lines.size()]);