diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java index 8ca16fbbb..9dce1169c 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java @@ -44,11 +44,14 @@ public abstract class EssentialsChatPlayer implements Listener { return true; } - for (IEssentialsChatListener listener : listeners.values()) + synchronized (listeners) { - if (listener.shouldHandleThisChat(event)) + for (IEssentialsChatListener listener : listeners.values()) { - return true; + if (listener.shouldHandleThisChat(event)) + { + return true; + } } } return false; @@ -155,9 +158,12 @@ public abstract class EssentialsChatPlayer implements Listener } String message = String.format(event.getFormat(), type.concat(sender.getDisplayName()), event.getMessage()); - for (IEssentialsChatListener listener : listeners.values()) + synchronized (listeners) { - message = listener.modifyMessage(event, onlinePlayer, message); + for (IEssentialsChatListener listener : listeners.values()) + { + message = listener.modifyMessage(event, onlinePlayer, message); + } } onlineUser.sendMessage(message); }