From 051f0115ca0a2d0232c6f9bc309248b9cbf0bd33 Mon Sep 17 00:00:00 2001 From: Jeremy Schroeder Date: Fri, 17 May 2013 13:02:15 -0300 Subject: [PATCH] Update ForEachCommand.java --- .../denizen/scripts/commands/core/ForEachCommand.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/core/ForEachCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/core/ForEachCommand.java index b6ff3b2c9a..57fc345cbc 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/core/ForEachCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/core/ForEachCommand.java @@ -83,6 +83,8 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { + script.debug()); if (type == Type.LOCATION) { + + dB.echoDebug("Type Location..."); int x_inc = -1; int y_inc = -1; @@ -92,13 +94,19 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { if (loc_1.getBlockY() <= loc_2.getBlockY()) y_inc = 1; if (loc_1.getBlockZ() <= loc_2.getBlockZ()) z_inc = 1; + dB.echoDebug("incs = " + x_inc + " " + y_inc + " " + z_inc); + int x_amt = Math.abs(loc_1.getBlockX() - loc_2.getBlockX()); int y_amt = Math.abs(loc_1.getBlockY() - loc_2.getBlockY()); int z_amt = Math.abs(loc_1.getBlockZ() - loc_2.getBlockZ()); + dB.echoDebug("amts = " + x_amt + " " + y_amt + " " + z_amt); + for (int x = 0; x != x_amt; x = x + x_inc) { for (int y = 0; x != y_amt; y = y + y_inc) { for (int z = 0; x != z_amt; z = z + z_inc) { + + dB.echoDebug("x,y,z = " + x + " " + y + " " + z); dLocation loc = new dLocation(loc_1.add((double) x, (double) y, (double) z)); @@ -116,4 +124,4 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException { } } -} +}