Moved RegionSelectors and RegionIterators into subpackages.

Dieser Commit ist enthalten in:
sk89q 2014-04-03 18:32:51 -07:00
Ursprung 2e904577b7
Commit 1fd1e7aaf8
33 geänderte Dateien mit 1561 neuen und 1551 gelöschten Zeilen

Datei anzeigen

@ -29,7 +29,7 @@ import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegion; import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

Datei anzeigen

@ -19,6 +19,8 @@
package com.sk89q.worldedit.bukkit.selections; package com.sk89q.worldedit.bukkit.selections;
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
import com.sk89q.worldedit.regions.selector.RegionSelector;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;

Datei anzeigen

@ -23,6 +23,8 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.regions.selector.Polygonal2DRegionSelector;
import com.sk89q.worldedit.regions.selector.RegionSelector;
import org.bukkit.World; import org.bukkit.World;
import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.BlockVector2D;
import com.sk89q.worldedit.bukkit.BukkitUtil; import com.sk89q.worldedit.bukkit.BukkitUtil;

Datei anzeigen

@ -19,13 +19,14 @@
package com.sk89q.worldedit.bukkit.selections; package com.sk89q.worldedit.bukkit.selections;
import static com.sk89q.worldedit.bukkit.BukkitUtil.toLocation;
import static com.sk89q.worldedit.bukkit.BukkitUtil.toVector;
import org.bukkit.Location;
import org.bukkit.World;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
import org.bukkit.Location;
import org.bukkit.World;
import static com.sk89q.worldedit.bukkit.BukkitUtil.toLocation;
import static com.sk89q.worldedit.bukkit.BukkitUtil.toVector;
public abstract class RegionSelection implements Selection { public abstract class RegionSelection implements Selection {

Datei anzeigen

@ -22,7 +22,7 @@ package com.sk89q.worldedit.bukkit.selections;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
public interface Selection { public interface Selection {
/** /**

Datei anzeigen

@ -6,8 +6,8 @@ import com.sk89q.worldedit.Location;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.forge.WorldEditMod; import com.sk89q.worldedit.forge.WorldEditMod;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.CuboidRegionSelector; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
public class CuboidSelection extends RegionSelection { public class CuboidSelection extends RegionSelection {
protected CuboidRegion cuboid; protected CuboidRegion cuboid;

Datei anzeigen

@ -8,8 +8,8 @@ import net.minecraft.world.World;
import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.forge.WorldEditMod; import com.sk89q.worldedit.forge.WorldEditMod;
import com.sk89q.worldedit.regions.Polygonal2DRegion; import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegionSelector; import com.sk89q.worldedit.regions.selector.Polygonal2DRegionSelector;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
public class Polygonal2DSelection extends RegionSelection { public class Polygonal2DSelection extends RegionSelection {
protected Polygonal2DRegion poly2d; protected Polygonal2DRegion poly2d;

Datei anzeigen

@ -8,7 +8,7 @@ import com.sk89q.worldedit.Location;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.forge.WorldEditMod; import com.sk89q.worldedit.forge.WorldEditMod;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
public abstract class RegionSelection implements Selection { public abstract class RegionSelection implements Selection {
private WeakReference<World> world; private WeakReference<World> world;

Datei anzeigen

@ -4,7 +4,7 @@ import net.minecraft.world.World;
import com.sk89q.worldedit.Location; import com.sk89q.worldedit.Location;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
public abstract interface Selection { public abstract interface Selection {
public abstract Location getMinimumPoint(); public abstract Location getMinimumPoint();

Datei anzeigen

@ -32,9 +32,9 @@ import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.CUIRegion;
import com.sk89q.worldedit.internal.cui.SelectionShapeEvent; import com.sk89q.worldedit.internal.cui.SelectionShapeEvent;
import com.sk89q.worldedit.masks.Mask; import com.sk89q.worldedit.masks.Mask;
import com.sk89q.worldedit.regions.CuboidRegionSelector; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.world.snapshot.Snapshot; import com.sk89q.worldedit.world.snapshot.Snapshot;

Datei anzeigen

@ -33,21 +33,19 @@ import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extension.registry.BlockRegistry; import com.sk89q.worldedit.extension.registry.BlockRegistry;
import com.sk89q.worldedit.extension.registry.MaskRegistry; import com.sk89q.worldedit.extension.registry.MaskRegistry;
import com.sk89q.worldedit.extension.registry.PatternRegistry; import com.sk89q.worldedit.extension.registry.PatternRegistry;
import com.sk89q.worldedit.extent.ExtentDelegate;
import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.function.mask.Masks;
import com.sk89q.worldedit.function.pattern.Patterns; import com.sk89q.worldedit.function.pattern.Patterns;
import com.sk89q.worldedit.internal.InternalEditSessionFactory; import com.sk89q.worldedit.internal.InternalEditSessionFactory;
import com.sk89q.worldedit.masks.Mask; import com.sk89q.worldedit.masks.Mask;
import com.sk89q.worldedit.patterns.Pattern; import com.sk89q.worldedit.patterns.Pattern;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
import com.sk89q.worldedit.scripting.CraftScriptContext; import com.sk89q.worldedit.scripting.CraftScriptContext;
import com.sk89q.worldedit.scripting.CraftScriptEngine; import com.sk89q.worldedit.scripting.CraftScriptEngine;
import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine; import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine;
import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.LogFormat; import com.sk89q.worldedit.util.LogFormat;
import com.sk89q.worldedit.util.eventbus.EventBus; import com.sk89q.worldedit.util.eventbus.EventBus;
import com.sk89q.worldedit.util.eventbus.Subscribe;
import javax.script.ScriptException; import javax.script.ScriptException;
import java.io.*; import java.io.*;

Datei anzeigen

@ -30,7 +30,7 @@ import com.sk89q.worldedit.*;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.CuboidRegionSelector; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
/** /**

Datei anzeigen

@ -44,16 +44,16 @@ import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockType; import com.sk89q.worldedit.blocks.BlockType;
import com.sk89q.worldedit.world.storage.ChunkStore; import com.sk89q.worldedit.world.storage.ChunkStore;
import com.sk89q.worldedit.regions.ConvexPolyhedralRegionSelector; import com.sk89q.worldedit.regions.selector.ConvexPolyhedralRegionSelector;
import com.sk89q.worldedit.regions.CuboidRegionSelector; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
import com.sk89q.worldedit.regions.CylinderRegionSelector; import com.sk89q.worldedit.regions.selector.CylinderRegionSelector;
import com.sk89q.worldedit.regions.EllipsoidRegionSelector; import com.sk89q.worldedit.regions.selector.EllipsoidRegionSelector;
import com.sk89q.worldedit.regions.ExtendingCuboidRegionSelector; import com.sk89q.worldedit.regions.selector.ExtendingCuboidRegionSelector;
import com.sk89q.worldedit.regions.Polygonal2DRegionSelector; import com.sk89q.worldedit.regions.selector.Polygonal2DRegionSelector;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionOperationException; import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
import com.sk89q.worldedit.regions.SphereRegionSelector; import com.sk89q.worldedit.regions.selector.SphereRegionSelector;
/** /**
* Selection commands. * Selection commands.

Datei anzeigen

@ -20,7 +20,7 @@
package com.sk89q.worldedit.command.tool; package com.sk89q.worldedit.command.tool;
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
/** /**
* A wand that can be used at a distance. * A wand that can be used at a distance.

Datei anzeigen

@ -19,19 +19,13 @@
package com.sk89q.worldedit.regions; package com.sk89q.worldedit.regions;
import java.util.ArrayList; import com.sk89q.worldedit.*;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.BlockVector2D;
import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.regions.iterator.RegionIterator;
import com.sk89q.worldedit.world.storage.ChunkStore; import com.sk89q.worldedit.world.storage.ChunkStore;
import java.util.*;
public abstract class AbstractRegion implements Region { public abstract class AbstractRegion implements Region {
/** /**
* Stores the world. * Stores the world.

Datei anzeigen

@ -19,14 +19,13 @@
package com.sk89q.worldedit.regions; package com.sk89q.worldedit.regions;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.regions.iterator.FlatRegion3DIterator;
import com.sk89q.worldedit.regions.iterator.FlatRegionIterator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.BlockVector2D;
import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.Vector2D;
/** /**
* Represents a cylindrical region. * Represents a cylindrical region.

Datei anzeigen

@ -28,6 +28,8 @@ import com.sk89q.worldedit.BlockVector2D;
import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.regions.iterator.FlatRegion3DIterator;
import com.sk89q.worldedit.regions.iterator.FlatRegionIterator;
/** /**
* Represents a 2D polygonal region. * Represents a 2D polygonal region.

Datei anzeigen

@ -1,10 +1,11 @@
package com.sk89q.worldedit.regions; package com.sk89q.worldedit.regions.iterator;
import java.util.Iterator; import java.util.Iterator;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.regions.FlatRegion;
public class FlatRegion3DIterator implements Iterator<BlockVector> { public class FlatRegion3DIterator implements Iterator<BlockVector> {

Datei anzeigen

@ -17,12 +17,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldedit.regions; package com.sk89q.worldedit.regions.iterator;
import java.util.Iterator; import java.util.Iterator;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.regions.Region;
public class FlatRegionIterator implements Iterator<Vector2D> { public class FlatRegionIterator implements Iterator<Vector2D> {

Datei anzeigen

@ -1,94 +1,95 @@
// $Id$ // $Id$
/* /*
* WorldEdit * WorldEdit
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors * Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldedit.regions; package com.sk89q.worldedit.regions.iterator;
import java.util.Iterator; import java.util.Iterator;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.regions.Region;
public class RegionIterator implements Iterator<BlockVector> {
private final Region region; public class RegionIterator implements Iterator<BlockVector> {
private final int maxX; private final Region region;
private final int maxY; private final int maxX;
private final int maxZ; private final int maxY;
private final Vector min; private final int maxZ;
private int nextX; private final Vector min;
private int nextY; private int nextX;
private int nextZ; private int nextY;
private int nextZ;
public RegionIterator(Region region) {
this.region = region; public RegionIterator(Region region) {
this.region = region;
Vector max = region.getMaximumPoint();
this.maxX = max.getBlockX(); Vector max = region.getMaximumPoint();
this.maxY = max.getBlockY(); this.maxX = max.getBlockX();
this.maxZ = max.getBlockZ(); this.maxY = max.getBlockY();
this.maxZ = max.getBlockZ();
this.min = region.getMinimumPoint();
this.nextX = min.getBlockX(); this.min = region.getMinimumPoint();
this.nextY = min.getBlockY(); this.nextX = min.getBlockX();
this.nextZ = min.getBlockZ(); this.nextY = min.getBlockY();
this.nextZ = min.getBlockZ();
forward();
} forward();
}
public boolean hasNext() {
return nextX != Integer.MIN_VALUE; public boolean hasNext() {
} return nextX != Integer.MIN_VALUE;
}
private void forward() {
while (hasNext() && !region.contains(new BlockVector(nextX, nextY, nextZ))) { private void forward() {
forwardOne(); while (hasNext() && !region.contains(new BlockVector(nextX, nextY, nextZ))) {
} forwardOne();
} }
}
public BlockVector next() {
if (!hasNext()) throw new java.util.NoSuchElementException(); public BlockVector next() {
if (!hasNext()) throw new java.util.NoSuchElementException();
BlockVector answer = new BlockVector(nextX, nextY, nextZ);
BlockVector answer = new BlockVector(nextX, nextY, nextZ);
forwardOne();
forward(); forwardOne();
forward();
return answer;
} return answer;
}
private void forwardOne() {
if (++nextX <= maxX) { private void forwardOne() {
return; if (++nextX <= maxX) {
} return;
nextX = min.getBlockX(); }
nextX = min.getBlockX();
if (++nextY <= maxY) {
return; if (++nextY <= maxY) {
} return;
nextY = min.getBlockY(); }
nextY = min.getBlockY();
if (++nextZ <= maxZ) {
return; if (++nextZ <= maxZ) {
} return;
nextX = Integer.MIN_VALUE; }
} nextX = Integer.MIN_VALUE;
}
public void remove() {
throw new UnsupportedOperationException(); public void remove() {
} throw new UnsupportedOperationException();
} }
}

Datei anzeigen

@ -1,219 +1,221 @@
// $Id$ // $Id$
/* /*
* WorldEdit * WorldEdit
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors * Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldedit.regions; package com.sk89q.worldedit.regions.selector;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.BlockVector2D;
import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalPlayer; import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.CUIRegion;
import com.sk89q.worldedit.internal.cui.SelectionPointEvent; import com.sk89q.worldedit.internal.cui.SelectionPointEvent;
import com.sk89q.worldedit.internal.cui.SelectionPolygonEvent; import com.sk89q.worldedit.internal.cui.SelectionPolygonEvent;
import com.sk89q.worldedit.internal.cui.SelectionShapeEvent; import com.sk89q.worldedit.internal.cui.SelectionShapeEvent;
import com.sk89q.worldedit.regions.polyhedron.Triangle; import com.sk89q.worldedit.regions.ConvexPolyhedralRegion;
import com.sk89q.worldedit.regions.Region;
public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion { import com.sk89q.worldedit.regions.polyhedron.Triangle;
private int maxVertices;
private final ConvexPolyhedralRegion region; public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion {
private BlockVector pos1; private int maxVertices;
private final ConvexPolyhedralRegion region;
public ConvexPolyhedralRegionSelector(LocalWorld world, int maxVertices) { private BlockVector pos1;
this.maxVertices = maxVertices;
region = new ConvexPolyhedralRegion(world); public ConvexPolyhedralRegionSelector(LocalWorld world, int maxVertices) {
} this.maxVertices = maxVertices;
region = new ConvexPolyhedralRegion(world);
public ConvexPolyhedralRegionSelector(RegionSelector oldSelector, int maxVertices) { }
this.maxVertices = maxVertices;
if (oldSelector instanceof ConvexPolyhedralRegionSelector) { public ConvexPolyhedralRegionSelector(RegionSelector oldSelector, int maxVertices) {
final ConvexPolyhedralRegionSelector convexPolyhedralRegionSelector = (ConvexPolyhedralRegionSelector) oldSelector; this.maxVertices = maxVertices;
if (oldSelector instanceof ConvexPolyhedralRegionSelector) {
pos1 = convexPolyhedralRegionSelector.pos1; final ConvexPolyhedralRegionSelector convexPolyhedralRegionSelector = (ConvexPolyhedralRegionSelector) oldSelector;
region = new ConvexPolyhedralRegion(convexPolyhedralRegionSelector.region);
} else { pos1 = convexPolyhedralRegionSelector.pos1;
final Region oldRegion; region = new ConvexPolyhedralRegion(convexPolyhedralRegionSelector.region);
try { } else {
oldRegion = oldSelector.getRegion(); final Region oldRegion;
} catch (IncompleteRegionException e) { try {
region = new ConvexPolyhedralRegion(oldSelector.getIncompleteRegion().getWorld()); oldRegion = oldSelector.getRegion();
return; } catch (IncompleteRegionException e) {
} region = new ConvexPolyhedralRegion(oldSelector.getIncompleteRegion().getWorld());
return;
final int minY = oldRegion.getMinimumPoint().getBlockY(); }
final int maxY = oldRegion.getMaximumPoint().getBlockY();
final int minY = oldRegion.getMinimumPoint().getBlockY();
region = new ConvexPolyhedralRegion(oldRegion.getWorld()); final int maxY = oldRegion.getMaximumPoint().getBlockY();
for (final BlockVector2D pt : new ArrayList<BlockVector2D>(oldRegion.polygonize(maxVertices < 0 ? maxVertices : maxVertices / 2))) { region = new ConvexPolyhedralRegion(oldRegion.getWorld());
region.addVertex(pt.toVector(minY));
region.addVertex(pt.toVector(maxY)); for (final BlockVector2D pt : new ArrayList<BlockVector2D>(oldRegion.polygonize(maxVertices < 0 ? maxVertices : maxVertices / 2))) {
} region.addVertex(pt.toVector(minY));
region.addVertex(pt.toVector(maxY));
learnChanges(); }
}
} learnChanges();
}
@Override }
public boolean selectPrimary(Vector pos) {
clear(); @Override
pos1 = pos.toBlockVector(); public boolean selectPrimary(Vector pos) {
return region.addVertex(pos); clear();
} pos1 = pos.toBlockVector();
return region.addVertex(pos);
@Override }
public boolean selectSecondary(Vector pos) {
if (maxVertices >= 0 && region.getVertices().size() > maxVertices) { @Override
return false; public boolean selectSecondary(Vector pos) {
} if (maxVertices >= 0 && region.getVertices().size() > maxVertices) {
return false;
return region.addVertex(pos); }
}
return region.addVertex(pos);
@Override }
public BlockVector getPrimaryPosition() throws IncompleteRegionException {
return pos1; @Override
} public BlockVector getPrimaryPosition() throws IncompleteRegionException {
return pos1;
@Override }
public Region getRegion() throws IncompleteRegionException {
if (!region.isDefined()) { @Override
throw new IncompleteRegionException(); public Region getRegion() throws IncompleteRegionException {
} if (!region.isDefined()) {
throw new IncompleteRegionException();
return region; }
}
return region;
@Override }
public Region getIncompleteRegion() {
return region; @Override
} public Region getIncompleteRegion() {
return region;
@Override }
public boolean isDefined() {
return region.isDefined(); @Override
} public boolean isDefined() {
return region.isDefined();
@Override }
public int getArea() {
return region.getArea(); @Override
} public int getArea() {
return region.getArea();
@Override }
public void learnChanges() {
pos1 = region.getVertices().iterator().next().toBlockVector(); @Override
} public void learnChanges() {
pos1 = region.getVertices().iterator().next().toBlockVector();
@Override }
public void clear() {
region.clear(); @Override
} public void clear() {
region.clear();
@Override }
public String getTypeName() {
return "Convex Polyhedron"; @Override
} public String getTypeName() {
return "Convex Polyhedron";
@Override }
public List<String> getInformationLines() {
List<String> ret = new ArrayList<String>(); @Override
public List<String> getInformationLines() {
ret.add("Vertices: "+region.getVertices().size()); List<String> ret = new ArrayList<String>();
ret.add("Triangles: "+region.getTriangles().size());
ret.add("Vertices: "+region.getVertices().size());
return ret; ret.add("Triangles: "+region.getTriangles().size());
}
return ret;
}
@Override
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) {
session.describeCUI(player); @Override
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) {
player.print("Started new selection with vertex "+pos+"."); session.describeCUI(player);
}
player.print("Started new selection with vertex "+pos+".");
@Override }
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
session.describeCUI(player); @Override
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
player.print("Added vertex "+pos+" to the selection."); session.describeCUI(player);
}
player.print("Added vertex "+pos+" to the selection.");
@Override }
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
session.describeCUI(player); @Override
} public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
session.describeCUI(player);
}
@Override
public int getProtocolVersion() {
return 3; @Override
} public int getProtocolVersion() {
return 3;
@Override }
public String getTypeID() {
return "polyhedron"; @Override
} public String getTypeID() {
return "polyhedron";
@Override }
public void describeCUI(LocalSession session, LocalPlayer player) {
Collection<Vector> vertices = region.getVertices(); @Override
Collection<Triangle> triangles = region.getTriangles(); public void describeCUI(LocalSession session, LocalPlayer player) {
Collection<Vector> vertices = region.getVertices();
player.dispatchCUIEvent(new SelectionShapeEvent(getTypeID())); Collection<Triangle> triangles = region.getTriangles();
Map<Vector, Integer> vertexIds = new HashMap<Vector, Integer>(vertices.size()); player.dispatchCUIEvent(new SelectionShapeEvent(getTypeID()));
int lastVertexId = -1;
for (Vector vertex : vertices) { Map<Vector, Integer> vertexIds = new HashMap<Vector, Integer>(vertices.size());
vertexIds.put(vertex, ++lastVertexId); int lastVertexId = -1;
session.dispatchCUIEvent(player, new SelectionPointEvent(lastVertexId, vertex, getArea())); for (Vector vertex : vertices) {
} vertexIds.put(vertex, ++lastVertexId);
session.dispatchCUIEvent(player, new SelectionPointEvent(lastVertexId, vertex, getArea()));
for (Triangle triangle : triangles) { }
final int[] v = new int[3];
for (int i = 0; i < 3; ++i) { for (Triangle triangle : triangles) {
v[i] = vertexIds.get(triangle.getVertex(i)); final int[] v = new int[3];
} for (int i = 0; i < 3; ++i) {
session.dispatchCUIEvent(player, new SelectionPolygonEvent(v)); v[i] = vertexIds.get(triangle.getVertex(i));
} }
} session.dispatchCUIEvent(player, new SelectionPolygonEvent(v));
}
@Override }
public String getLegacyTypeID() {
return "cuboid"; @Override
} public String getLegacyTypeID() {
return "cuboid";
@Override }
public void describeLegacyCUI(LocalSession session, LocalPlayer player) {
if (isDefined()) { @Override
session.dispatchCUIEvent(player, new SelectionPointEvent(0, region.getMinimumPoint(), getArea())); public void describeLegacyCUI(LocalSession session, LocalPlayer player) {
session.dispatchCUIEvent(player, new SelectionPointEvent(1, region.getMaximumPoint(), getArea())); if (isDefined()) {
} else { session.dispatchCUIEvent(player, new SelectionPointEvent(0, region.getMinimumPoint(), getArea()));
session.dispatchCUIEvent(player, new SelectionShapeEvent(getLegacyTypeID())); session.dispatchCUIEvent(player, new SelectionPointEvent(1, region.getMaximumPoint(), getArea()));
} } else {
} session.dispatchCUIEvent(player, new SelectionShapeEvent(getLegacyTypeID()));
} }
}
}

Datei anzeigen

@ -1,223 +1,225 @@
// $Id$ // $Id$
/* /*
* WorldEdit * WorldEdit
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors * Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldedit.regions; package com.sk89q.worldedit.regions.selector;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalPlayer; import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.CUIRegion;
import com.sk89q.worldedit.internal.cui.SelectionPointEvent; import com.sk89q.worldedit.internal.cui.SelectionPointEvent;
import com.sk89q.worldedit.regions.CuboidRegion;
/** import com.sk89q.worldedit.regions.Region;
* Selector for cuboids.
* /**
* @author sk89q * Selector for cuboids.
*/ *
public class CuboidRegionSelector implements RegionSelector, CUIRegion { * @author sk89q
protected BlockVector pos1; */
protected BlockVector pos2; public class CuboidRegionSelector implements RegionSelector, CUIRegion {
protected CuboidRegion region; protected BlockVector pos1;
protected BlockVector pos2;
public CuboidRegionSelector(LocalWorld world) { protected CuboidRegion region;
region = new CuboidRegion(world, new Vector(), new Vector());
} public CuboidRegionSelector(LocalWorld world) {
region = new CuboidRegion(world, new Vector(), new Vector());
public CuboidRegionSelector() { }
this((LocalWorld) null);
} public CuboidRegionSelector() {
this((LocalWorld) null);
public CuboidRegionSelector(RegionSelector oldSelector) { }
this(oldSelector.getIncompleteRegion().getWorld());
if (oldSelector instanceof CuboidRegionSelector) { public CuboidRegionSelector(RegionSelector oldSelector) {
final CuboidRegionSelector cuboidRegionSelector = (CuboidRegionSelector) oldSelector; this(oldSelector.getIncompleteRegion().getWorld());
if (oldSelector instanceof CuboidRegionSelector) {
pos1 = cuboidRegionSelector.pos1; final CuboidRegionSelector cuboidRegionSelector = (CuboidRegionSelector) oldSelector;
pos2 = cuboidRegionSelector.pos2;
} else { pos1 = cuboidRegionSelector.pos1;
final Region oldRegion; pos2 = cuboidRegionSelector.pos2;
try { } else {
oldRegion = oldSelector.getRegion(); final Region oldRegion;
} catch (IncompleteRegionException e) { try {
return; oldRegion = oldSelector.getRegion();
} } catch (IncompleteRegionException e) {
return;
pos1 = oldRegion.getMinimumPoint().toBlockVector(); }
pos2 = oldRegion.getMaximumPoint().toBlockVector();
} pos1 = oldRegion.getMinimumPoint().toBlockVector();
pos2 = oldRegion.getMaximumPoint().toBlockVector();
region.setPos1(pos1); }
region.setPos2(pos2);
} region.setPos1(pos1);
region.setPos2(pos2);
public CuboidRegionSelector(LocalWorld world, Vector pos1, Vector pos2) { }
this(world);
this.pos1 = pos1.toBlockVector(); public CuboidRegionSelector(LocalWorld world, Vector pos1, Vector pos2) {
this.pos2 = pos2.toBlockVector(); this(world);
region.setPos1(pos1); this.pos1 = pos1.toBlockVector();
region.setPos2(pos2); this.pos2 = pos2.toBlockVector();
} region.setPos1(pos1);
region.setPos2(pos2);
public boolean selectPrimary(Vector pos) { }
if (pos1 != null && (pos.compareTo(pos1) == 0)) {
return false; public boolean selectPrimary(Vector pos) {
} if (pos1 != null && (pos.compareTo(pos1) == 0)) {
return false;
pos1 = pos.toBlockVector(); }
region.setPos1(pos1);
return true; pos1 = pos.toBlockVector();
} region.setPos1(pos1);
return true;
public boolean selectSecondary(Vector pos) { }
if (pos2 != null && (pos.compareTo(pos2)) == 0) {
return false; public boolean selectSecondary(Vector pos) {
} if (pos2 != null && (pos.compareTo(pos2)) == 0) {
return false;
pos2 = pos.toBlockVector(); }
region.setPos2(pos2);
return true; pos2 = pos.toBlockVector();
} region.setPos2(pos2);
return true;
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) { }
if (pos1 != null && pos2 != null) {
player.print("First position set to " + pos1 + " (" + region.getArea() + ")."); public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) {
} else { if (pos1 != null && pos2 != null) {
player.print("First position set to " + pos1 + "."); player.print("First position set to " + pos1 + " (" + region.getArea() + ").");
} } else {
player.print("First position set to " + pos1 + ".");
session.dispatchCUIEvent(player, new SelectionPointEvent(0, pos, getArea())); }
}
session.dispatchCUIEvent(player, new SelectionPointEvent(0, pos, getArea()));
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) { }
if (pos1 != null && pos2 != null) {
player.print("Second position set to " + pos2 + " (" + region.getArea() + ")."); public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
} else { if (pos1 != null && pos2 != null) {
player.print("Second position set to " + pos2 + "."); player.print("Second position set to " + pos2 + " (" + region.getArea() + ").");
} } else {
player.print("Second position set to " + pos2 + ".");
session.dispatchCUIEvent(player, new SelectionPointEvent(1, pos, getArea())); }
}
session.dispatchCUIEvent(player, new SelectionPointEvent(1, pos, getArea()));
public void explainRegionAdjust(LocalPlayer player, LocalSession session) { }
if (pos1 != null) {
session.dispatchCUIEvent(player, new SelectionPointEvent(0, pos1, getArea())); public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
} if (pos1 != null) {
session.dispatchCUIEvent(player, new SelectionPointEvent(0, pos1, getArea()));
if (pos2 != null) { }
session.dispatchCUIEvent(player, new SelectionPointEvent(1, pos2, getArea()));
} if (pos2 != null) {
} session.dispatchCUIEvent(player, new SelectionPointEvent(1, pos2, getArea()));
}
public BlockVector getPrimaryPosition() throws IncompleteRegionException { }
if (pos1 == null) {
throw new IncompleteRegionException(); public BlockVector getPrimaryPosition() throws IncompleteRegionException {
} if (pos1 == null) {
throw new IncompleteRegionException();
return pos1; }
}
return pos1;
public boolean isDefined() { }
return pos1 != null && pos2 != null;
} public boolean isDefined() {
return pos1 != null && pos2 != null;
public CuboidRegion getRegion() throws IncompleteRegionException { }
if (pos1 == null || pos2 == null) {
throw new IncompleteRegionException(); public CuboidRegion getRegion() throws IncompleteRegionException {
} if (pos1 == null || pos2 == null) {
throw new IncompleteRegionException();
return region; }
}
return region;
public CuboidRegion getIncompleteRegion() { }
return region;
} public CuboidRegion getIncompleteRegion() {
return region;
public void learnChanges() { }
pos1 = region.getPos1().toBlockVector();
pos2 = region.getPos2().toBlockVector(); public void learnChanges() {
} pos1 = region.getPos1().toBlockVector();
pos2 = region.getPos2().toBlockVector();
public void clear() { }
pos1 = null;
pos2 = null; public void clear() {
} pos1 = null;
pos2 = null;
public String getTypeName() { }
return "cuboid";
} public String getTypeName() {
return "cuboid";
public List<String> getInformationLines() { }
final List<String> lines = new ArrayList<String>();
public List<String> getInformationLines() {
if (pos1 != null) { final List<String> lines = new ArrayList<String>();
lines.add("Position 1: " + pos1);
} if (pos1 != null) {
lines.add("Position 1: " + pos1);
if (pos2 != null) { }
lines.add("Position 2: " + pos2);
} if (pos2 != null) {
lines.add("Position 2: " + pos2);
return lines; }
}
return lines;
public int getArea() { }
if (pos1 == null) {
return -1; public int getArea() {
} if (pos1 == null) {
return -1;
if (pos2 == null) { }
return -1;
} if (pos2 == null) {
return -1;
return region.getArea(); }
}
return region.getArea();
public void describeCUI(LocalSession session, LocalPlayer player) { }
if (pos1 != null) {
session.dispatchCUIEvent(player, new SelectionPointEvent(0, pos1, getArea())); public void describeCUI(LocalSession session, LocalPlayer player) {
} if (pos1 != null) {
session.dispatchCUIEvent(player, new SelectionPointEvent(0, pos1, getArea()));
if (pos2 != null) { }
session.dispatchCUIEvent(player, new SelectionPointEvent(1, pos2, getArea()));
} if (pos2 != null) {
} session.dispatchCUIEvent(player, new SelectionPointEvent(1, pos2, getArea()));
}
public void describeLegacyCUI(LocalSession session, LocalPlayer player) { }
describeCUI(session, player);
} public void describeLegacyCUI(LocalSession session, LocalPlayer player) {
describeCUI(session, player);
public int getProtocolVersion() { }
return 0;
} public int getProtocolVersion() {
return 0;
public String getTypeID() { }
return "cuboid";
} public String getTypeID() {
return "cuboid";
public String getLegacyTypeID() { }
return "cuboid";
} public String getLegacyTypeID() {
return "cuboid";
}
}
}

