From 5842888fc2a1643c96ff7acd6b7225201b8b99b3 Mon Sep 17 00:00:00 2001 From: Trixkz Date: Fri, 27 Oct 2023 11:33:29 -0400 Subject: [PATCH] Updates --- .../loganmagnan/eventcore/managers/event/Event.java | 1 + .../eventcore/managers/event/EventManager.java | 5 ++++- .../eventcore/scoreboard/ScoreboardProvider.java | 11 ++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/loganmagnan/eventcore/managers/event/Event.java b/src/main/java/com/loganmagnan/eventcore/managers/event/Event.java index 9e035b9..89d50f3 100644 --- a/src/main/java/com/loganmagnan/eventcore/managers/event/Event.java +++ b/src/main/java/com/loganmagnan/eventcore/managers/event/Event.java @@ -32,4 +32,5 @@ public class Event { private boolean timerEnabled; private boolean blockPlaceEventCancelled; private boolean blockBreakEventCancelled; + private boolean started; } diff --git a/src/main/java/com/loganmagnan/eventcore/managers/event/EventManager.java b/src/main/java/com/loganmagnan/eventcore/managers/event/EventManager.java index 5360761..83cf975 100644 --- a/src/main/java/com/loganmagnan/eventcore/managers/event/EventManager.java +++ b/src/main/java/com/loganmagnan/eventcore/managers/event/EventManager.java @@ -76,7 +76,8 @@ public class EventManager { this.config.getBoolean("EVENT.TOGGLEABLE-OPTIONS.SCOREBOARD-ENABLED"), this.config.getBoolean("EVENT.TOGGLEABLE-OPTIONS.TIMER-ENABLED"), this.config.getBoolean("EVENT.TOGGLEABLE-OPTIONS.EVENTS.BLOCK-PLACE.CANCELLED"), - this.config.getBoolean("EVENT.TOGGLEABLE-OPTIONS.EVENTS.BLOCK-BREAK.CANCELLED") + this.config.getBoolean("EVENT.TOGGLEABLE-OPTIONS.EVENTS.BLOCK-BREAK.CANCELLED"), + this.config.getBoolean("EVENT.STARTED") ); } catch (NullPointerException exception) { this.main.getServer().getConsoleSender().sendMessage(ColorUtils.getMessageType("&cEvent information not found")); @@ -93,6 +94,7 @@ public class EventManager { true, true, false, + false, false ); } @@ -140,6 +142,7 @@ public class EventManager { this.config.set("EVENT.TOGGLEABLE-OPTIONS.TIMER-ENABLED", this.event.isTimerEnabled()); this.config.set("EVENT.TOGGLEABLE-OPTIONS.EVENTS.BLOCK-PLACE.CANCELLED", this.event.isBlockPlaceEventCancelled()); this.config.set("EVENT.TOGGLEABLE-OPTIONS.EVENTS.BLOCK-BREAK.CANCELLED", this.event.isBlockBreakEventCancelled()); + this.config.set("EVENT.STARTED", this.event.isStarted()); this.main.getMainConfig().save(); } } diff --git a/src/main/java/com/loganmagnan/eventcore/scoreboard/ScoreboardProvider.java b/src/main/java/com/loganmagnan/eventcore/scoreboard/ScoreboardProvider.java index bf44b09..869a257 100644 --- a/src/main/java/com/loganmagnan/eventcore/scoreboard/ScoreboardProvider.java +++ b/src/main/java/com/loganmagnan/eventcore/scoreboard/ScoreboardProvider.java @@ -4,12 +4,14 @@ import aether.scoreboard.Board; import aether.scoreboard.BoardAdapter; import aether.scoreboard.cooldown.BoardCooldown; import com.loganmagnan.eventcore.EventCore; +import com.loganmagnan.eventcore.managers.event.teams.Team; import com.loganmagnan.eventcore.playerdata.PlayerData; import com.loganmagnan.eventcore.playerdata.PlayerSettings; import com.loganmagnan.eventcore.utils.ColorUtils; import com.loganmagnan.eventcore.utils.Constants; import org.bukkit.entity.Player; import org.bukkit.scoreboard.Scoreboard; + import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -52,12 +54,19 @@ public class ScoreboardProvider implements BoardAdapter { private List getSpawnScoreboard(Player player, PlayerData playerData) { List lines = new ArrayList<>(); + + int players = 0; + + for (Team team : this.main.getEventManager().getEvent().getTeams()) { + players += team.getPlayingPlayers().size(); + } + lines.add(ColorUtils.getMessageType("")); lines.add(ColorUtils.getMessageType("&b┏ &b&l" + player.getName())); lines.add(ColorUtils.getMessageType("&b┕ &fPing: &b" + player.getPing())); lines.add(ColorUtils.getMessageType("")); lines.add(ColorUtils.getMessageType("&b┏ &b&lEvent Information")); - lines.add(ColorUtils.getMessageType("&b┝ &fPlayers: &b" + this.main.getServer().getOnlinePlayers().size())); + lines.add(ColorUtils.getMessageType("&b┝ &fPlayers: &b" + (this.main.getEventManager().getEvent().isStarted() ? players : this.main.getServer().getOnlinePlayers().size()))); lines.add(ColorUtils.getMessageType("&b┕ &fTeams: &b" + this.main.getEventManager().getEvent().getAmountOfTeams())); lines.add(ColorUtils.getMessageType("")); lines.add(ColorUtils.getMessageType("&7&o" + Constants.INFORMATION.get("server-ip-address")));