From f6f08da62043f488b599b4da2ef79fdd5723be9f Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Thu, 27 Oct 2011 19:25:54 +0200 Subject: [PATCH] Cleanup --- .../java/com/sk89q/worldedit/ArbitraryShape.java | 15 +++++++-------- .../worldedit/commands/GenerationCommands.java | 16 ++++++++++------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/ArbitraryShape.java b/src/main/java/com/sk89q/worldedit/ArbitraryShape.java index 106dc236b..b5248b358 100644 --- a/src/main/java/com/sk89q/worldedit/ArbitraryShape.java +++ b/src/main/java/com/sk89q/worldedit/ArbitraryShape.java @@ -43,33 +43,32 @@ public abstract class ArbitraryShape { double y = position.getY(); double z = position.getZ(); - if (!isInside(x, y, z)) - continue; + if (!isInside(x, y, z)) continue; if (hollow) { boolean draw = false; do { - if (!isInside(x+1, y, z)) { + if (!isInside(x + 1, y, z)) { draw = true; break; } - if (!isInside(x-1, y, z)) { + if (!isInside(x - 1, y, z)) { draw = true; break; } - if (!isInside(x, y+1, z)) { + if (!isInside(x, y + 1, z)) { draw = true; break; } - if (!isInside(x, y-1, z)) { + if (!isInside(x, y - 1, z)) { draw = true; break; } - if (!isInside(x, y, z+1)) { + if (!isInside(x, y, z + 1)) { draw = true; break; } - if (!isInside(x, y, z-1)) { + if (!isInside(x, y, z - 1)) { draw = true; break; } diff --git a/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java b/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java index 848728fa5..dae29b56c 100644 --- a/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java +++ b/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java @@ -340,7 +340,8 @@ public class GenerationCommands { try { expression = Expression.compile(args.getJoinedStrings(1), "x", "y", "z"); expression.optimize(); - } catch (ExpressionException e) { + } + catch (ExpressionException e) { player.printError(e.getMessage()); return; } @@ -353,7 +354,8 @@ public class GenerationCommands { protected boolean isInside(double x, double y, double z) { try { return expression.evaluate(x, y, z) > 0; - } catch (Exception e) { + } + catch (Exception e) { e.printStackTrace(); return false; } @@ -371,8 +373,9 @@ public class GenerationCommands { @Override protected boolean isInside(double x, double y, double z) { try { - return expression.evaluate(x-placementX, y-placementY, z-placementZ) > 0; - } catch (Exception e) { + return expression.evaluate(x - placementX, y - placementY, z - placementZ) > 0; + } + catch (Exception e) { e.printStackTrace(); return false; } @@ -387,11 +390,12 @@ public class GenerationCommands { shape = new ArbitraryShape(region) { @Override protected boolean isInside(double x, double y, double z) { - final Vector scaled = new Vector(x,y,z).subtract(center).divide(stretch); + final Vector scaled = new Vector(x, y, z).subtract(center).divide(stretch); try { return expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ()) > 0; - } catch (Exception e) { + } + catch (Exception e) { e.printStackTrace(); return false; }