Datei anzeigen

@ -1,218 +1,221 @@
// $Id$ // $Id$
/* /*
* WorldEdit * WorldEdit
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors * Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldedit.regions; package com.sk89q.worldedit.regions.selector;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalPlayer; import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.CUIRegion;
import com.sk89q.worldedit.internal.cui.SelectionCylinderEvent; import com.sk89q.worldedit.internal.cui.SelectionCylinderEvent;
import com.sk89q.worldedit.internal.cui.SelectionMinMaxEvent; import com.sk89q.worldedit.internal.cui.SelectionMinMaxEvent;
import com.sk89q.worldedit.internal.cui.SelectionPointEvent; import com.sk89q.worldedit.internal.cui.SelectionPointEvent;
import com.sk89q.worldedit.internal.cui.SelectionShapeEvent; import com.sk89q.worldedit.internal.cui.SelectionShapeEvent;
import java.text.NumberFormat; import com.sk89q.worldedit.regions.CylinderRegion;
import com.sk89q.worldedit.regions.Region;
/**
* Selector for polygonal regions. import java.text.NumberFormat;
*
* @author sk89q /**
*/ * Selector for polygonal regions.
public class CylinderRegionSelector implements RegionSelector, CUIRegion { *
protected CylinderRegion region; * @author sk89q
protected static final NumberFormat format; */
public class CylinderRegionSelector implements RegionSelector, CUIRegion {
static { protected CylinderRegion region;
format = (NumberFormat) NumberFormat.getInstance().clone(); protected static final NumberFormat format;
format.setMaximumFractionDigits(3);
} static {
format = (NumberFormat) NumberFormat.getInstance().clone();
public CylinderRegionSelector(LocalWorld world) { format.setMaximumFractionDigits(3);
region = new CylinderRegion(world); }
}
public CylinderRegionSelector(LocalWorld world) {
public CylinderRegionSelector(RegionSelector oldSelector) { region = new CylinderRegion(world);
this(oldSelector.getIncompleteRegion().getWorld()); }
if (oldSelector instanceof CylinderRegionSelector) {
final CylinderRegionSelector cylSelector = (CylinderRegionSelector) oldSelector; public CylinderRegionSelector(RegionSelector oldSelector) {
this(oldSelector.getIncompleteRegion().getWorld());
region = new CylinderRegion(cylSelector.region); if (oldSelector instanceof CylinderRegionSelector) {
} else { final CylinderRegionSelector cylSelector = (CylinderRegionSelector) oldSelector;
final Region oldRegion;
try { region = new CylinderRegion(cylSelector.region);
oldRegion = oldSelector.getRegion(); } else {
} catch (IncompleteRegionException e) { final Region oldRegion;
return; try {
} oldRegion = oldSelector.getRegion();
} catch (IncompleteRegionException e) {
Vector pos1 = oldRegion.getMinimumPoint(); return;
Vector pos2 = oldRegion.getMaximumPoint(); }
Vector center = pos1.add(pos2).divide(2).floor(); Vector pos1 = oldRegion.getMinimumPoint();
region.setCenter(center.toVector2D()); Vector pos2 = oldRegion.getMaximumPoint();
region.setRadius(pos2.toVector2D().subtract(center.toVector2D()));
Vector center = pos1.add(pos2).divide(2).floor();
region.setMaximumY(Math.max(pos1.getBlockY(), pos2.getBlockY())); region.setCenter(center.toVector2D());
region.setMinimumY(Math.min(pos1.getBlockY(), pos2.getBlockY())); region.setRadius(pos2.toVector2D().subtract(center.toVector2D()));
}
} region.setMaximumY(Math.max(pos1.getBlockY(), pos2.getBlockY()));
region.setMinimumY(Math.min(pos1.getBlockY(), pos2.getBlockY()));
public CylinderRegionSelector(LocalWorld world, Vector2D center, Vector2D radius, int minY, int maxY) { }
this(world); }
region.setCenter(center); public CylinderRegionSelector(LocalWorld world, Vector2D center, Vector2D radius, int minY, int maxY) {
region.setRadius(radius); this(world);
region.setMinimumY(Math.min(minY, maxY)); region.setCenter(center);
region.setMaximumY(Math.max(minY, maxY)); region.setRadius(radius);
}
region.setMinimumY(Math.min(minY, maxY));
public boolean selectPrimary(Vector pos) { region.setMaximumY(Math.max(minY, maxY));
if (!region.getCenter().equals(Vector.ZERO) && pos.compareTo(region.getCenter()) == 0) { }
return false;
} public boolean selectPrimary(Vector pos) {
if (!region.getCenter().equals(Vector.ZERO) && pos.compareTo(region.getCenter()) == 0) {
region = new CylinderRegion(region.getWorld()); return false;
region.setCenter(pos.toVector2D()); }
region.setY(pos.getBlockY());
region = new CylinderRegion(region.getWorld());
return true; region.setCenter(pos.toVector2D());
} region.setY(pos.getBlockY());
public boolean selectSecondary(Vector pos) { return true;
Vector center = region.getCenter(); }
if ((center.compareTo(Vector.ZERO)) == 0) {
return true; public boolean selectSecondary(Vector pos) {
} Vector center = region.getCenter();
if ((center.compareTo(Vector.ZERO)) == 0) {
final Vector2D diff = pos.subtract(center).toVector2D(); return true;
final Vector2D minRadius = Vector2D.getMaximum(diff, diff.multiply(-1.0)); }
region.extendRadius(minRadius);
final Vector2D diff = pos.subtract(center).toVector2D();
region.setY(pos.getBlockY()); final Vector2D minRadius = Vector2D.getMaximum(diff, diff.multiply(-1.0));
region.extendRadius(minRadius);
return true;
} region.setY(pos.getBlockY());
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) { return true;
player.print("Starting a new cylindrical selection at " + pos + "."); }
session.describeCUI(player); public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) {
} player.print("Starting a new cylindrical selection at " + pos + ".");
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) { session.describeCUI(player);
Vector center = region.getCenter(); }
if (!center.equals(Vector.ZERO)) {
player.print("Radius set to " + format.format(region.getRadius().getX()) + "/" + format.format(region.getRadius().getZ()) + " blocks. (" + region.getArea() + ")."); public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
} else { Vector center = region.getCenter();
player.printError("You must select the center point before setting the radius."); if (!center.equals(Vector.ZERO)) {
return; 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.");
session.describeCUI(player); return;
} }
public void explainRegionAdjust(LocalPlayer player, LocalSession session) { session.describeCUI(player);
session.describeCUI(player); }
}
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
public BlockVector getPrimaryPosition() throws IncompleteRegionException { session.describeCUI(player);
if (!isDefined()) { }
throw new IncompleteRegionException();
} public BlockVector getPrimaryPosition() throws IncompleteRegionException {
if (!isDefined()) {
return region.getCenter().toBlockVector(); throw new IncompleteRegionException();
} }
public CylinderRegion getRegion() throws IncompleteRegionException { return region.getCenter().toBlockVector();
if (!isDefined()) { }
throw new IncompleteRegionException();
} public CylinderRegion getRegion() throws IncompleteRegionException {
if (!isDefined()) {
return region; throw new IncompleteRegionException();
} }
public CylinderRegion getIncompleteRegion() { return region;
return region; }
}
public CylinderRegion getIncompleteRegion() {
public boolean isDefined() { return region;
return !region.getRadius().equals(Vector2D.ZERO); }
}
public boolean isDefined() {
public void learnChanges() { return !region.getRadius().equals(Vector2D.ZERO);
} }
public void clear() { public void learnChanges() {
region = new CylinderRegion(region.getWorld()); }
}
public void clear() {
public String getTypeName() { region = new CylinderRegion(region.getWorld());
return "Cylinder"; }
}
public String getTypeName() {
public List<String> getInformationLines() { return "Cylinder";
final List<String> lines = new ArrayList<String>(); }
if (!region.getCenter().equals(Vector.ZERO)) { public List<String> getInformationLines() {
lines.add("Center: " + region.getCenter()); final List<String> lines = new ArrayList<String>();
}
if (!region.getRadius().equals(Vector2D.ZERO)) { if (!region.getCenter().equals(Vector.ZERO)) {
lines.add("Radius: " + region.getRadius()); lines.add("Center: " + region.getCenter());
} }
if (!region.getRadius().equals(Vector2D.ZERO)) {
return lines; lines.add("Radius: " + region.getRadius());
} }
public int getArea() { return lines;
return region.getArea(); }
}
public int getArea() {
public void describeCUI(LocalSession session, LocalPlayer player) { return region.getArea();
session.dispatchCUIEvent(player, new SelectionCylinderEvent(region.getCenter(), region.getRadius())); }
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMinimumY(), region.getMaximumY()));
} public void describeCUI(LocalSession session, LocalPlayer player) {
session.dispatchCUIEvent(player, new SelectionCylinderEvent(region.getCenter(), region.getRadius()));
public void describeLegacyCUI(LocalSession session, LocalPlayer player) { session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMinimumY(), region.getMaximumY()));
if (isDefined()) { }
session.dispatchCUIEvent(player, new SelectionPointEvent(0, region.getMinimumPoint(), getArea()));
session.dispatchCUIEvent(player, new SelectionPointEvent(1, region.getMaximumPoint(), getArea())); public void describeLegacyCUI(LocalSession session, LocalPlayer player) {
} else { if (isDefined()) {
session.dispatchCUIEvent(player, new SelectionShapeEvent(getLegacyTypeID())); session.dispatchCUIEvent(player, new SelectionPointEvent(0, region.getMinimumPoint(), getArea()));
} session.dispatchCUIEvent(player, new SelectionPointEvent(1, region.getMaximumPoint(), getArea()));
} } else {
session.dispatchCUIEvent(player, new SelectionShapeEvent(getLegacyTypeID()));
public int getProtocolVersion() { }
return 1; }
}
public int getProtocolVersion() {
public String getTypeID() { return 1;
return "cylinder"; }
}
public String getTypeID() {
public String getLegacyTypeID() { return "cylinder";
return "cuboid"; }
}
} public String getLegacyTypeID() {
return "cuboid";
}
}

