summaryrefslogtreecommitdiffstats
path: root/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
diff options
context:
space:
mode:
authorokamosy <okamosy@gmail.com>2011-10-30 21:29:56 +0000
committerokamosy <okamosy@gmail.com>2011-10-30 21:29:56 +0000
commitffd7ba7d5f2312ea9fc1c818b39938e5d7de86b6 (patch)
tree61df1aeaff88cad86300025ba9fc334d44fd2dc3 /EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
parent7f825750f076e570ffaeecc7de6cb26f202e84ca (diff)
downloadEssentials-ffd7ba7d5f2312ea9fc1c818b39938e5d7de86b6.tar
Essentials-ffd7ba7d5f2312ea9fc1c818b39938e5d7de86b6.tar.gz
Essentials-ffd7ba7d5f2312ea9fc1c818b39938e5d7de86b6.tar.lz
Essentials-ffd7ba7d5f2312ea9fc1c818b39938e5d7de86b6.tar.xz
Essentials-ffd7ba7d5f2312ea9fc1c818b39938e5d7de86b6.zip
EssChat update part 1.
Diffstat (limited to 'EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java')
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
new file mode 100644
index 000000000..a7ade803b
--- /dev/null
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java
@@ -0,0 +1,38 @@
+package com.earth2me.essentials.chat;
+
+import com.earth2me.essentials.ChargeException;
+import com.earth2me.essentials.IEssentials;
+import com.earth2me.essentials.User;
+import com.earth2me.essentials.Util;
+import java.util.Map;
+import org.bukkit.Server;
+import org.bukkit.event.player.PlayerChatEvent;
+
+
+public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer
+{
+ public EssentialsChatPlayerListenerLowest(Server server, IEssentials ess, Map<String, IEssentialsChatListener> listeners)
+ {
+ super(server, ess, listeners);
+ }
+
+ @Override
+ public void onPlayerChat(final PlayerChatEvent event)
+ {
+ if (isAborted(event))
+ {
+ return;
+ }
+
+ /**
+ * This listener should apply the general chat formatting only...then return control back
+ * the event handler
+ */
+ final User user = ess.getUser(event.getPlayer());
+ if (user.isAuthorized("essentials.chat.color"))
+ {
+ event.setMessage(event.getMessage().replaceAll("&([0-9a-f])", "\u00a7$1"));
+ }
+ 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()));
+ }
+}