1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-11 09:05:01 +02:00

Make chat handling more thread safe (and also faster)

This commit is contained in:
snowleo
2012-08-03 22:57:29 +02:00
parent 5b3993b190
commit 9bc6ece81e
4 changed files with 132 additions and 45 deletions

View File

@@ -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)
}));
}
}
}