mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-20 01:15:15 +01:00
Make BaseHologramLines implement Iterable
This commit is contained in:
parent
9d70087130
commit
88bfa7c662
@ -37,7 +37,7 @@ public class CopyCommand extends HologramSubCommand {
|
||||
InternalHologram toHologram = hologramEditor.getHologram(args[1]);
|
||||
|
||||
List<InternalHologramLine> clonedLines = new ArrayList<>();
|
||||
for (InternalHologramLine line : fromHologram.getLines().getAll()) {
|
||||
for (InternalHologramLine line : fromHologram.getLines()) {
|
||||
clonedLines.add(hologramEditor.parseHologramLine(toHologram, line.getSerializedConfigValue()));
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class InfoCommand extends LineEditingCommand implements QuickEditCommand
|
||||
DisplayFormat.sendTitle(sender, "Lines of the hologram '" + hologram.getName() + "'");
|
||||
int index = 0;
|
||||
|
||||
for (InternalHologramLine line : hologram.getLines().getAll()) {
|
||||
for (InternalHologramLine line : hologram.getLines()) {
|
||||
index++;
|
||||
sender.sendMessage(ColorScheme.SECONDARY_BOLD + index + ColorScheme.SECONDARY_DARKER + ". "
|
||||
+ ColorScheme.SECONDARY + line.getSerializedConfigValue());
|
||||
|
@ -30,7 +30,7 @@ public class HologramConfig {
|
||||
public HologramConfig(InternalHologram hologram) {
|
||||
this.name = hologram.getName();
|
||||
this.serializedLines = new ArrayList<>();
|
||||
for (InternalHologramLine line : hologram.getLines().getAll()) {
|
||||
for (InternalHologramLine line : hologram.getLines()) {
|
||||
serializedLines.add(line.getSerializedConfigValue());
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ public class APIHologram extends BaseHologram implements Hologram {
|
||||
}
|
||||
|
||||
this.allowPlaceholders = allowPlaceholders;
|
||||
for (APIHologramLine line : lines.getAll()) {
|
||||
for (APIHologramLine line : lines) {
|
||||
line.setChanged();
|
||||
}
|
||||
}
|
||||
@ -156,7 +156,7 @@ public class APIHologram extends BaseHologram implements Hologram {
|
||||
|
||||
double height = 0.0;
|
||||
|
||||
for (APIHologramLine line : lines.getAll()) {
|
||||
for (APIHologramLine line : lines) {
|
||||
height += line.getHeight();
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseHologramLines<T extends EditableHologramLine> {
|
||||
public class BaseHologramLines<T extends EditableHologramLine> implements Iterable<T> {
|
||||
|
||||
private final BaseHologram hologram;
|
||||
private final List<T> lines;
|
||||
@ -24,6 +24,11 @@ public class BaseHologramLines<T extends EditableHologramLine> {
|
||||
this.unmodifiableLinesView = Collections.unmodifiableList(lines);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<T> iterator() {
|
||||
return unmodifiableLinesView.iterator();
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return lines.size();
|
||||
}
|
||||
@ -32,10 +37,6 @@ public class BaseHologramLines<T extends EditableHologramLine> {
|
||||
return lines.isEmpty();
|
||||
}
|
||||
|
||||
public List<T> getAll() {
|
||||
return unmodifiableLinesView;
|
||||
}
|
||||
|
||||
public T get(int index) {
|
||||
return lines.get(index);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user