Datei anzeigen

@ -1,195 +1,197 @@
// $Id$ // $Id$
/* /*
* WorldEdit * WorldEdit
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors * Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldedit.regions; package com.sk89q.worldedit.regions.selector;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalPlayer; import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.CUIRegion;
import com.sk89q.worldedit.internal.cui.SelectionEllipsoidPointEvent; import com.sk89q.worldedit.internal.cui.SelectionEllipsoidPointEvent;
import com.sk89q.worldedit.internal.cui.SelectionPointEvent; import com.sk89q.worldedit.internal.cui.SelectionPointEvent;
import com.sk89q.worldedit.regions.EllipsoidRegion;
/** import com.sk89q.worldedit.regions.Region;
* Selector for ellipsoids.
* /**
* @author TomyLobo * Selector for ellipsoids.
*/ *
public class EllipsoidRegionSelector implements RegionSelector, CUIRegion { * @author TomyLobo
protected EllipsoidRegion region; */
public class EllipsoidRegionSelector implements RegionSelector, CUIRegion {
public EllipsoidRegionSelector(LocalWorld world) { protected EllipsoidRegion region;
region = new EllipsoidRegion(world, new Vector(), new Vector());
} public EllipsoidRegionSelector(LocalWorld world) {
region = new EllipsoidRegion(world, new Vector(), new Vector());
public EllipsoidRegionSelector() { }
this((LocalWorld) null);
} public EllipsoidRegionSelector() {
this((LocalWorld) null);
public EllipsoidRegionSelector(RegionSelector oldSelector) { }
this(oldSelector.getIncompleteRegion().getWorld());
if (oldSelector instanceof EllipsoidRegionSelector) { public EllipsoidRegionSelector(RegionSelector oldSelector) {
final EllipsoidRegionSelector ellipsoidRegionSelector = (EllipsoidRegionSelector) oldSelector; this(oldSelector.getIncompleteRegion().getWorld());
if (oldSelector instanceof EllipsoidRegionSelector) {
region = new EllipsoidRegion(ellipsoidRegionSelector.getIncompleteRegion()); final EllipsoidRegionSelector ellipsoidRegionSelector = (EllipsoidRegionSelector) oldSelector;
} else {
Region oldRegion = null; region = new EllipsoidRegion(ellipsoidRegionSelector.getIncompleteRegion());
try { } else {
oldRegion = oldSelector.getRegion(); Region oldRegion = null;
} catch (IncompleteRegionException e) { try {
return; oldRegion = oldSelector.getRegion();
} } catch (IncompleteRegionException e) {
return;
BlockVector pos1 = oldRegion.getMinimumPoint().toBlockVector(); }
BlockVector pos2 = oldRegion.getMaximumPoint().toBlockVector();
BlockVector pos1 = oldRegion.getMinimumPoint().toBlockVector();
Vector center = pos1.add(pos2).divide(2).floor(); BlockVector pos2 = oldRegion.getMaximumPoint().toBlockVector();
region.setCenter(center);
region.setRadius(pos2.subtract(center)); Vector center = pos1.add(pos2).divide(2).floor();
} region.setCenter(center);
} region.setRadius(pos2.subtract(center));
}
public EllipsoidRegionSelector(LocalWorld world, Vector center, Vector radius) { }
this(world);
public EllipsoidRegionSelector(LocalWorld world, Vector center, Vector radius) {
region.setCenter(center); this(world);
region.setRadius(radius);
} region.setCenter(center);
region.setRadius(radius);
public boolean selectPrimary(Vector pos) { }
if (pos.equals(region.getCenter()) && region.getRadius().lengthSq() == 0) {
return false; public boolean selectPrimary(Vector pos) {
} if (pos.equals(region.getCenter()) && region.getRadius().lengthSq() == 0) {
return false;
region.setCenter(pos.toBlockVector()); }
region.setRadius(new Vector());
return true; region.setCenter(pos.toBlockVector());
} region.setRadius(new Vector());
return true;
public boolean selectSecondary(Vector pos) { }
final Vector diff = pos.subtract(region.getCenter());
final Vector minRadius = Vector.getMaximum(diff, diff.multiply(-1.0)); public boolean selectSecondary(Vector pos) {
region.extendRadius(minRadius); final Vector diff = pos.subtract(region.getCenter());
return true; final Vector minRadius = Vector.getMaximum(diff, diff.multiply(-1.0));
} region.extendRadius(minRadius);
return true;
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) { }
if (isDefined()) {
player.print("Center position set to " + region.getCenter() + " (" + region.getArea() + ")."); public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) {
} else { if (isDefined()) {
player.print("Center position set to " + region.getCenter() + "."); player.print("Center position set to " + region.getCenter() + " (" + region.getArea() + ").");
} } else {
player.print("Center position set to " + region.getCenter() + ".");
session.describeCUI(player); }
}
session.describeCUI(player);
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) { }
if (isDefined()) {
player.print("Radius set to " + region.getRadius() + " (" + region.getArea() + ")."); public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
} else { if (isDefined()) {
player.print("Radius set to " + region.getRadius() + "."); player.print("Radius set to " + region.getRadius() + " (" + region.getArea() + ").");
} } else {
player.print("Radius set to " + region.getRadius() + ".");
session.describeCUI(player); }
}
session.describeCUI(player);
public void explainRegionAdjust(LocalPlayer player, LocalSession session) { }
session.describeCUI(player);
} public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
session.describeCUI(player);
public boolean isDefined() { }
return region.getRadius().lengthSq() > 0;
} public boolean isDefined() {
return region.getRadius().lengthSq() > 0;
public EllipsoidRegion getRegion() throws IncompleteRegionException { }
if (!isDefined()) {
throw new IncompleteRegionException(); public EllipsoidRegion getRegion() throws IncompleteRegionException {
} if (!isDefined()) {
throw new IncompleteRegionException();
return region; }
}
return region;
public EllipsoidRegion getIncompleteRegion() { }
return region;
} public EllipsoidRegion getIncompleteRegion() {
return region;
public void learnChanges() { }
}
public void learnChanges() {
public void clear() { }
region.setCenter(new Vector());
region.setRadius(new Vector()); public void clear() {
} region.setCenter(new Vector());
region.setRadius(new Vector());
public String getTypeName() { }
return "ellipsoid";
} public String getTypeName() {
return "ellipsoid";
public List<String> getInformationLines() { }
final List<String> lines = new ArrayList<String>();
public List<String> getInformationLines() {
final Vector center = region.getCenter(); final List<String> lines = new ArrayList<String>();
if (center.lengthSq() > 0) {
lines.add("Center: " + center); final Vector center = region.getCenter();
} if (center.lengthSq() > 0) {
lines.add("Center: " + center);
final Vector radius = region.getRadius(); }
if (radius.lengthSq() > 0) {
lines.add("X/Y/Z radius: " + radius); final Vector radius = region.getRadius();
} if (radius.lengthSq() > 0) {
lines.add("X/Y/Z radius: " + radius);
return lines; }
}
return lines;
public int getArea() { }
return region.getArea();
} public int getArea() {
return region.getArea();
public void describeCUI(LocalSession session, LocalPlayer player) { }
session.dispatchCUIEvent(player, new SelectionEllipsoidPointEvent(0, region.getCenter()));
session.dispatchCUIEvent(player, new SelectionEllipsoidPointEvent(1, region.getRadius())); public void describeCUI(LocalSession session, LocalPlayer player) {
} session.dispatchCUIEvent(player, new SelectionEllipsoidPointEvent(0, region.getCenter()));
session.dispatchCUIEvent(player, new SelectionEllipsoidPointEvent(1, region.getRadius()));
public void describeLegacyCUI(LocalSession session, LocalPlayer player) { }
session.dispatchCUIEvent(player, new SelectionPointEvent(0, region.getMinimumPoint(), getArea()));
session.dispatchCUIEvent(player, new SelectionPointEvent(1, region.getMaximumPoint(), getArea())); public void describeLegacyCUI(LocalSession session, LocalPlayer player) {
} session.dispatchCUIEvent(player, new SelectionPointEvent(0, region.getMinimumPoint(), getArea()));
session.dispatchCUIEvent(player, new SelectionPointEvent(1, region.getMaximumPoint(), getArea()));
public String getLegacyTypeID() { }
return "cuboid";
} public String getLegacyTypeID() {
return "cuboid";
public int getProtocolVersion() { }
return 1;
} public int getProtocolVersion() {
return 1;
public String getTypeID() { }
return "ellipsoid";
} public String getTypeID() {
return "ellipsoid";
@Override }
public BlockVector getPrimaryPosition() throws IncompleteRegionException {
return region.getCenter().toBlockVector(); @Override
} public BlockVector getPrimaryPosition() throws IncompleteRegionException {
} return region.getCenter().toBlockVector();
}
}

