From b28fdbfe4ead0e9c83ab7e6ae563e74a2cd775cc Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Mon, 5 Aug 2013 19:47:49 +0200 Subject: [PATCH] Used vector constants in all appropriate placed. --- .../sk89q/worldedit/commands/ClipboardCommands.java | 4 ++-- .../sk89q/worldedit/commands/GenerationCommands.java | 8 ++++---- .../com/sk89q/worldedit/commands/RegionCommands.java | 6 +++--- .../sk89q/worldedit/commands/SelectionCommands.java | 2 +- .../worldedit/regions/CylinderRegionSelector.java | 12 ++++++------ 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/commands/ClipboardCommands.java b/src/main/java/com/sk89q/worldedit/commands/ClipboardCommands.java index 82d8cef98..647362b46 100644 --- a/src/main/java/com/sk89q/worldedit/commands/ClipboardCommands.java +++ b/src/main/java/com/sk89q/worldedit/commands/ClipboardCommands.java @@ -64,7 +64,7 @@ public class ClipboardCommands { Vector pos = session.getPlacementPosition(player); CuboidClipboard clipboard = new CuboidClipboard( - max.subtract(min).add(new Vector(1, 1, 1)), + max.subtract(min).add(Vector.ONE), min, min.subtract(pos)); clipboard.copy(editSession); if (args.hasFlag('e')) { @@ -107,7 +107,7 @@ public class ClipboardCommands { Vector pos = session.getPlacementPosition(player); CuboidClipboard clipboard = new CuboidClipboard( - max.subtract(min).add(new Vector(1, 1, 1)), + max.subtract(min).add(Vector.ONE), min, min.subtract(pos)); clipboard.copy(editSession); if (args.hasFlag('e')) { diff --git a/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java b/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java index 88048dbc4..c26b23af2 100644 --- a/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java +++ b/src/main/java/com/sk89q/worldedit/commands/GenerationCommands.java @@ -384,17 +384,17 @@ public class GenerationCommands { Vector unit; if (args.hasFlag('r')) { - zero = new Vector(0, 0, 0); - unit = new Vector(1, 1, 1); + zero = Vector.ZERO; + unit = Vector.ONE; } else if (args.hasFlag('o')) { zero = session.getPlacementPosition(player); - unit = new Vector(1, 1, 1); + unit = Vector.ONE; } else if (args.hasFlag('c')) { final Vector min = region.getMinimumPoint(); final Vector max = region.getMaximumPoint(); zero = max.add(min).multiply(0.5); - unit = new Vector(1, 1, 1); + unit = Vector.ONE; } else { final Vector min = region.getMinimumPoint(); final Vector max = region.getMaximumPoint(); diff --git a/src/main/java/com/sk89q/worldedit/commands/RegionCommands.java b/src/main/java/com/sk89q/worldedit/commands/RegionCommands.java index 2c952959e..7faeaff07 100644 --- a/src/main/java/com/sk89q/worldedit/commands/RegionCommands.java +++ b/src/main/java/com/sk89q/worldedit/commands/RegionCommands.java @@ -393,11 +393,11 @@ public class RegionCommands { Vector unit; if (args.hasFlag('r')) { - zero = new Vector(0, 0, 0); - unit = new Vector(1, 1, 1); + zero = Vector.ZERO; + unit = Vector.ONE; } else if (args.hasFlag('o')) { zero = session.getPlacementPosition(player); - unit = new Vector(1, 1, 1); + unit = Vector.ONE; } else { final Vector min = region.getMinimumPoint(); final Vector max = region.getMaximumPoint(); diff --git a/src/main/java/com/sk89q/worldedit/commands/SelectionCommands.java b/src/main/java/com/sk89q/worldedit/commands/SelectionCommands.java index 03dfba2a1..b9acd74e1 100644 --- a/src/main/java/com/sk89q/worldedit/commands/SelectionCommands.java +++ b/src/main/java/com/sk89q/worldedit/commands/SelectionCommands.java @@ -602,7 +602,7 @@ public class SelectionCommands { player.print("Size: " + size); player.print("Offset: " + offset); - player.print("Cuboid distance: " + size.distance( new Vector(1, 1, 1))); + player.print("Cuboid distance: " + size.distance(Vector.ONE)); player.print("# of blocks: " + (int) (size.getX() * size.getY() * size.getZ())); return; diff --git a/src/main/java/com/sk89q/worldedit/regions/CylinderRegionSelector.java b/src/main/java/com/sk89q/worldedit/regions/CylinderRegionSelector.java index 1c60e4104..54585f708 100644 --- a/src/main/java/com/sk89q/worldedit/regions/CylinderRegionSelector.java +++ b/src/main/java/com/sk89q/worldedit/regions/CylinderRegionSelector.java @@ -90,7 +90,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { } public boolean selectPrimary(Vector pos) { - if (!region.getCenter().equals(new Vector(0, 0, 0)) && pos.compareTo(region.getCenter()) == 0) { + if (!region.getCenter().equals(Vector.ZERO) && pos.compareTo(region.getCenter()) == 0) { return false; } @@ -103,7 +103,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { public boolean selectSecondary(Vector pos) { Vector center = region.getCenter(); - if ((center.compareTo(new Vector(0, 0, 0))) == 0) { + if ((center.compareTo(Vector.ZERO)) == 0) { return true; } @@ -124,7 +124,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) { Vector center = region.getCenter(); - if (!center.equals(new Vector(0, 0, 0))) { + if (!center.equals(Vector.ZERO)) { player.print("Radius set to " + format.format(region.getRadius().getX()) + "/" + format.format(region.getRadius().getZ()) + " blocks. (" + region.getArea() + ")."); } else { player.printError("You must select the center point before setting the radius."); @@ -159,7 +159,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { } public boolean isDefined() { - return !region.getRadius().equals(new Vector2D(0, 0)); + return !region.getRadius().equals(Vector2D.ZERO); } public void learnChanges() { @@ -176,10 +176,10 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion { public List getInformationLines() { final List lines = new ArrayList(); - if (!region.getCenter().equals(new Vector(0, 0, 0))) { + if (!region.getCenter().equals(Vector.ZERO)) { lines.add("Center: " + region.getCenter()); } - if (!region.getRadius().equals(new Vector2D(0, 0))) { + if (!region.getRadius().equals(Vector2D.ZERO)) { lines.add("Radius: " + region.getRadius()); }