Skip to content

Commit

Permalink
Fix concurrent exception with Sidebar#addViewers
Browse files Browse the repository at this point in the history
  • Loading branch information
rchomczyk committed Dec 25, 2023
1 parent 19e9ac3 commit 3e4bc05
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 3e4bc05

Please sign in to comment.