Datei anzeigen

@ -1,116 +1,116 @@
// $Id$ // $Id$
/* /*
* WorldEdit * WorldEdit
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors * Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldedit.regions; package com.sk89q.worldedit.regions.selector;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.LocalPlayer; import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
/** /**
* Alternative selector for cuboids. * Alternative selector for cuboids.
* *
* @author sk89q * @author sk89q
*/ */
public class ExtendingCuboidRegionSelector extends CuboidRegionSelector { public class ExtendingCuboidRegionSelector extends CuboidRegionSelector {
public ExtendingCuboidRegionSelector(LocalWorld world) { public ExtendingCuboidRegionSelector(LocalWorld world) {
super(world); super(world);
} }
public ExtendingCuboidRegionSelector(RegionSelector oldSelector) { public ExtendingCuboidRegionSelector(RegionSelector oldSelector) {
super(oldSelector); super(oldSelector);
if (pos1 == null || pos2 == null) { if (pos1 == null || pos2 == null) {
return; return;
} }
pos1 = region.getMinimumPoint().toBlockVector(); pos1 = region.getMinimumPoint().toBlockVector();
pos2 = region.getMaximumPoint().toBlockVector(); pos2 = region.getMaximumPoint().toBlockVector();
region.setPos1(pos1); region.setPos1(pos1);
region.setPos2(pos2); region.setPos2(pos2);
} }
public ExtendingCuboidRegionSelector(LocalWorld world, Vector pos1, Vector pos2) { public ExtendingCuboidRegionSelector(LocalWorld world, Vector pos1, Vector pos2) {
this(world); this(world);
pos1 = Vector.getMinimum(pos1, pos2); pos1 = Vector.getMinimum(pos1, pos2);
pos2 = Vector.getMaximum(pos1, pos2); pos2 = Vector.getMaximum(pos1, pos2);
region.setPos1(pos1); region.setPos1(pos1);
region.setPos2(pos2); region.setPos2(pos2);
} }
@Override @Override
public boolean selectPrimary(Vector pos) { public boolean selectPrimary(Vector pos) {
if (pos1 != null && pos2 != null && pos.compareTo(pos1) == 0 && pos.compareTo(pos2) == 0) { if (pos1 != null && pos2 != null && pos.compareTo(pos1) == 0 && pos.compareTo(pos2) == 0) {
return false; return false;
} }
pos1 = pos2 = pos.toBlockVector(); pos1 = pos2 = pos.toBlockVector();
region.setPos1(pos1); region.setPos1(pos1);
region.setPos2(pos2); region.setPos2(pos2);
return true; return true;
} }
@Override @Override
public boolean selectSecondary(Vector pos) { public boolean selectSecondary(Vector pos) {
if (pos1 == null || pos2 == null) { if (pos1 == null || pos2 == null) {
return selectPrimary(pos); return selectPrimary(pos);
} }
if (region.contains(pos)) { if (region.contains(pos)) {
return false; return false;
} }
double x1 = Math.min(pos.getX(), pos1.getX()); double x1 = Math.min(pos.getX(), pos1.getX());
double y1 = Math.min(pos.getY(), pos1.getY()); double y1 = Math.min(pos.getY(), pos1.getY());
double z1 = Math.min(pos.getZ(), pos1.getZ()); double z1 = Math.min(pos.getZ(), pos1.getZ());
double x2 = Math.max(pos.getX(), pos2.getX()); double x2 = Math.max(pos.getX(), pos2.getX());
double y2 = Math.max(pos.getY(), pos2.getY()); double y2 = Math.max(pos.getY(), pos2.getY());
double z2 = Math.max(pos.getZ(), pos2.getZ()); double z2 = Math.max(pos.getZ(), pos2.getZ());
final BlockVector o1 = pos1; final BlockVector o1 = pos1;
final BlockVector o2 = pos2; final BlockVector o2 = pos2;
pos1 = new BlockVector(x1, y1, z1); pos1 = new BlockVector(x1, y1, z1);
pos2 = new BlockVector(x2, y2, z2); pos2 = new BlockVector(x2, y2, z2);
region.setPos1(pos1); region.setPos1(pos1);
region.setPos2(pos2); region.setPos2(pos2);
assert(region.contains(o1)); assert(region.contains(o1));
assert(region.contains(o2)); assert(region.contains(o2));
assert(region.contains(pos)); assert(region.contains(pos));
return true; return true;
} }
@Override @Override
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) { public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) {
player.print("Started selection at " + pos + " (" + region.getArea() + ")."); player.print("Started selection at " + pos + " (" + region.getArea() + ").");
explainRegionAdjust(player, session); explainRegionAdjust(player, session);
} }
@Override @Override
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) { public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
player.print("Extended selection to encompass " + pos + " (" + region.getArea() + ")."); player.print("Extended selection to encompass " + pos + " (" + region.getArea() + ").");
explainRegionAdjust(player, session); explainRegionAdjust(player, session);
} }
} }

