Added a separate point maximum for polyhedral selections.

This commit is contained in:
TomyLobo 2013-08-16 08:16:37 +02:00
parent eb669ff834
commit 2a4e6ac93a
5 changed files with 20 additions and 1 deletions

View File

@ -84,6 +84,8 @@ public abstract class LocalConfiguration {
public int maxChangeLimit = -1;
public int defaultMaxPolygonalPoints = -1;
public int maxPolygonalPoints = 20;
public int defaultMaxPolyhedronPoints = -1;
public int maxPolyhedronPoints = 20;
public String shellSaveType = "";
public SnapshotRepository snapshotRepo = null;
public int maxRadius = -1;

View File

@ -905,6 +905,18 @@ public class WorldEdit {
}
}
public int getMaximumPolyhedronPoints(LocalPlayer player) {
if (player.hasPermission("worldedit.limit.unrestricted") || config.maxPolyhedronPoints < 0) {
return config.defaultMaxPolyhedronPoints;
} else {
if (config.defaultMaxPolyhedronPoints < 0) {
return config.maxPolyhedronPoints;
}
return Math.min(config.defaultMaxPolyhedronPoints,
config.maxPolyhedronPoints);
}
}
/**
* Checks to see if the specified radius is within bounds.
*

View File

@ -768,7 +768,7 @@ public class SelectionCommands {
selector = new CylinderRegionSelector(oldSelector);
player.print("Cylindrical selector: Left click=center, right click to extend.");
} else if (typeName.equalsIgnoreCase("convex") || typeName.equalsIgnoreCase("hull") || typeName.equalsIgnoreCase("polyhedron")) {
int maxVertices = we.getMaximumPolygonalPoints(player); // TODO: separate maximum for polyhedra
int maxVertices = we.getMaximumPolyhedronPoints(player);
selector = new ConvexPolyhedralRegionSelector(oldSelector, maxVertices);
player.print("Convex polyhedral selector: Left click=First vertex, right click to add more.");
} else {

View File

@ -83,6 +83,8 @@ public class PropertiesConfiguration extends LocalConfiguration {
maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit);
defaultMaxPolygonalPoints = getInt("default-max-polygon-points", defaultMaxPolygonalPoints);
maxPolygonalPoints = getInt("max-polygon-points", maxPolygonalPoints);
defaultMaxPolyhedronPoints = getInt("default-max-polyhedron-points", defaultMaxPolyhedronPoints);
maxPolyhedronPoints = getInt("max-polyhedron-points", maxPolyhedronPoints);
shellSaveType = getString("shell-save-type", shellSaveType);
maxRadius = getInt("max-radius", maxRadius);
maxSuperPickaxeSize = getInt("max-super-pickaxe-size", maxSuperPickaxeSize);

View File

@ -65,6 +65,9 @@ public class YAMLConfiguration extends LocalConfiguration {
maxPolygonalPoints = Math.max(-1,
config.getInt("limits.max-polygonal-points.maximum", maxPolygonalPoints));
defaultMaxPolyhedronPoints = Math.max(-1, config.getInt("limits.max-polyhedron-points.default", defaultMaxPolyhedronPoints));
maxPolyhedronPoints = Math.max(-1, config.getInt("limits.max-polyhedron-points.maximum", maxPolyhedronPoints));
maxRadius = Math.max(-1, config.getInt("limits.max-radius", maxRadius));
maxBrushRadius = config.getInt("limits.max-brush-radius", maxBrushRadius);
maxSuperPickaxeSize = Math.max(1, config.getInt(