From 1616081d548b44703d8cfef30304d299fcc74d73 Mon Sep 17 00:00:00 2001 From: Jonakls Date: Sun, 16 Apr 2023 21:24:38 -0500 Subject: [PATCH] feat(board): change iterator for all boards --- .../managers/ScoreboardManager.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/plugin/src/main/java/com/xism4/sternalboard/managers/ScoreboardManager.java b/plugin/src/main/java/com/xism4/sternalboard/managers/ScoreboardManager.java index 6dafa3e..3fb7eed 100644 --- a/plugin/src/main/java/com/xism4/sternalboard/managers/ScoreboardManager.java +++ b/plugin/src/main/java/com/xism4/sternalboard/managers/ScoreboardManager.java @@ -18,11 +18,12 @@ public class ScoreboardManager { private final SternalBoardPlugin plugin; - private final Map boardHandlerMap = new ConcurrentHashMap<>(); + private final Map boardHandlerMap; private Integer updateTask; public ScoreboardManager(SternalBoardPlugin plugin) { this.plugin = plugin; + this.boardHandlerMap = new ConcurrentHashMap<>(); } public Map getBoardsHandler() { @@ -51,20 +52,20 @@ public void init() { ConfigurationSection defaultSection = plugin.getConfig() .getConfigurationSection("settings.scoreboard"); - for (SternalBoardHandler board : boardHandlerMap.values()) { + boardHandlerMap.forEach((context, handler) -> { switch (scoreboardMode) { case "WORLD": - processWorldScoreboard(board, defaultSection); - return; + processWorldScoreboard(handler, defaultSection); + break; case "PERMISSION": - processPermissionScoreboard(board, defaultSection); - return; + processPermissionScoreboard(handler, defaultSection); + break; case "NORMAL": default: - Scoreboards.updateFromSection(plugin, board, defaultSection); - return; + Scoreboards.updateFromSection(plugin, handler, defaultSection); + break; } - } + }); }, 0, updateTime).getTaskId(); }