More thread safety

This commit is contained in:
snowleo 2012-08-04 11:10:57 +02:00
parent bf93bb2026
commit 5379b3955f

View File

@ -44,6 +44,8 @@ public abstract class EssentialsChatPlayer implements Listener
{
return true;
}
synchronized (listeners)
{
for (IEssentialsChatListener listener : listeners.values())
{
if (listener.shouldHandleThisChat(event))
@ -51,6 +53,7 @@ public abstract class EssentialsChatPlayer implements Listener
return true;
}
}
}
return false;
}
@ -155,10 +158,13 @@ public abstract class EssentialsChatPlayer implements Listener
}
String message = String.format(event.getFormat(), type.concat(sender.getDisplayName()), event.getMessage());
synchronized (listeners)
{
for (IEssentialsChatListener listener : listeners.values())
{
message = listener.modifyMessage(event, onlinePlayer, message);
}
}
onlineUser.sendMessage(message);
}
}