From d140db2401c11fa4cbf5eaf8f9f8d53b95c6191b Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 3 Dec 2023 20:26:04 +0100 Subject: [PATCH] Fix entern after reset Signed-off-by: Lixfel --- .../steamwar/fightsystem/countdown/EnternCountdown.java | 8 +++----- .../src/de/steamwar/fightsystem/fight/FightPlayer.java | 5 +++-- .../src/de/steamwar/fightsystem/fight/FightTeam.java | 3 ++- .../src/de/steamwar/fightsystem/utils/EnterHandler.java | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/countdown/EnternCountdown.java b/FightSystem_Core/src/de/steamwar/fightsystem/countdown/EnternCountdown.java index 7517be6..d8c78d9 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/countdown/EnternCountdown.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/countdown/EnternCountdown.java @@ -25,17 +25,15 @@ import de.steamwar.fightsystem.fight.FightPlayer; import de.steamwar.fightsystem.utils.Message; import de.steamwar.fightsystem.utils.SWSound; import de.steamwar.techhider.ProtocolUtils; -import de.steamwar.fightsystem.winconditions.Wincondition; import net.md_5.bungee.api.ChatMessageType; import java.util.List; public class EnternCountdown extends Countdown { - private static int calcTime(FightPlayer fp) { + private static int calcTime(FightPlayer fp, Countdown countdown) { int time = Config.EnterStages.get(fp.getKit().getEnterStage()); - Countdown countdown = Wincondition.getTimeOverCountdown(); if(countdown != null) { time -= Config.TimeoutTime - countdown.getTimeLeft(); @@ -49,8 +47,8 @@ public class EnternCountdown extends Countdown { private final FightPlayer fightPlayer; private List chunkPos; - public EnternCountdown(FightPlayer fp) { - super(calcTime(fp), new Message("ENTERN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false); + public EnternCountdown(FightPlayer fp, Countdown countdown) { + super(calcTime(fp, countdown), new Message("ENTERN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false); fightPlayer = fp; enable(); } diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightPlayer.java b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightPlayer.java index 2ea6f58..e6740a8 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightPlayer.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightPlayer.java @@ -21,6 +21,7 @@ package de.steamwar.fightsystem.fight; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.ai.AI; +import de.steamwar.fightsystem.countdown.Countdown; import de.steamwar.fightsystem.countdown.EnternCountdown; import de.steamwar.sql.PersonalKit; import de.steamwar.sql.SteamwarUser; @@ -65,9 +66,9 @@ public class FightPlayer { ifAI(AI::stop); } - public void startEnternCountdown() { + public void startEnternCountdown(Countdown countdown) { if(Config.EnterStages.size() > kit.getEnterStage() && kit.getEnterStage() >= 0) - enternCountdown = new EnternCountdown(this); + enternCountdown = new EnternCountdown(this, countdown); } public void stopEnternCountdown(){ diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java index 94774aa..878aa79 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java @@ -33,6 +33,7 @@ import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.OneShotStateDependent; import de.steamwar.fightsystem.states.StateDependent; import de.steamwar.fightsystem.utils.*; +import de.steamwar.fightsystem.winconditions.Wincondition; import de.steamwar.fightsystem.winconditions.Winconditions; import de.steamwar.inventory.SWItem; import de.steamwar.sql.SchematicNode; @@ -284,7 +285,7 @@ public class FightTeam { }); if(FightState.Running.contains(FightState.getFightState())) - fightPlayer.startEnternCountdown(); + fightPlayer.startEnternCountdown(Wincondition.getTimeOverCountdown()); GlobalRecorder.getInstance().playerJoins(entity, user); fightPlayer.ifPlayer(player -> FightSystem.getTechHider().reloadChunks(player, chunksToReload, false)); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/utils/EnterHandler.java b/FightSystem_Core/src/de/steamwar/fightsystem/utils/EnterHandler.java index ee5aa79..042efba 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/utils/EnterHandler.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/utils/EnterHandler.java @@ -51,7 +51,7 @@ public class EnterHandler implements IStateDependent { private void registerTeam(FightTeam team){ for(FightPlayer fp : team.getPlayers()){ - fp.startEnternCountdown(); + fp.startEnternCountdown(null); } }