From c39972e4357c28cce4549a1930f322f61c547ba9 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 27 Dec 2021 18:52:42 +0100 Subject: [PATCH] Fix replay server termination Signed-off-by: Lixfel --- .../src/de/steamwar/fightsystem/ArenaMode.java | 2 +- .../fightsystem/countdown/EventSpectateCountdown.java | 2 +- .../de/steamwar/fightsystem/record/PacketProcessor.java | 7 +------ .../fightsystem/states/StateDependentCountdown.java | 6 +++++- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/ArenaMode.java b/FightSystem_Core/src/de/steamwar/fightsystem/ArenaMode.java index fff8a95..b48cc55 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/ArenaMode.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/ArenaMode.java @@ -43,13 +43,13 @@ public enum ArenaMode { public static final Set Replay = Collections.unmodifiableSet(EnumSet.of(REPLAY)); public static final Set AntiReplay = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(REPLAY))); - public static final Set Replayable = Collections.unmodifiableSet(EnumSet.of(REPLAY, TEST)); public static final Set AntiTest = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK))); public static final Set AntiEvent = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(EVENT))); public static final Set AntiPrepare = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(PREPARE))); public static final Set VariableTeams = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(RANKED, EVENT, REPLAY))); public static final Set RankedEvent = Collections.unmodifiableSet(EnumSet.of(RANKED, EVENT, REPLAY)); public static final Set Restartable = Collections.unmodifiableSet(EnumSet.of(NORMAL, RANKED, REPLAY)); + public static final Set NotRestartable = Collections.unmodifiableSet(EnumSet.of(EVENT, REPLAY)); public static final Set SoloLeader = Collections.unmodifiableSet(EnumSet.of(TEST, CHECK, PREPARE)); public static final Set NotOnBau = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK, PREPARE, REPLAY))); public static final Set SeriousFight = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK, REPLAY))); diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/countdown/EventSpectateCountdown.java b/FightSystem_Core/src/de/steamwar/fightsystem/countdown/EventSpectateCountdown.java index 03342fc..e877239 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/countdown/EventSpectateCountdown.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/countdown/EventSpectateCountdown.java @@ -31,7 +31,7 @@ public class EventSpectateCountdown extends Countdown { public EventSpectateCountdown() { super(Config.SpectatorDuration, new Message("SHUTDOWN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false); - new StateDependentCountdown(ArenaMode.Event, FightState.Spectate, this); + new StateDependentCountdown(ArenaMode.NotRestartable.contains(Config.mode) && !Config.replayserver(), FightState.Spectate, this); } @Override diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java b/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java index 73be48d..0914c2e 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java @@ -142,12 +142,7 @@ public class PacketProcessor { else if(team == 0x02) winner = Fight.getRedTeam(); - if(Config.replayserver() || ArenaMode.AntiReplay.contains(Config.mode)) { - FightSystem.setSpectateState(winner, "Replay ends", message.getMsg(), message.getParams()); - }else{ - FightUI.printWin(winner, message.getMsg(), message.getParams()); - new EventSpectateCountdown().enable(); - } + FightSystem.setSpectateState(winner, "Replay ends", message.getMsg(), message.getParams()); }); } diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/states/StateDependentCountdown.java b/FightSystem_Core/src/de/steamwar/fightsystem/states/StateDependentCountdown.java index d955e5e..4bdbc09 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/states/StateDependentCountdown.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/states/StateDependentCountdown.java @@ -43,7 +43,11 @@ public class StateDependentCountdown extends StateDependent { } public StateDependentCountdown(Winconditions wincondition, Set states, Countdown countdown) { - super(Config.ActiveWinconditions.contains(wincondition), states); + this(Config.ActiveWinconditions.contains(wincondition), states, countdown); + } + + public StateDependentCountdown(boolean active, Set states, Countdown countdown) { + super(active, states); this.countdown = countdown; register(); } -- 2.39.2