Datei anzeigen

@ -1,219 +1,221 @@
// $Id$ // $Id$
/* /*
* WorldEdit * WorldEdit
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors * Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldedit.regions; package com.sk89q.worldedit.regions.selector;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.BlockVector2D;
import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalPlayer; import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.CUIRegion;
import com.sk89q.worldedit.internal.cui.SelectionMinMaxEvent; import com.sk89q.worldedit.internal.cui.SelectionMinMaxEvent;
import com.sk89q.worldedit.internal.cui.SelectionPoint2DEvent; import com.sk89q.worldedit.internal.cui.SelectionPoint2DEvent;
import com.sk89q.worldedit.internal.cui.SelectionShapeEvent; import com.sk89q.worldedit.internal.cui.SelectionShapeEvent;
import com.sk89q.worldedit.regions.Polygonal2DRegion;
/** import com.sk89q.worldedit.regions.Region;
* Selector for polygonal regions.
* /**
* @author sk89q * Selector for polygonal regions.
*/ *
public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion { * @author sk89q
private int maxPoints; */
private BlockVector pos1; public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion {
private Polygonal2DRegion region; private int maxPoints;
private BlockVector pos1;
@Deprecated private Polygonal2DRegion region;
public Polygonal2DRegionSelector(LocalWorld world) {
this(world, 50); @Deprecated
} public Polygonal2DRegionSelector(LocalWorld world) {
this(world, 50);
public Polygonal2DRegionSelector(LocalWorld world, int maxPoints) { }
this.maxPoints = maxPoints;
region = new Polygonal2DRegion(world); public Polygonal2DRegionSelector(LocalWorld world, int maxPoints) {
} this.maxPoints = maxPoints;
region = new Polygonal2DRegion(world);
@Deprecated }
public Polygonal2DRegionSelector(RegionSelector oldSelector) {
this(oldSelector, 50); @Deprecated
} public Polygonal2DRegionSelector(RegionSelector oldSelector) {
this(oldSelector, 50);
public Polygonal2DRegionSelector(RegionSelector oldSelector, int maxPoints) { }
this(oldSelector.getIncompleteRegion().getWorld(), maxPoints);
if (oldSelector instanceof Polygonal2DRegionSelector) { public Polygonal2DRegionSelector(RegionSelector oldSelector, int maxPoints) {
final Polygonal2DRegionSelector polygonal2DRegionSelector = (Polygonal2DRegionSelector) oldSelector; this(oldSelector.getIncompleteRegion().getWorld(), maxPoints);
if (oldSelector instanceof Polygonal2DRegionSelector) {
pos1 = polygonal2DRegionSelector.pos1; final Polygonal2DRegionSelector polygonal2DRegionSelector = (Polygonal2DRegionSelector) oldSelector;
region = new Polygonal2DRegion(polygonal2DRegionSelector.region);
} else { pos1 = polygonal2DRegionSelector.pos1;
final Region oldRegion; region = new Polygonal2DRegion(polygonal2DRegionSelector.region);
try { } else {
oldRegion = oldSelector.getRegion(); final Region oldRegion;
} catch (IncompleteRegionException e) { try {
return; oldRegion = oldSelector.getRegion();
} } catch (IncompleteRegionException e) {
return;
final int minY = oldRegion.getMinimumPoint().getBlockY(); }
final int maxY = oldRegion.getMaximumPoint().getBlockY();
final int minY = oldRegion.getMinimumPoint().getBlockY();
List<BlockVector2D> points = oldRegion.polygonize(maxPoints); final int maxY = oldRegion.getMaximumPoint().getBlockY();
pos1 = points.get(0).toVector(minY).toBlockVector(); List<BlockVector2D> points = oldRegion.polygonize(maxPoints);
region = new Polygonal2DRegion(oldRegion.getWorld(), points, minY, maxY);
} pos1 = points.get(0).toVector(minY).toBlockVector();
} region = new Polygonal2DRegion(oldRegion.getWorld(), points, minY, maxY);
}
public Polygonal2DRegionSelector(LocalWorld world, List<BlockVector2D> points, int minY, int maxY) { }
final BlockVector2D pos2D = points.get(0);
pos1 = new BlockVector(pos2D.getX(), minY, pos2D.getZ()); public Polygonal2DRegionSelector(LocalWorld world, List<BlockVector2D> points, int minY, int maxY) {
region = new Polygonal2DRegion(world, points, minY, maxY); final BlockVector2D pos2D = points.get(0);
} pos1 = new BlockVector(pos2D.getX(), minY, pos2D.getZ());
region = new Polygonal2DRegion(world, points, minY, maxY);
public boolean selectPrimary(Vector pos) { }
if (pos.equals(pos1)) {
return false; public boolean selectPrimary(Vector pos) {
} if (pos.equals(pos1)) {
return false;
pos1 = pos.toBlockVector(); }
region = new Polygonal2DRegion(region.getWorld());
region.addPoint(pos); pos1 = pos.toBlockVector();
region.expandY(pos.getBlockY()); region = new Polygonal2DRegion(region.getWorld());
region.addPoint(pos);
return true; region.expandY(pos.getBlockY());
}
return true;
public boolean selectSecondary(Vector pos) { }
if (region.size() > 0) {
final List<BlockVector2D> points = region.getPoints(); public boolean selectSecondary(Vector pos) {
if (region.size() > 0) {
final BlockVector2D lastPoint = points.get(region.size() - 1); final List<BlockVector2D> points = region.getPoints();
if (lastPoint.getBlockX() == pos.getBlockX() && lastPoint.getBlockZ() == pos.getBlockZ()) {
return false; final BlockVector2D lastPoint = points.get(region.size() - 1);
} if (lastPoint.getBlockX() == pos.getBlockX() && lastPoint.getBlockZ() == pos.getBlockZ()) {
return false;
if (maxPoints >= 0 && points.size() > maxPoints) { }
return false;
} if (maxPoints >= 0 && points.size() > maxPoints) {
} return false;
}
region.addPoint(pos); }
region.expandY(pos.getBlockY());
region.addPoint(pos);
return true; region.expandY(pos.getBlockY());
}
return true;
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) { }
player.print("Starting a new polygon at " + pos + ".");
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) {
session.dispatchCUIEvent(player, new SelectionShapeEvent(getTypeID())); player.print("Starting a new polygon at " + pos + ".");
session.dispatchCUIEvent(player, new SelectionPoint2DEvent(0, pos, getArea()));
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMinimumY(), region.getMaximumY())); session.dispatchCUIEvent(player, new SelectionShapeEvent(getTypeID()));
} session.dispatchCUIEvent(player, new SelectionPoint2DEvent(0, pos, getArea()));
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMinimumY(), region.getMaximumY()));
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) { }
player.print("Added point #" + region.size() + " at " + pos + ".");
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
session.dispatchCUIEvent(player, new SelectionPoint2DEvent(region.size() - 1, pos, getArea())); player.print("Added point #" + region.size() + " at " + pos + ".");
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMinimumY(), region.getMaximumY()));
} session.dispatchCUIEvent(player, new SelectionPoint2DEvent(region.size() - 1, pos, getArea()));
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMinimumY(), region.getMaximumY()));
public void explainRegionAdjust(LocalPlayer player, LocalSession session) { }
session.dispatchCUIEvent(player, new SelectionShapeEvent(getTypeID()));
describeCUI(session, player); public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
} session.dispatchCUIEvent(player, new SelectionShapeEvent(getTypeID()));
describeCUI(session, player);
public BlockVector getPrimaryPosition() throws IncompleteRegionException { }
if (pos1 == null) {
throw new IncompleteRegionException(); public BlockVector getPrimaryPosition() throws IncompleteRegionException {
} if (pos1 == null) {
throw new IncompleteRegionException();
return pos1; }
}
return pos1;
public Polygonal2DRegion getRegion() throws IncompleteRegionException { }
if (!isDefined()) {
throw new IncompleteRegionException(); public Polygonal2DRegion getRegion() throws IncompleteRegionException {
} if (!isDefined()) {
throw new IncompleteRegionException();
return region; }
}
return region;
public Polygonal2DRegion getIncompleteRegion() { }
return region;
} public Polygonal2DRegion getIncompleteRegion() {
return region;
public boolean isDefined() { }
return region.size() > 2;
} public boolean isDefined() {
return region.size() > 2;
public void learnChanges() { }
BlockVector2D pt = region.getPoints().get(0);
pos1 = new BlockVector(pt.getBlockX(), region.getMinimumPoint().getBlockY(), pt.getBlockZ()); public void learnChanges() {
} BlockVector2D pt = region.getPoints().get(0);
pos1 = new BlockVector(pt.getBlockX(), region.getMinimumPoint().getBlockY(), pt.getBlockZ());
public void clear() { }
pos1 = null;
region = new Polygonal2DRegion(region.getWorld()); public void clear() {
} pos1 = null;
region = new Polygonal2DRegion(region.getWorld());
public String getTypeName() { }
return "2Dx1D polygon";
} public String getTypeName() {
return "2Dx1D polygon";
public List<String> getInformationLines() { }
return Collections.singletonList("# points: " + region.size());
} public List<String> getInformationLines() {
return Collections.singletonList("# points: " + region.size());
public int getArea() { }
return region.getArea();
} public int getArea() {
return region.getArea();
public int getPointCount() { }
return region.getPoints().size();
} public int getPointCount() {
return region.getPoints().size();
public void describeCUI(LocalSession session, LocalPlayer player) { }
final List<BlockVector2D> points = region.getPoints();
for (int id = 0; id < points.size(); id++) { public void describeCUI(LocalSession session, LocalPlayer player) {
session.dispatchCUIEvent(player, new SelectionPoint2DEvent(id, points.get(id), getArea())); final List<BlockVector2D> points = region.getPoints();
} for (int id = 0; id < points.size(); id++) {
session.dispatchCUIEvent(player, new SelectionPoint2DEvent(id, points.get(id), getArea()));
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMinimumY(), region.getMaximumY())); }
}
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMinimumY(), region.getMaximumY()));
public void describeLegacyCUI(LocalSession session, LocalPlayer player) { }
describeCUI(session, player);
} public void describeLegacyCUI(LocalSession session, LocalPlayer player) {
describeCUI(session, player);
public int getProtocolVersion() { }
return 0;
} public int getProtocolVersion() {
return 0;
public String getTypeID() { }
return "polygon2d";
} public String getTypeID() {
return "polygon2d";
public String getLegacyTypeID() { }
return "polygon2d";
} public String getLegacyTypeID() {
} return "polygon2d";
}
}

