Skip to content

Commit

Permalink
Scoreboard now is resynchronized on a timer to accommodate
Browse files Browse the repository at this point in the history
team.incrementPoints().
  • Loading branch information
redwallhp committed Nov 13, 2016
1 parent 39eac1a commit b31896f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>io.github.redwallhp</groupId>
<artifactId>AthenaGM</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>


<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,22 @@ public void onPlayerScorePointEvent(PlayerScorePointEvent event) {
@EventHandler
public void onMatchTimerTickEvent(MatchTimerTickEvent event) {
updateMatchTimeDisplay(event.getMatchTimer().getMatch(), event.getMatchTimer().timeLeftInSeconds());
syncScores(event.getMatchTimer().getMatch());
}


/**
* Update the scoreboard once every second, to account for team.incrementPoints()
*/
private void syncScores(Match match) {
Score score;
Objective objective = boards.get(match).getObjective("matchscore");
for (Team team : match.getTeams().values()) {
if (!team.isSpectator()) {
score = objective.getScore(team.getChatColor() + team.getName());
score.setScore(team.getPoints());
}
}
}


Expand Down

0 comments on commit b31896f

Please sign in to comment.