Fixes console teleporting.

https://github.com/BentoBoxWorld/BentoBox/issues/1877
This commit is contained in:
tastybento 2021-11-11 15:36:49 -08:00
parent f3a7ed1303
commit 6b6ab711e5
2 changed files with 3 additions and 22 deletions

View File

@ -100,10 +100,9 @@ public class AdminTeleportCommand extends CompositeCommand {
// Otherwise, ask the admin to go to a safe spot
String failureMessage = user.getTranslation("commands.admin.tp.manual", "[location]", warpSpot.getBlockX() + " " + warpSpot.getBlockY() + " "
+ warpSpot.getBlockZ());
Player player = user.getPlayer();
// Set the player
Player player = args.size() == 2 ? userToTeleport.getPlayer() : user.getPlayer();
if (args.size() == 2) {
player = userToTeleport.getPlayer();
failureMessage = userToTeleport.getTranslation(NOT_SAFE);
}
@ -112,6 +111,7 @@ public class AdminTeleportCommand extends CompositeCommand {
.entity(player)
.location(warpSpot)
.failureMessage(failureMessage)
.thenRun(() -> user.sendMessage("general.success"))
.build();
return true;
}

View File

@ -283,24 +283,5 @@ public class AdminTeleportCommandTest {
verify(user).getTranslation(eq("commands.admin.tp.manual"), eq("[location]"), eq("0 0 0"));
}
}