diff options
Diffstat (limited to 'EssentialsChat/src/com')
-rw-r--r-- | EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java | 7 | ||||
-rw-r--r-- | EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatWorker.java | 15 |
2 files changed, 10 insertions, 12 deletions
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java index e351cc865..890187ee3 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java @@ -2,7 +2,10 @@ package com.earth2me.essentials.chat; import com.earth2me.essentials.Essentials; import org.bukkit.Server; -import org.bukkit.event.player.*; +import org.bukkit.event.player.PlayerChatEvent; +import org.bukkit.event.player.PlayerEvent; +import org.bukkit.event.player.PlayerListener; +import org.bukkit.event.player.PlayerRespawnEvent; public class EssentialsChatPlayerListener extends PlayerListener @@ -16,7 +19,7 @@ public class EssentialsChatPlayerListener extends PlayerListener @Override @SuppressWarnings("CallToThreadDumpStack") - public void onPlayerJoin(PlayerJoinEvent event) + public void onPlayerJoin(PlayerEvent event) { try { diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatWorker.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatWorker.java index e11504259..09a27f18f 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatWorker.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatWorker.java @@ -52,20 +52,15 @@ public class EssentialsChatWorker public static void onPlayerChat(Server server, PlayerChatEvent event) { + if (event.isCancelled()) return; User user = User.get(event.getPlayer()); updateDisplayName(user); if (user.isAuthorized("essentials.chat.color")) event.setMessage(event.getMessage().replaceAll("&([0-9a-f])", "§$1")); - - event.setFormat(Essentials.getSettings().getChatFormat(user.getGroup()) - .replace('&', '§') - .replace("§§", "&") - .replace("{DISPLAYNAME}", "%1$s") - .replace("{GROUP}", user.getGroup()) - .replace("{MESSAGE}", "%2$s") - .replace("{WORLDNAME}", user.getWorld().getName())); - + + event.setFormat(Essentials.getSettings().getChatFormat(user.getGroup()).replace('&', '§').replace("§§", "&").replace("{DISPLAYNAME}", "%1$s").replace("{GROUP}", user.getGroup()).replace("{MESSAGE}", "%2$s").replace("{WORLDNAME}", user.getWorld().getName())); + int radius = Essentials.getSettings().getChatRadius(); if (radius < 1) return; @@ -81,7 +76,7 @@ public class EssentialsChatWorker event.setCancelled(true); return; } - + if (event.getMessage().startsWith("?") && event.getMessage().length() > 1) { if (user.isAuthorized("essentials.chat.question")) |