Datei anzeigen

@ -1,140 +1,138 @@
// $Id$ // $Id$
/* /*
* WorldEdit * WorldEdit
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors * Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldedit.regions; package com.sk89q.worldedit.regions.selector;
import java.util.List; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.LocalPlayer; import java.util.List;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.Vector; /**
* Region selection factory.
/** *
* Region selection factory. * @author sk89q
* */
* @author sk89q public interface RegionSelector {
*/ /**
public interface RegionSelector { * Called when the first point is selected.
/** *
* Called when the first point is selected. * @param pos
* * @return true if something changed
* @param pos */
* @return true if something changed public boolean selectPrimary(Vector pos);
*/
public boolean selectPrimary(Vector pos); /**
* Called when the second point is selected.
/** *
* Called when the second point is selected. * @param pos
* * @return true if something changed
* @param pos */
* @return true if something changed public boolean selectSecondary(Vector pos);
*/
public boolean selectSecondary(Vector pos); /**
* Tell the player information about his/her primary selection.
/** *
* Tell the player information about his/her primary selection. * @param player
* * @param session
* @param player * @param pos
* @param session */
* @param pos public void explainPrimarySelection(LocalPlayer player,
*/ LocalSession session, Vector pos);
public void explainPrimarySelection(LocalPlayer player,
LocalSession session, Vector pos); /**
* Tell the player information about his/her secondary selection.
/** *
* Tell the player information about his/her secondary selection. * @param player
* * @param session
* @param player * @param pos
* @param session */
* @param pos public void explainSecondarySelection(LocalPlayer player,
*/ LocalSession session, Vector pos);
public void explainSecondarySelection(LocalPlayer player,
LocalSession session, Vector pos); /**
* The the player information about the region's changes. This may resend
/** * all the defining region information if needed.
* The the player information about the region's changes. This may resend *
* all the defining region information if needed. * @param player
* * @param session
* @param player */
* @param session public void explainRegionAdjust(LocalPlayer player, LocalSession session);
*/
public void explainRegionAdjust(LocalPlayer player, LocalSession session); /**
* Get the primary position.
/** *
* Get the primary position. * @return
* * @throws IncompleteRegionException
* @return */
* @throws IncompleteRegionException public BlockVector getPrimaryPosition() throws IncompleteRegionException;
*/
public BlockVector getPrimaryPosition() throws IncompleteRegionException; /**
* Get the selection.
/** *
* Get the selection. * @return
* * @throws IncompleteRegionException
* @return */
* @throws IncompleteRegionException public Region getRegion() throws IncompleteRegionException;
*/
public Region getRegion() throws IncompleteRegionException; /**
* Get the region even if it's not fully defined.
/** *
* Get the region even if it's not fully defined. * @return
* */
* @return public Region getIncompleteRegion();
*/
public Region getIncompleteRegion(); /**
* Returns whether the region has been fully defined.
/** *
* Returns whether the region has been fully defined. * @return
* */
* @return public boolean isDefined();
*/
public boolean isDefined(); /**
* Get the number of blocks inside the region.
/** *
* Get the number of blocks inside the region. * @return number of blocks or -1 if undefined
* */
* @return number of blocks or -1 if undefined public int getArea();
*/
public int getArea(); /**
* Update the selector with changes to the region.
/** */
* Update the selector with changes to the region. public void learnChanges();
*/
public void learnChanges(); /**
* Clear the selection.
/** */
* Clear the selection. public void clear();
*/
public void clear(); /**
* Get a lowercase name of this region selector type.
/** *
* Get a lowercase name of this region selector type. * @return
* */
* @return public String getTypeName();
*/
public String getTypeName(); /**
* Get lines of information about the selection.
/** *
* Get lines of information about the selection. * @return
* */
* @return public List<String> getInformationLines();
*/ }
public List<String> getInformationLines();
}

