summaryrefslogtreecommitdiffstats
path: root/EssentialsChat/src/com/earth2me/essentials
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2012-08-04 11:10:57 +0200
committersnowleo <schneeleo@gmail.com>2012-08-04 11:10:57 +0200
commit5379b3955f46b4551a4054930c8b79ce499b41c2 (patch)
tree82d408df507b2c7f01120d11a8c98e6209ecb490 /EssentialsChat/src/com/earth2me/essentials
parentbf93bb2026e1d3474be88759e72b144e218387db (diff)
downloadEssentials-5379b3955f46b4551a4054930c8b79ce499b41c2.tar
Essentials-5379b3955f46b4551a4054930c8b79ce499b41c2.tar.gz
Essentials-5379b3955f46b4551a4054930c8b79ce499b41c2.tar.lz
Essentials-5379b3955f46b4551a4054930c8b79ce499b41c2.tar.xz
Essentials-5379b3955f46b4551a4054930c8b79ce499b41c2.zip
More thread safety
Diffstat (limited to 'EssentialsChat/src/com/earth2me/essentials')
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java16
1 files changed, 11 insertions, 5 deletions
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);
}