From 71d302c8932af0c5f201609c0da6b30b4cec8d7e Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Sun, 20 Nov 2011 01:45:25 +0100 Subject: [PATCH] Removed fix for issue #376, since the problem appears to have been fixed on the CraftBukkit side now. Also cleaned up the input handlers a bit. --- .../com/sk89q/worldedit/LocalSession.java | 18 +------ .../java/com/sk89q/worldedit/WorldEdit.java | 53 ++++++++++--------- 2 files changed, 28 insertions(+), 43 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/LocalSession.java b/src/main/java/com/sk89q/worldedit/LocalSession.java index 8e5e0c0db..9a2f05fd1 100644 --- a/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -75,7 +75,7 @@ public class LocalSession { private boolean fastMode = false; private Mask mask; private TimeZone timezone = TimeZone.getDefault(); - private Boolean jumptoBlock = true; + //private Boolean jumptoBlock = true; /** * Construct the object. @@ -684,20 +684,4 @@ public class LocalSession { public void setMask(Mask mask) { this.mask = mask; } - - /** - * This is used as a workaround for a bug. - * It blocks the compass from using the jumpto function after the thru function - */ - public void toggleJumptoBlock() { - this.jumptoBlock = !jumptoBlock; - } - - /** - * This is used as a workaround for a bug. - * @return true if the compass's jumpto function can be used again - */ - public Boolean canUseJumpto() { - return jumptoBlock; - } } diff --git a/src/main/java/com/sk89q/worldedit/WorldEdit.java b/src/main/java/com/sk89q/worldedit/WorldEdit.java index 8590c0afd..835b127b9 100644 --- a/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -1015,19 +1015,17 @@ public class WorldEdit { * @return */ public boolean handleArmSwing(LocalPlayer player) { - LocalSession session = getSession(player); - if (player.getItemInHand() == config.navigationWand - && config.navigationWandMaxDistance > 0 - && (player.hasPermission("worldedit.navigation.jumpto.tool") - || player.hasPermission("worldedit.navigation.jumpto"))) { // TODO: Remove old permission - // Bug workaround - // Blocks this from being used after the thru function - // @TODO do this right or make craftbukkit do it right - if (!session.canUseJumpto()){ - session.toggleJumptoBlock(); - return true; + if (player.getItemInHand() == config.navigationWand) { + if (config.navigationWandMaxDistance <= 0) { + return false; } - WorldVector pos = player.getSolidBlockTrace(config.navigationWandMaxDistance); + + if (!player.hasPermission("worldedit.navigation.jumpto.tool") + && !player.hasPermission("worldedit.navigation.jumpto")) { // TODO: Remove old permission + return false; + } + + WorldVector pos = player.getSolidBlockTrace(config.navigationWandMaxDistance); if (pos != null) { player.findFreePosition(pos); } else { @@ -1036,6 +1034,8 @@ public class WorldEdit { return true; } + LocalSession session = getSession(player); + Tool tool = session.getTool(player.getItemInHand()); if (tool != null && tool instanceof DoubleActionTraceTool) { if (tool.canUse(player)) { @@ -1043,6 +1043,7 @@ public class WorldEdit { return true; } } + return false; } @@ -1053,33 +1054,33 @@ public class WorldEdit { * @return */ public boolean handleRightClick(LocalPlayer player) { - LocalSession session = getSession(player); + if (player.getItemInHand() == config.navigationWand) { + if (config.navigationWandMaxDistance <= 0) { + return false; + } + + if (!player.hasPermission("worldedit.navigation.thru.tool") + && !player.hasPermission("worldedit.navigation.thru")) { // TODO: Remove old permission + return false; + } - if (player.getItemInHand() == config.navigationWand - && config.navigationWandMaxDistance > 0 - && (player.hasPermission("worldedit.navigation.thru.tool") - || player.hasPermission("worldedit.navigation.thru"))) { // TODO: Remove old permission - if (!player.passThroughForwardWall(40)) { player.printError("Nothing to pass through!"); } - // Bug workaround, so it wont do the Jumpto compass function - // Right after this teleport - if (session.canUseJumpto()) { - session.toggleJumptoBlock(); - } + return true; } - + + LocalSession session = getSession(player); + Tool tool = session.getTool(player.getItemInHand()); - if (tool != null && tool instanceof TraceTool) { if (tool.canUse(player)) { ((TraceTool) tool).actPrimary(server, config, player, session); return true; } } - + return false; }