summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-06-16 16:22:51 +0100
committerKHobbits <rob@khobbits.co.uk>2012-06-16 16:22:51 +0100
commit97eada7dd6ee2bb80babf25834101baa5bbc9a7b (patch)
treed89ac2d71b69e752ce85068649a10e55d7eb2873
parenta764f8c929a8bf58c5a8d0fac6659b5ddbc554af (diff)
downloadEssentials-97eada7dd6ee2bb80babf25834101baa5bbc9a7b.tar
Essentials-97eada7dd6ee2bb80babf25834101baa5bbc9a7b.tar.gz
Essentials-97eada7dd6ee2bb80babf25834101baa5bbc9a7b.tar.lz
Essentials-97eada7dd6ee2bb80babf25834101baa5bbc9a7b.tar.xz
Essentials-97eada7dd6ee2bb80babf25834101baa5bbc9a7b.zip
Players should not be able to ignore Console
Also implement chat exempt permission in other commands.
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/UserData.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandignore.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandmail.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandmsg.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandr.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpa.java2
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java38
9 files changed, 34 insertions, 33 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 6f97a23d7..8790e7022 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -557,7 +557,7 @@ public class Essentials extends JavaPlugin implements IEssentials
for (Player player : players)
{
final User user = getUser(player);
- if (!user.isIgnoredPlayer(sender.getName()))
+ if (!user.isIgnoredPlayer(sender))
{
player.sendMessage(message);
}
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index 8a0347cb8..422b63086 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -63,7 +63,7 @@ public class EssentialsPlayerListener implements Listener
while (it.hasNext())
{
final User u = ess.getUser(it.next());
- if (u.isIgnoredPlayer(user.getName()))
+ if (u.isIgnoredPlayer(user))
{
it.remove();
}
diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java
index 97fa02a2b..e48ec7b50 100644
--- a/Essentials/src/com/earth2me/essentials/UserData.java
+++ b/Essentials/src/com/earth2me/essentials/UserData.java
@@ -458,20 +458,20 @@ public abstract class UserData extends PlayerExtension implements IConf
config.save();
}
- public boolean isIgnoredPlayer(String name)
+ public boolean isIgnoredPlayer(IUser user)
{
- return ignoredPlayers.contains(name.toLowerCase(Locale.ENGLISH));
+ return (ignoredPlayers.contains(user.getName().toLowerCase(Locale.ENGLISH)) && !user.isAuthorized("essentials.chat.ignoreexempt"));
}
- public void setIgnoredPlayer(String name, boolean set)
+ public void setIgnoredPlayer(IUser user, boolean set)
{
if (set)
{
- ignoredPlayers.add(name.toLowerCase(Locale.ENGLISH));
+ ignoredPlayers.add(user.getName().toLowerCase(Locale.ENGLISH));
}
else
{
- ignoredPlayers.remove(name.toLowerCase(Locale.ENGLISH));
+ ignoredPlayers.remove(user.getName().toLowerCase(Locale.ENGLISH));
}
setIgnoredPlayers(ignoredPlayers);
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandignore.java b/Essentials/src/com/earth2me/essentials/commands/Commandignore.java
index 93dd029a8..8f160e9ba 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandignore.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandignore.java
@@ -32,15 +32,14 @@ public class Commandignore extends EssentialsCommand
{
throw new Exception(_("playerNotFound"));
}
- final String name = player.getName();
- if (user.isIgnoredPlayer(name))
+ if (user.isIgnoredPlayer(player))
{
- user.setIgnoredPlayer(name, false);
+ user.setIgnoredPlayer(player, false);
user.sendMessage(_("unignorePlayer", player.getName()));
}
else
{
- user.setIgnoredPlayer(name, true);
+ user.setIgnoredPlayer(player, true);
user.sendMessage(_("ignorePlayer", player.getName()));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java
index 7a2dad1b1..60306c272 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java
@@ -56,7 +56,7 @@ public class Commandmail extends EssentialsCommand
{
throw new Exception(_("playerNeverOnServer", args[1]));
}
- if (!u.isIgnoredPlayer(user.getName()))
+ if (!u.isIgnoredPlayer(user))
{
final String mail = Util.sanitizeString(Util.stripFormat(getFinalArg(args, 2)));
u.addMail(user.getName() + ": " + mail);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java
index 2b7be976e..fe39a1c04 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java
@@ -81,7 +81,7 @@ public class Commandmsg extends EssentialsCommand
{
sender.sendMessage(_("msgFormat", translatedMe, matchedPlayer.getDisplayName(), message));
final User matchedUser = ess.getUser(matchedPlayer);
- if (sender instanceof Player && (matchedUser.isIgnoredPlayer(((Player)sender).getName()) || matchedUser.isHidden()))
+ if (sender instanceof Player && (matchedUser.isIgnoredPlayer(ess.getUser(sender)) || matchedUser.isHidden()))
{
continue;
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandr.java b/Essentials/src/com/earth2me/essentials/commands/Commandr.java
index 9b585509d..d2dfeb78b 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandr.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandr.java
@@ -55,7 +55,7 @@ public class Commandr extends EssentialsCommand
if (target instanceof Player)
{
User player = ess.getUser(target);
- if (player.isIgnoredPlayer(sender instanceof Player ? ((Player)sender).getName() : Console.NAME))
+ if (sender instanceof Player && player.isIgnoredPlayer(ess.getUser(sender)))
{
return;
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
index 95cbc58cd..d94f0aca5 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
@@ -30,7 +30,7 @@ public class Commandtpa extends EssentialsCommand
{
throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName()));
}
- if (!player.isIgnoredPlayer(user.getName()))
+ if (!player.isIgnoredPlayer(user))
{
player.requestTeleport(user, false);
player.sendMessage(_("teleportRequest", user.getDisplayName()));
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
index c65eb5a0e..58b094793 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
@@ -63,7 +63,7 @@ public abstract class EssentialsChatPlayer implements Listener
case '?':
return "question";
//case '@':
- //return "admin";
+ //return "admin";
default:
return "";
}
@@ -121,32 +121,34 @@ public abstract class EssentialsChatPlayer implements Listener
{
String type = _("chatTypeLocal");
final User onlineUser = ess.getUser(onlinePlayer);
- if (onlineUser.isIgnoredPlayer(sender.getName()) && !sender.isAuthorized("essentials.chat.ignoreexempt"))
+ if (onlineUser.isIgnoredPlayer(sender))
{
continue;
}
if (!onlineUser.equals(sender))
{
- boolean abort = false;
- final Location playerLoc = onlineUser.getLocation();
- if (playerLoc.getWorld() != world)
+ boolean abort = false;
+ final Location playerLoc = onlineUser.getLocation();
+ if (playerLoc.getWorld() != world)
+ {
+ abort = true;
+ }
+ final double delta = playerLoc.distanceSquared(loc);
+ if (delta > chatStore.getRadius())
+ {
+ abort = true;
+ }
+ if (abort)
+ {
+ if (onlineUser.isAuthorized("essentials.chat.spy"))
{
- abort = true;
+ type = type.concat(_("chatTypeSpy"));
}
- final double delta = playerLoc.distanceSquared(loc);
- if (delta > chatStore.getRadius())
+ else
{
- abort = true;
+ continue;
}
- if (abort) {
- if (onlineUser.isAuthorized("essentials.chat.spy"))
- {
- type = type.concat(_("chatTypeSpy"));
- }
- else
- {
- continue;
- }
+ }
}
String message = String.format(event.getFormat(), type.concat(sender.getDisplayName()), event.getMessage());