From efef7bcc00b707d51fdb3d45e3070fa8fba1b67f Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 21 Jul 2018 12:47:46 +1000 Subject: [PATCH] Fixes ascend/descend bug --- .../worldedit/command/NavigationCommands.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java b/core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java index ca73d067..5b103331 100644 --- a/core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java +++ b/core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java @@ -81,9 +81,12 @@ public class NavigationCommands { ) @CommandPermissions("worldedit.navigation.ascend") public void ascend(Player player, @Optional("1") int levelsToAscend) throws WorldEditException { - int ascentLevels = 1; - while (player.ascendLevel() && levelsToAscend != ascentLevels) { + int ascentLevels = 0; + while (player.ascendLevel()) { ++ascentLevels; + if (levelsToAscend == ascentLevels) { + break; + } } if (ascentLevels == 0) { BBC.ASCEND_FAIL.send(player); @@ -105,9 +108,12 @@ public class NavigationCommands { ) @CommandPermissions("worldedit.navigation.descend") public void descend(Player player, @Optional("1") int levelsToDescend) throws WorldEditException { - int descentLevels = 1; - while (player.descendLevel() && levelsToDescend != descentLevels) { + int descentLevels = 0; + while (player.descendLevel()) { ++descentLevels; + if (levelsToDescend == descentLevels) { + break; + } } if (descentLevels == 0) { BBC.DESCEND_FAIL.send(player);