Datei anzeigen

@ -1,75 +1,75 @@
// $Id$ // $Id$
/* /*
* WorldEdit * WorldEdit
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors * Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.sk89q.worldedit.regions; package com.sk89q.worldedit.regions.selector;
import com.sk89q.worldedit.LocalPlayer; import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
/** /**
* Selector for spheres. * Selector for spheres.
* *
* @author TomyLobo * @author TomyLobo
*/ */
public class SphereRegionSelector extends EllipsoidRegionSelector { public class SphereRegionSelector extends EllipsoidRegionSelector {
public SphereRegionSelector(LocalWorld world) { public SphereRegionSelector(LocalWorld world) {
super(world); super(world);
} }
public SphereRegionSelector() { public SphereRegionSelector() {
super(); super();
} }
public SphereRegionSelector(RegionSelector oldSelector) { public SphereRegionSelector(RegionSelector oldSelector) {
super(oldSelector); super(oldSelector);
final Vector radius = region.getRadius(); final Vector radius = region.getRadius();
final double radiusScalar = Math.max(Math.max(radius.getX(), radius.getY()), radius.getZ()); final double radiusScalar = Math.max(Math.max(radius.getX(), radius.getY()), radius.getZ());
region.setRadius(new Vector(radiusScalar, radiusScalar, radiusScalar)); region.setRadius(new Vector(radiusScalar, radiusScalar, radiusScalar));
} }
public SphereRegionSelector(LocalWorld world, Vector center, int radius) { public SphereRegionSelector(LocalWorld world, Vector center, int radius) {
super(world, center, new Vector(radius, radius, radius)); super(world, center, new Vector(radius, radius, radius));
} }
@Override @Override
public boolean selectSecondary(Vector pos) { public boolean selectSecondary(Vector pos) {
final double radiusScalar = Math.ceil(pos.distance(region.getCenter())); final double radiusScalar = Math.ceil(pos.distance(region.getCenter()));
region.setRadius(new Vector(radiusScalar, radiusScalar, radiusScalar)); region.setRadius(new Vector(radiusScalar, radiusScalar, radiusScalar));
return true; return true;
} }
@Override @Override
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) { public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
if (isDefined()) { if (isDefined()) {
player.print("Radius set to " + region.getRadius().getX() + " (" + region.getArea() + ")."); player.print("Radius set to " + region.getRadius().getX() + " (" + region.getArea() + ").");
} else { } else {
player.print("Radius set to " + region.getRadius().getX() + "."); player.print("Radius set to " + region.getRadius().getX() + ".");
} }
session.describeCUI(player); session.describeCUI(player);
} }
@Override @Override
public String getTypeName() { public String getTypeName() {
return "sphere"; return "sphere";
} }
} }

