From 3eed8f07efe2cccdb204374984b80e8c6deab3b4 Mon Sep 17 00:00:00 2001 From: Trixkz Date: Sun, 21 Nov 2021 18:19:23 -0500 Subject: [PATCH] some more shit --- .idea/workspace.xml | 43 ++++++++----------- src/main/java/rip/tilly/bedwars/BedWars.java | 3 +- .../rip/tilly/bedwars/game/GameState.java | 1 + .../bedwars/game/events/GameStartEvent.java | 1 + .../bedwars/listeners/GameStartListener.java | 17 ++++++++ .../scoreboard/ScoreboardProvider.java | 5 ++- 6 files changed, 44 insertions(+), 26 deletions(-) create mode 100644 src/main/java/rip/tilly/bedwars/listeners/GameStartListener.java diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2cca83a..b23d28b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -23,32 +23,11 @@ - - - - - - - - - - - - + - - - - - - - - - - - - + + \ No newline at end of file diff --git a/src/main/java/rip/tilly/bedwars/BedWars.java b/src/main/java/rip/tilly/bedwars/BedWars.java index 3247781..1111d36 100644 --- a/src/main/java/rip/tilly/bedwars/BedWars.java +++ b/src/main/java/rip/tilly/bedwars/BedWars.java @@ -7,6 +7,7 @@ import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.plugin.java.JavaPlugin; +import rip.tilly.bedwars.listeners.GameStartListener; import rip.tilly.bedwars.listeners.InteractListener; import rip.tilly.bedwars.listeners.PlayerDataListener; import rip.tilly.bedwars.listeners.RandomListeners; @@ -117,7 +118,7 @@ public final class BedWars extends JavaPlugin { private void loadListeners() { Arrays.asList( - new PlayerDataListener(), new RandomListeners(), new InteractListener() + new PlayerDataListener(), new RandomListeners(), new InteractListener(), new GameStartListener() ).forEach(listener -> this.getServer().getPluginManager().registerEvents(listener, this)); } } diff --git a/src/main/java/rip/tilly/bedwars/game/GameState.java b/src/main/java/rip/tilly/bedwars/game/GameState.java index f9ece9c..c02b2fc 100644 --- a/src/main/java/rip/tilly/bedwars/game/GameState.java +++ b/src/main/java/rip/tilly/bedwars/game/GameState.java @@ -1,6 +1,7 @@ package rip.tilly.bedwars.game; public enum GameState { + STARTING, FIGHTING, ENDING diff --git a/src/main/java/rip/tilly/bedwars/game/events/GameStartEvent.java b/src/main/java/rip/tilly/bedwars/game/events/GameStartEvent.java index 3569528..8aadeda 100644 --- a/src/main/java/rip/tilly/bedwars/game/events/GameStartEvent.java +++ b/src/main/java/rip/tilly/bedwars/game/events/GameStartEvent.java @@ -3,6 +3,7 @@ package rip.tilly.bedwars.game.events; import rip.tilly.bedwars.game.Game; public class GameStartEvent extends GameEvent { + public GameStartEvent(Game game) { super(game); } diff --git a/src/main/java/rip/tilly/bedwars/listeners/GameStartListener.java b/src/main/java/rip/tilly/bedwars/listeners/GameStartListener.java new file mode 100644 index 0000000..a149d4f --- /dev/null +++ b/src/main/java/rip/tilly/bedwars/listeners/GameStartListener.java @@ -0,0 +1,17 @@ +package rip.tilly.bedwars.listeners; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import rip.tilly.bedwars.BedWars; +import rip.tilly.bedwars.game.Game; +import rip.tilly.bedwars.game.events.GameStartEvent; + +public class GameStartListener implements Listener { + + private BedWars main = BedWars.getInstance(); + + @EventHandler + public void onGameStart(GameStartEvent event) { + Game game = event.getGame(); + } +} 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 cfa9a55..f071952 100644 --- a/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java +++ b/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java @@ -42,15 +42,18 @@ public class ScoreboardProvider implements AssembleAdapter { private List spawnScoreboard(PlayerData playerData) { List lines = new ArrayList(); + boolean inParty = this.main.getPartyManager().getParty(playerData.getUniqueId()) != null; lines.add(CC.scoreboardBar); + if (inParty) { Party party = this.main.getPartyManager().getParty(playerData.getUniqueId()); lines.add("&9Party Leader: &d" + Bukkit.getPlayer(party.getLeader()).getName()); - lines.add("&9Party Members: &d" + party.getMembers().size()); + lines.add("&9Party Members: &d" + party.getMembers().size() + "&7/&d" + party.getLimit()); lines.add(CC.scoreboardBar); } + lines.add("&fOnline: &d" + this.main.getServer().getOnlinePlayers().size()); lines.add("&fPlaying: &d" + this.main.getGameManager().getFighters()); lines.add(" ");