summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandmsg.java33
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java11
2 files changed, 24 insertions, 20 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java
index 34754ec9c..63bce435a 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java
@@ -4,6 +4,7 @@ import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IReplyTo;
import com.earth2me.essentials.User;
+import com.earth2me.essentials.Util;
import java.util.List;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -34,11 +35,11 @@ public class Commandmsg extends EssentialsCommand
}
}
- String message = getFinalArg(args, 1);
- String translatedMe = _("me");
+ final String message = Util.stripColor(getFinalArg(args, 1));
+ final String translatedMe = _("me");
- IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo();
- String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
+ final IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo();
+ final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
if (args[0].equalsIgnoreCase(Console.NAME))
{
@@ -50,38 +51,38 @@ public class Commandmsg extends EssentialsCommand
return;
}
- List<Player> matches = server.matchPlayer(args[0]);
+ final List<Player> matchedPlayers = server.matchPlayer(args[0]);
- if (matches.isEmpty())
+ if (matchedPlayers.isEmpty())
{
throw new Exception(_("playerNotFound"));
}
int i = 0;
- for (Player p : matches)
+ for (Player matchedPlayer : matchedPlayers)
{
- final User u = ess.getUser(p);
+ final User u = ess.getUser(matchedPlayer);
if (u.isHidden())
{
i++;
}
}
- if (i == matches.size())
+ if (i == matchedPlayers.size())
{
throw new Exception(_("playerNotFound"));
}
- for (Player p : matches)
+ for (Player matchedPlayer : matchedPlayers)
{
- sender.sendMessage(_("msgFormat", translatedMe, p.getDisplayName(), message));
- final User u = ess.getUser(p);
- if (sender instanceof Player && (u.isIgnoredPlayer(((Player)sender).getName()) || u.isHidden()))
+ sender.sendMessage(_("msgFormat", translatedMe, matchedPlayer.getDisplayName(), message));
+ final User matchedUser = ess.getUser(matchedPlayer);
+ if (sender instanceof Player && (matchedUser.isIgnoredPlayer(((Player)sender).getName()) || matchedUser.isHidden()))
{
continue;
}
- p.sendMessage(_("msgFormat", senderName, translatedMe, message));
- replyTo.setReplyTo(ess.getUser(p));
- ess.getUser(p).setReplyTo(sender);
+ matchedPlayer.sendMessage(_("msgFormat", senderName, translatedMe, message));
+ replyTo.setReplyTo(ess.getUser(matchedPlayer));
+ ess.getUser(matchedPlayer).setReplyTo(sender);
}
}
}
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
index 2d6e1ae4e..432e2309c 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
@@ -112,7 +112,7 @@ public abstract class EssentialsChatPlayer extends PlayerListener
logger.info(_("localFormat", sender.getName(), event.getMessage()));
final Location loc = sender.getLocation();
final World world = loc.getWorld();
-
+
for (Player onlinePlayer : server.getOnlinePlayers())
{
String type = "[L]";
@@ -123,11 +123,14 @@ public abstract class EssentialsChatPlayer extends PlayerListener
continue;
}
if (!user.equals(sender))
- {
+ {
final Location playerLoc = user.getLocation();
- if (playerLoc.getWorld() != world) { continue; }
+ if (playerLoc.getWorld() != world)
+ {
+ continue;
+ }
final double delta = playerLoc.distanceSquared(loc);
-
+
if (delta > radius)
{
if (user.isAuthorized("essentials.chat.spy"))