From f508f9de1542f566c14d60063c801b5124fdad86 Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Mon, 15 Jul 2024 22:29:07 -0500 Subject: [PATCH] Fix highest stat condition ending game prematurely --- .../arena/competition/victory/VictoryCondition.java | 2 ++ .../arena/competition/victory/types/HighestStatCondition.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/org/battleplugins/arena/competition/victory/VictoryCondition.java b/plugin/src/main/java/org/battleplugins/arena/competition/victory/VictoryCondition.java index b7cf00bb..c7d20d27 100644 --- a/plugin/src/main/java/org/battleplugins/arena/competition/victory/VictoryCondition.java +++ b/plugin/src/main/java/org/battleplugins/arena/competition/victory/VictoryCondition.java @@ -58,6 +58,8 @@ public final void advanceToNextPhase(Set victors) { CompetitionPhase currentPhase = this.competition.getPhaseManager().getCurrentPhase(); CompetitionPhaseType> nextPhase = currentPhase.getNextPhase(); + this.competition.getArena().getPlugin().debug("Condition {} advancing to next phase: {}", this.getClass().getSimpleName(), nextPhase == null ? "NONE" : nextPhase.getName()); + // Ensure the next phase is a victory phase if (!CompetitionPhaseType.VICTORY.equals(nextPhase)) { this.competition.getArena().getPlugin().warn("Victory conditions for {} were met, but the next phase was not a victory phase. Not advancing onto the next phase!", this.getClass().getSimpleName()); diff --git a/plugin/src/main/java/org/battleplugins/arena/competition/victory/types/HighestStatCondition.java b/plugin/src/main/java/org/battleplugins/arena/competition/victory/types/HighestStatCondition.java index ffe1c6f5..03bec3fc 100644 --- a/plugin/src/main/java/org/battleplugins/arena/competition/victory/types/HighestStatCondition.java +++ b/plugin/src/main/java/org/battleplugins/arena/competition/victory/types/HighestStatCondition.java @@ -62,7 +62,7 @@ public void onStatChange(ArenaStatChangeEvent event) { score += teamPlayer.stat(this.stat).orElse(0).intValue(); } - if (score >= this.winAfter) { + if (this.winAfter != -1 && score >= this.winAfter) { this.advanceToNextPhase(players); } }