From 08041599fffe85ef4e5da59cc060a690c7dc8994 Mon Sep 17 00:00:00 2001 From: snowleo Date: Wed, 30 Mar 2011 12:56:34 +0000 Subject: Revert to 1013 git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1021 e251c2fe-e539-e718-e476-b85c1f46cddb --- .../essentials/chat/EssentialsChatPlayerListener.java | 7 +++++-- .../earth2me/essentials/chat/EssentialsChatWorker.java | 15 +++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'EssentialsChat') 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")) -- cgit v1.2.3