Skip to content

Commit

Permalink
Fix highest stat condition ending game prematurely
Browse files Browse the repository at this point in the history
  • Loading branch information
Redned235 committed Jul 16, 2024
1 parent bf86774 commit f508f9d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public final void advanceToNextPhase(Set<ArenaPlayer> victors) {
CompetitionPhase<T> currentPhase = this.competition.getPhaseManager().getCurrentPhase();
CompetitionPhaseType<T, CompetitionPhase<T>> 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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void onStatChange(ArenaStatChangeEvent<Number> event) {
score += teamPlayer.stat(this.stat).orElse(0).intValue();
}

if (score >= this.winAfter) {
if (this.winAfter != -1 && score >= this.winAfter) {
this.advanceToNextPhase(players);
}
}
Expand Down

0 comments on commit f508f9d

Please sign in to comment.