SteamWar/FightSystem
Archiviert
13
1

Fix entern after reset #405

Zusammengeführt
Lixfel hat 1 Commits von entern-fix nach master 2023-12-03 20:28:04 +01:00 zusammengeführt
4 geänderte Dateien mit 9 neuen und 9 gelöschten Zeilen
Nur Änderungen aus Commit d140db2401 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -25,17 +25,15 @@ import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.utils.Message; import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound; import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.techhider.ProtocolUtils; import de.steamwar.techhider.ProtocolUtils;
import de.steamwar.fightsystem.winconditions.Wincondition;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
import java.util.List; import java.util.List;
public class EnternCountdown extends Countdown { 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()); int time = Config.EnterStages.get(fp.getKit().getEnterStage());
Countdown countdown = Wincondition.getTimeOverCountdown();
if(countdown != null) { if(countdown != null) {
time -= Config.TimeoutTime - countdown.getTimeLeft(); time -= Config.TimeoutTime - countdown.getTimeLeft();
@ -49,8 +47,8 @@ public class EnternCountdown extends Countdown {
private final FightPlayer fightPlayer; private final FightPlayer fightPlayer;
private List<ProtocolUtils.ChunkPos> chunkPos; private List<ProtocolUtils.ChunkPos> chunkPos;
public EnternCountdown(FightPlayer fp) { public EnternCountdown(FightPlayer fp, Countdown countdown) {
super(calcTime(fp), new Message("ENTERN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false); super(calcTime(fp, countdown), new Message("ENTERN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
fightPlayer = fp; fightPlayer = fp;
enable(); enable();
} }

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.fightsystem.fight;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.ai.AI; import de.steamwar.fightsystem.ai.AI;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.countdown.EnternCountdown; import de.steamwar.fightsystem.countdown.EnternCountdown;
import de.steamwar.sql.PersonalKit; import de.steamwar.sql.PersonalKit;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
@ -65,9 +66,9 @@ public class FightPlayer {
ifAI(AI::stop); ifAI(AI::stop);
} }
public void startEnternCountdown() { public void startEnternCountdown(Countdown countdown) {
if(Config.EnterStages.size() > kit.getEnterStage() && kit.getEnterStage() >= 0) if(Config.EnterStages.size() > kit.getEnterStage() && kit.getEnterStage() >= 0)
enternCountdown = new EnternCountdown(this); enternCountdown = new EnternCountdown(this, countdown);
} }
public void stopEnternCountdown(){ public void stopEnternCountdown(){

Datei anzeigen

@ -33,6 +33,7 @@ import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.OneShotStateDependent; import de.steamwar.fightsystem.states.OneShotStateDependent;
import de.steamwar.fightsystem.states.StateDependent; import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.utils.*; import de.steamwar.fightsystem.utils.*;
import de.steamwar.fightsystem.winconditions.Wincondition;
import de.steamwar.fightsystem.winconditions.Winconditions; import de.steamwar.fightsystem.winconditions.Winconditions;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
@ -284,7 +285,7 @@ public class FightTeam {
}); });
if(FightState.Running.contains(FightState.getFightState())) if(FightState.Running.contains(FightState.getFightState()))
fightPlayer.startEnternCountdown(); fightPlayer.startEnternCountdown(Wincondition.getTimeOverCountdown());
GlobalRecorder.getInstance().playerJoins(entity, user); GlobalRecorder.getInstance().playerJoins(entity, user);
fightPlayer.ifPlayer(player -> FightSystem.getTechHider().reloadChunks(player, chunksToReload, false)); fightPlayer.ifPlayer(player -> FightSystem.getTechHider().reloadChunks(player, chunksToReload, false));

Datei anzeigen

@ -51,7 +51,7 @@ public class EnterHandler implements IStateDependent {
private void registerTeam(FightTeam team){ private void registerTeam(FightTeam team){
for(FightPlayer fp : team.getPlayers()){ for(FightPlayer fp : team.getPlayers()){
fp.startEnternCountdown(); fp.startEnternCountdown(null);
} }
} }