vanished admins can't be teleported to

This commit is contained in:
Super_ 2020-06-29 10:01:37 -04:00
parent 220ddf1c1e
commit 18776a8f05
5 changed files with 16 additions and 0 deletions

View file

@ -30,6 +30,10 @@ public class Commandtp extends EssentialsCommand {
case 1:
final User player = getPlayer(server, user, args, 0, false, true);
if (getTFMHandler().isVanished(player) && !getTFMHandler().isAdmin(user)) {
throw new PlayerNotFoundException();
}
if (!player.isTeleportEnabled()) {
throw new Exception(tl("teleportDisabled", player.getDisplayName()));
}

View file

@ -29,6 +29,9 @@ public class Commandtpa extends EssentialsCommand {
if (user.getName().equalsIgnoreCase(player.getName())) {
throw new NotEnoughArgumentsException();
}
if (getTFMHandler().isVanished(player) && !getTFMHandler().isAdmin(user)) {
throw new PlayerNotFoundException();
}
if (!player.isAuthorized("essentials.tpaccept")) {
throw new Exception(tl("teleportNoAcceptPermission", player.getDisplayName()));
}

View file

@ -25,6 +25,9 @@ public class Commandtpahere extends EssentialsCommand {
if (user.getName().equalsIgnoreCase(player.getName())) {
throw new NotEnoughArgumentsException();
}
if (getTFMHandler().isVanished(player) && !getTFMHandler().isAdmin(user)) {
throw new PlayerNotFoundException();
}
if (!player.isTeleportEnabled()) {
throw new Exception(tl("teleportDisabled", player.getDisplayName()));
}

View file

@ -19,6 +19,9 @@ public class Commandtphere extends EssentialsCommand {
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
final User player = getPlayer(server, user, args, 0);
if (getTFMHandler().isVanished(player) && !getTFMHandler().isAdmin(user)) {
throw new PlayerNotFoundException();
}
if (!player.isTeleportEnabled()) {
throw new Exception(tl("teleportDisabled", player.getDisplayName()));
}

View file

@ -65,6 +65,9 @@ public class Commandtppos extends EssentialsCommand {
}
User user = getPlayer(server, args, 0, true, false);
if (getTFMHandler().isVanished(user) && !getTFMHandler().isAdmin(sender.getSender())) {
throw new PlayerNotFoundException();
}
final double x = args[1].startsWith("~") ? user.getLocation().getX() + (args[1].length() > 1 ? Integer.parseInt(args[1].substring(1)) : 0) : Integer.parseInt(args[1]);
final double y = args[2].startsWith("~") ? user.getLocation().getY() + (args[2].length() > 1 ? Integer.parseInt(args[2].substring(1)) : 0) : Integer.parseInt(args[2]);
final double z = args[3].startsWith("~") ? user.getLocation().getZ() + (args[3].length() > 1 ? Integer.parseInt(args[3].substring(1)) : 0) : Integer.parseInt(args[3]);