DecentSoftware-eu / DecentHolograms

A lightweight but powerful hologram plugin with many features and configuration options.
https://www.spigotmc.org/resources/96927/
GNU General Public License v3.0
211 stars 101 forks source link

fixed issue #127 #128

Closed aarushbhutra closed 1 year ago

aarushbhutra commented 1 year ago

This pull request addresses issue #127 by fixing the ConcurrentModificationException in the HologramManager class. The problem was caused by attempting to modify a collection while iterating through it in the hideAll method. To resolve the issue, I modified the hideAll method by creating a copy of the hologram collection and the temporaryLines set. Then, I iterated through the copies to safely hide the holograms and lines without modifying the original collections.

d0by1 commented 1 year ago

Hello, thanks for the PR. I looked into the problem myself and your solution would probably solve it but I found a better solution.

The issue was in synchronization, there were multiple threads accessing the same HashSet, resulting in the ConcurrentModificationException. I decided to use ConcurrentHashMap.newKeySet(), instead of the normal HashSet, because this one is actually thread-safe by design.

Anyhow, thanks for the PR, but it won't be necessary, I will now close this.