LOOHP / ImageFrame

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

Fix hash collisions producing thread checks on Folia #55

Closed TechnicallyCoded closed 5 months ago

TechnicallyCoded commented 6 months 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 6 months 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 6 months ago

Yes, sounds correct. Will need updating.