diff options
author | snowleo <schneeleo@gmail.com> | 2012-08-03 22:57:29 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2012-08-03 22:57:29 +0200 |
commit | 1a07815f4b535cc80c32579b010294eb4b49ecfc (patch) | |
tree | b1635b4cea89b0d490406342b2d320db92063abf /EssentialsChat/src/com | |
parent | 52702894af6b51f9f909bc73f58901e0f9e8c0b3 (diff) | |
download | Essentials-1a07815f4b535cc80c32579b010294eb4b49ecfc.tar Essentials-1a07815f4b535cc80c32579b010294eb4b49ecfc.tar.gz Essentials-1a07815f4b535cc80c32579b010294eb4b49ecfc.tar.lz Essentials-1a07815f4b535cc80c32579b010294eb4b49ecfc.tar.xz Essentials-1a07815f4b535cc80c32579b010294eb4b49ecfc.zip |
Make chat handling more thread safe (and also faster)
Diffstat (limited to 'EssentialsChat/src/com')
-rw-r--r-- | EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java index 599c39dda..79ff4994a 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.chat; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; +import java.text.MessageFormat; import java.util.Locale; import java.util.Map; import org.bukkit.Server; @@ -40,9 +41,13 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer event.setMessage(Util.formatMessage(user, "essentials.chat", event.getMessage())); String group = user.getGroup(); String world = user.getWorld().getName(); - event.setFormat(ess.getSettings().getChatFormat(group).format(new Object[] - { - group, world, world.substring(0, 1).toUpperCase(Locale.ENGLISH) - })); + MessageFormat format = ess.getSettings().getChatFormat(group); + synchronized (format) + { + event.setFormat(format.format(new Object[] + { + group, world, world.substring(0, 1).toUpperCase(Locale.ENGLISH) + })); + } } } |