Fixed a concurrent modification exception in event dispatch

This commit is contained in:
Ceikry
2023-02-09 06:55:01 +00:00
committed by Ryan
parent 97c7e7e3d4
commit 8dadaa5089
@@ -162,7 +162,8 @@ public abstract class Entity extends Node {
{ {
if(this.hooks.containsKey(event.getClass())) if(this.hooks.containsKey(event.getClass()))
{ {
this.hooks.get(event.getClass()).forEach((hook) -> { hook.process(this, event); }); ArrayList<EventHook> processList = new ArrayList(this.hooks.get(event.getClass()));
processList.forEach((hook) -> { hook.process(this, event); });
} }
} }