summaryrefslogtreecommitdiffstats
path: root/EssentialsChat/src/com
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2012-01-16 20:29:55 +0100
committersnowleo <schneeleo@gmail.com>2012-01-16 20:29:55 +0100
commit26d63f36668cd111706f6406f0d10f8d08197020 (patch)
treeb64d14e07d215b9cbd2ac2d506ad1d1fb0d0a51b /EssentialsChat/src/com
parent0fb07d4cc16f541989a5a9860aa36b7f6bf7389b (diff)
downloadEssentials-26d63f36668cd111706f6406f0d10f8d08197020.tar
Essentials-26d63f36668cd111706f6406f0d10f8d08197020.tar.gz
Essentials-26d63f36668cd111706f6406f0d10f8d08197020.tar.lz
Essentials-26d63f36668cd111706f6406f0d10f8d08197020.tar.xz
Essentials-26d63f36668cd111706f6406f0d10f8d08197020.zip
Strip colors from chat, if the user does not have the permission.
Diffstat (limited to 'EssentialsChat/src/com')
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
index de5757951..82241a1f5 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
@@ -2,6 +2,7 @@ package com.earth2me.essentials.chat;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
+import com.earth2me.essentials.Util;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Server;
@@ -32,6 +33,8 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer
if (user.isAuthorized("essentials.chat.color"))
{
event.setMessage(event.getMessage().replaceAll("&([0-9a-f])", "\u00a7$1"));
+ } else {
+ event.setMessage(Util.stripColor(event.getMessage()));
}
event.setFormat(ess.getSettings().getChatFormat(user.getGroup()).replace('&', '\u00a7').replace("\u00a7\u00a7", "&").replace("{DISPLAYNAME}", "%1$s").replace("{GROUP}", user.getGroup()).replace("{MESSAGE}", "%2$s").replace("{WORLDNAME}", user.getWorld().getName()).replace("{SHORTWORLDNAME}", user.getWorld().getName().substring(0, 1).toUpperCase(Locale.ENGLISH)));
}