From 3a121afd816f31f3bde5e1d9511a27691509fb96 Mon Sep 17 00:00:00 2001 From: NotCoded <66999075+not-coded@users.noreply.github.com> Date: Wed, 21 Aug 2024 22:53:37 +0200 Subject: [PATCH] clone ahhh --- .../games/duels/team/TeamDuelsGame.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/nexia/minigames/games/duels/team/TeamDuelsGame.java b/src/main/java/com/nexia/minigames/games/duels/team/TeamDuelsGame.java index a1ad6d87..1984d04f 100644 --- a/src/main/java/com/nexia/minigames/games/duels/team/TeamDuelsGame.java +++ b/src/main/java/com/nexia/minigames/games/duels/team/TeamDuelsGame.java @@ -198,27 +198,35 @@ public void duelSecond() { this.level, color); this.currentEndTime++; if (this.currentEndTime >= this.endTime || !this.shouldWait) { - DuelsTeam winnerTeam = this.winner; - DuelsTeam loserTeam = this.loser; + DuelsTeam winnerTeam = this.winner == null ? this.team1 : this.winner; + DuelsTeam loserTeam = this.loser == null ? this.team2 : this.loser; for (NexiaPlayer spectator : this.spectators) { + spectator = spectator.refreshPlayer(); spectator.runCommand("/hub", 0, false); } this.isEnding = false; - for (NexiaPlayer player : loserTeam.all) { - ((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).gameOptions = null; - player.runCommand("/hub", 0, false); + if(loserTeam != null) { + for (NexiaPlayer player : loserTeam.all) { + player = player.refreshPlayer(); + ((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).gameOptions = null; + player.runCommand("/hub", 0, false); + } + loserTeam.refreshTeam(); } - for (NexiaPlayer player : winnerTeam.all) { - ((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).gameOptions = null; - player.runCommand("/hub", 0, false); + + if(winnerTeam != null) { + for (NexiaPlayer player : winnerTeam.all) { + player = player.refreshPlayer(); + ((DuelsPlayerData)PlayerDataManager.getDataManager(NexiaCore.DUELS_DATA_MANAGER).get(player)).gameOptions = null; + player.runCommand("/hub", 0, false); + } + winnerTeam.refreshTeam(); } DuelGameHandler.deleteWorld(String.valueOf(this.uuid)); - this.team1.refreshTeam(); - this.team2.refreshTeam(); removeDuelsGame(); return; }