Skip to content

Commit

Permalink
Merge pull request #67 from rchomczyk/fix-concurrent-issue-with-add-v…
Browse files Browse the repository at this point in the history
…iewers

Fix concurrent exception with Sidebar#addViewers
  • Loading branch information
CatCoderr committed Jan 7, 2024
2 parents 19e9ac3 + 3e4bc05 commit 791965d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/me/catcoder/sidebar/Sidebar.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,15 @@ public void addViewer(@NonNull Player player) {
if (!viewers.contains(player.getUniqueId())) {
objective.create(player);

for (SidebarLine<R> line : lines) {
line.createTeam(player, objective.getName());
synchronized (lines) {
for (SidebarLine<R> line : lines) {
line.createTeam(player, objective.getName());
}
}

objective.display(player);

viewers.add(player.getUniqueId());

}
}

Expand Down

0 comments on commit 791965d

Please sign in to comment.