SteamWar/BauSystem2.0
Archiviert
12
0

Fix BauScoreboard
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2024-03-05 12:21:11 +01:00
Ursprung 3ecd31e80c
Commit 2ccc7920d5

Datei anzeigen

@ -53,7 +53,7 @@ public class BauScoreboard implements Listener {
Region region = Region.getRegion(player.getLocation());
List<String> elements = new ArrayList<>();
calcGroup(elements, "§0", region, ScoreboardElement.ScoreboardGroup.HEADER);
calcGroup(elements, null, region, ScoreboardElement.ScoreboardGroup.HEADER);
calcGroup(elements, "§1", region, ScoreboardElement.ScoreboardGroup.REGION);
calcGroup(elements, "§2", region, ScoreboardElement.ScoreboardGroup.OTHER);
calcGroup(elements, "§3", region, ScoreboardElement.ScoreboardGroup.FOOTER);
@ -67,26 +67,26 @@ public class BauScoreboard implements Listener {
}
private void calcGroup(List<String> elements, String separator, Region region, ScoreboardElement.ScoreboardGroup group) {
List<String> groupElements = new ArrayList<>();
if (ELEMENTS.containsKey(group)) {
List<String> groupElements = new ArrayList<>();
for (ScoreboardElement element : ELEMENTS.get(group)) {
groupElements.add(element.get(region, player));
}
groupElements.removeIf(Objects::isNull);
if (!groupElements.isEmpty()) {
elements.add(separator);
elements.addAll(groupElements);
}
}
if (ADDITIONAL_SCOREBOARD_LINES.containsKey(player)) {
ADDITIONAL_SCOREBOARD_LINES.get(player).values()
.stream()
.filter(triple -> triple.getLeft() == group)
.sorted(Comparator.comparing(triple -> triple.getMiddle()))
.sorted(Comparator.comparing(MutableTriple::getMiddle))
.forEach(triple -> {
elements.add(triple.getRight());
groupElements.add(triple.getRight());
});
}
groupElements.removeIf(Objects::isNull);
if (!groupElements.isEmpty()) {
if (separator != null) elements.add(separator);
elements.addAll(groupElements);
}
}
@Override