From ceafe6ebfbdff2f13faca5b8acb4501925fd7af7 Mon Sep 17 00:00:00 2001 From: Luca Date: Sun, 21 Nov 2021 21:48:17 +0100 Subject: [PATCH] scoreboard playing players --- .../java/rip/tilly/bedwars/managers/GameManager.java | 11 +++++++++++ .../providers/scoreboard/ScoreboardProvider.java | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/rip/tilly/bedwars/managers/GameManager.java b/src/main/java/rip/tilly/bedwars/managers/GameManager.java index b1d5fc2..e94a3e8 100644 --- a/src/main/java/rip/tilly/bedwars/managers/GameManager.java +++ b/src/main/java/rip/tilly/bedwars/managers/GameManager.java @@ -30,6 +30,17 @@ public class GameManager { private final Map> gameRequests = new TtlHashMap<>(TimeUnit.SECONDS, 30); @Getter private final Map games = new ConcurrentHashMap<>(); + public int getFighters() { + int i = 0; + for (Game game : this.games.values()) { + for (GameTeam team : game.getTeams()) { + i += team.getPlayingPlayers().size(); + } + } + + return i; + } + public Game getGame(PlayerData playerData) { return this.games.get(playerData.getCurrentGameId()); } diff --git a/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java b/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java index 8f41454..cfa9a55 100644 --- a/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java +++ b/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java @@ -52,7 +52,7 @@ public class ScoreboardProvider implements AssembleAdapter { lines.add(CC.scoreboardBar); } lines.add("&fOnline: &d" + this.main.getServer().getOnlinePlayers().size()); - lines.add("&fPlaying: &d"); + lines.add("&fPlaying: &d" + this.main.getGameManager().getFighters()); lines.add(" "); if (true) {