Skip to content

Commit

Permalink
Prevent team balance broadcast when disabled (#985)
Browse files Browse the repository at this point in the history
Signed-off-by: applenick <[email protected]>
  • Loading branch information
applenick authored Apr 15, 2022
1 parent c2e2388 commit eda3f16
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/src/main/java/tc/oc/pgm/start/StartCountdown.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.kyori.adventure.bossbar.BossBar;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import tc.oc.pgm.api.PGM;
import tc.oc.pgm.api.match.Match;
import tc.oc.pgm.teams.Team;
import tc.oc.pgm.teams.TeamMatchModule;
Expand Down Expand Up @@ -73,7 +74,9 @@ public void onTick(Duration remaining, Duration total) {
for (Team team : this.tmm.getParticipatingTeams()) {
if (team.isStacked()) {
this.balanceWarningSent = true;
getMatch().sendWarning(translatable("match.balanceTeams", team.getName()));
if (isBalanceBroadcasted()) {
getMatch().sendWarning(translatable("match.balanceTeams", team.getName()));
}
}
}

Expand All @@ -99,4 +102,8 @@ public void onEnd(Duration total) {
public boolean isForced() {
return forced;
}

private boolean isBalanceBroadcasted() {
return PGM.get().getConfiguration().shouldBalanceJoin();
}
}

0 comments on commit eda3f16

Please sign in to comment.