Fix NPE when teleporting offline players (#4332)

This commit is contained in:
triagonal 2021-07-08 23:24:40 +10:00 committed by GitHub
parent cba5063b33
commit a098055fc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -25,7 +25,6 @@ public class Commandtp extends EssentialsCommand {
switch (args.length) {
case 0:
throw new NotEnoughArgumentsException();
case 1:
final User player = getPlayer(server, user, args, 0, false, true);
@ -33,8 +32,11 @@ public class Commandtp extends EssentialsCommand {
throw new Exception(tl("teleportDisabled", player.getDisplayName()));
}
if (!player.getBase().isOnline() && user.isAuthorized("essentials.tpoffline")) {
throw new Exception(tl("teleportOffline", player.getDisplayName()));
if (!player.getBase().isOnline()) {
if (user.isAuthorized("essentials.tpoffline")) {
throw new Exception(tl("teleportOffline", player.getDisplayName()));
}
throw new PlayerNotFoundException();
}
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + player.getWorld().getName())) {