LOOHP / ImageFrame

Put images on maps and walls!
https://www.spigotmc.org/resources/106031/
GNU General Public License v3.0
40 stars 12 forks source link

Fix hash collisions producing thread checks on Folia #55

Closed TechnicallyCoded closed 3 weeks ago

TechnicallyCoded commented 1 month ago

There was an error where certain image frame IDs could cause ConcurrentHashMap bucket .equals() calls. This behavior under Folia tiggers checks for the thread that we should be on for this entity. This could obviously fail since it's async. This code should fix this, however, testing was not possible at the time of writing due to missing craftbukkit implementations.

Fixes #57

LOOHP commented 1 month ago

Currently, the class declares this map on the class level and looks like it is accessed off the entity thread. https://github.com/LOOHP/ImageFrame/blob/9b8efe229552763d9cde5b9bbbff5de49c2b9259/common/src/main/java/com/loohp/imageframe/objectholders/AnimatedFakeMapManager.java#L61 Wouldn't something need to also be done for this map if even equals check fails?

TechnicallyCoded commented 1 month ago

Yes, sounds correct. Will need updating.