Skip to content

Commit

Permalink
Fix a possibility for double messages.
Browse files Browse the repository at this point in the history
In rare occasions a user can be a spectator as well as a player (however that happened)
  • Loading branch information
FireInstall committed Jan 24, 2024
1 parent b8eb683 commit bcd985a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,11 @@ private void sendBroadcastMessage(Minigame minigame, String message, MinigameMes
type = MinigameMessageType.INFO;
}
finalMessage += message;
final List<MinigamePlayer> sendto = new ArrayList<>();
final Set<MinigamePlayer> sendto = new HashSet<>();
sendto.addAll(minigame.getPlayers());
sendto.addAll(minigame.getSpectators());
if (exclude != null) {
sendto.removeAll(exclude);
exclude.forEach(sendto::remove);
}
for (final MinigamePlayer pl : sendto) {
pl.sendMessage(finalMessage, type);
Expand Down

1 comment on commit bcd985a

@FireInstall
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.