mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 09:08:01 +01:00
Players should not be able to ignore Console
Also implement chat exempt permission in other commands.
This commit is contained in:
parent
a764f8c929
commit
97eada7dd6
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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()));
|
||||
|
@ -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;
|
||||
}
|
||||
final double delta = playerLoc.distanceSquared(loc);
|
||||
if (delta > chatStore.getRadius())
|
||||
{
|
||||
abort = true;
|
||||
}
|
||||
if (abort) {
|
||||
if (onlineUser.isAuthorized("essentials.chat.spy"))
|
||||
{
|
||||
type = type.concat(_("chatTypeSpy"));
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String message = String.format(event.getFormat(), type.concat(sender.getDisplayName()), event.getMessage());
|
||||
|
Loading…
Reference in New Issue
Block a user