Datei anzeigen

@ -27,7 +27,7 @@ import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegion; import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
import com.sk89q.worldedit.spout.selections.CuboidSelection; import com.sk89q.worldedit.spout.selections.CuboidSelection;
import com.sk89q.worldedit.spout.selections.Polygonal2DSelection; import com.sk89q.worldedit.spout.selections.Polygonal2DSelection;
import com.sk89q.worldedit.spout.selections.Selection; import com.sk89q.worldedit.spout.selections.Selection;

Datei anzeigen

@ -24,8 +24,8 @@ package com.sk89q.worldedit.spout.selections;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.spout.SpoutUtil; import com.sk89q.worldedit.spout.SpoutUtil;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.CuboidRegionSelector; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
import org.spout.api.geo.World; import org.spout.api.geo.World;
import org.spout.api.geo.discrete.Point; import org.spout.api.geo.discrete.Point;

Datei anzeigen

@ -24,8 +24,8 @@ package com.sk89q.worldedit.spout.selections;
import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.BlockVector2D;
import com.sk89q.worldedit.LocalWorld; import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.regions.Polygonal2DRegion; import com.sk89q.worldedit.regions.Polygonal2DRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegionSelector; import com.sk89q.worldedit.regions.selector.Polygonal2DRegionSelector;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
import com.sk89q.worldedit.spout.SpoutUtil; import com.sk89q.worldedit.spout.SpoutUtil;
import org.spout.api.geo.World; import org.spout.api.geo.World;

Datei anzeigen

@ -23,7 +23,7 @@ package com.sk89q.worldedit.spout.selections;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
import com.sk89q.worldedit.spout.SpoutUtil; import com.sk89q.worldedit.spout.SpoutUtil;
import org.spout.api.geo.World; import org.spout.api.geo.World;
import org.spout.api.geo.discrete.Point; import org.spout.api.geo.discrete.Point;

Datei anzeigen

@ -22,7 +22,7 @@
package com.sk89q.worldedit.spout.selections; package com.sk89q.worldedit.spout.selections;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.RegionSelector;
import org.spout.api.geo.World; import org.spout.api.geo.World;
import org.spout.api.geo.discrete.Point; import org.spout.api.geo.discrete.Point;