Skip to content

Commit

Permalink
restore auto-end of box trips, lost in merge
Browse files Browse the repository at this point in the history
  • Loading branch information
katpet committed Nov 27, 2023
1 parent 8d98071 commit b3f4651
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/com/carolinarollergirls/scoreboard/core/game/GameImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,22 @@ && getClock(Clock.ID_PERIOD).isRunning()) {
}
}));

// handle auto-end box trips when penalty box clocks finish
for (Team t : getAll(TEAM)) {
for (BoxSeat bs : t.getAll(Team.BOX_SEAT)) {
addScoreBoardListener(new ConditionalScoreBoardListener<>(Clock.class, bs.getBoxClock().getId(),
Clock.RUNNING, Boolean.FALSE, new ScoreBoardListener() {
@Override
public void scoreBoardChange(ScoreBoardEvent<?> event) {
Clock pc = bs.getBoxClock();
if (pc.isTimeAtEnd()) {
bs.endBox();
}
}
}));
}
}

// handle changes to the ruleset (if following a preset ruleset)
scoreBoard.getRulesets().addScoreBoardListener(
new ConditionalScoreBoardListener<>(Ruleset.class, Ruleset.RULE, new ScoreBoardListener() {
Expand Down

0 comments on commit b3f4651

Please sign in to comment.