From 6b6ab711e5d818ea05ec5a4892c993dd83f0cc33 Mon Sep 17 00:00:00 2001 From: tastybento Date: Thu, 11 Nov 2021 15:36:49 -0800 Subject: [PATCH] Fixes console teleporting. https://github.com/BentoBoxWorld/BentoBox/issues/1877 --- .../commands/admin/AdminTeleportCommand.java | 6 +++--- .../admin/AdminTeleportCommandTest.java | 19 ------------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/api/commands/admin/AdminTeleportCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/admin/AdminTeleportCommand.java index abdeffe81..bb98b9ab4 100644 --- a/src/main/java/world/bentobox/bentobox/api/commands/admin/AdminTeleportCommand.java +++ b/src/main/java/world/bentobox/bentobox/api/commands/admin/AdminTeleportCommand.java @@ -100,10 +100,9 @@ public boolean execute(User user, String label, List args) { // 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 boolean execute(User user, String label, List args) { .entity(player) .location(warpSpot) .failureMessage(failureMessage) + .thenRun(() -> user.sendMessage("general.success")) .build(); return true; } diff --git a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminTeleportCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminTeleportCommandTest.java index 71960c644..9d692be09 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminTeleportCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/admin/AdminTeleportCommandTest.java @@ -283,24 +283,5 @@ public void testExecuteUserStringListOfStringKnownTargetHasIslandEnd() { verify(user).getTranslation(eq("commands.admin.tp.manual"), eq("[location]"), eq("0 0 0")); } - - - - - - - - - - - - - - - - - - - }