summaryrefslogtreecommitdiffstats
path: root/EssentialsChat/src/com
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
commitb4d850a7e31e152775ddb54abcee26b97103478f (patch)
treed73957baf1539dcfac5834da066cd28094938671 /EssentialsChat/src/com
parent050f80c52a1b57f29279f23d6636ab31cc266dda (diff)
downloadEssentials-b4d850a7e31e152775ddb54abcee26b97103478f.tar
Essentials-b4d850a7e31e152775ddb54abcee26b97103478f.tar.gz
Essentials-b4d850a7e31e152775ddb54abcee26b97103478f.tar.lz
Essentials-b4d850a7e31e152775ddb54abcee26b97103478f.tar.xz
Essentials-b4d850a7e31e152775ddb54abcee26b97103478f.zip
More thread safety
Diffstat (limited to 'EssentialsChat/src/com')
-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);
}