From 2ccc7920d5689b0710e4a9203ff0634c48074f23 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 5 Mar 2024 12:21:11 +0100 Subject: [PATCH] Fix BauScoreboard --- .../features/world/BauScoreboard.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java index 0961499e..74098b1b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauScoreboard.java @@ -53,7 +53,7 @@ public class BauScoreboard implements Listener { Region region = Region.getRegion(player.getLocation()); List 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 elements, String separator, Region region, ScoreboardElement.ScoreboardGroup group) { + List groupElements = new ArrayList<>(); if (ELEMENTS.containsKey(group)) { - List 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