Added a separate point maximum for polyhedral selections.

Dieser Commit ist enthalten in:
TomyLobo 2013-08-16 08:16:37 +02:00
Ursprung eb669ff834
Commit 2a4e6ac93a
5 geänderte Dateien mit 20 neuen und 1 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -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. * Checks to see if the specified radius is within bounds.
* *

Datei anzeigen

@ -768,7 +768,7 @@ public class SelectionCommands {
selector = new CylinderRegionSelector(oldSelector); selector = new CylinderRegionSelector(oldSelector);
player.print("Cylindrical selector: Left click=center, right click to extend."); player.print("Cylindrical selector: Left click=center, right click to extend.");
} else if (typeName.equalsIgnoreCase("convex") || typeName.equalsIgnoreCase("hull") || typeName.equalsIgnoreCase("polyhedron")) { } 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); selector = new ConvexPolyhedralRegionSelector(oldSelector, maxVertices);
player.print("Convex polyhedral selector: Left click=First vertex, right click to add more."); player.print("Convex polyhedral selector: Left click=First vertex, right click to add more.");
} else { } else {

Datei anzeigen

@ -83,6 +83,8 @@ public class PropertiesConfiguration extends LocalConfiguration {
maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit); maxChangeLimit = getInt("max-changed-blocks", maxChangeLimit);
defaultMaxPolygonalPoints = getInt("default-max-polygon-points", defaultMaxPolygonalPoints); defaultMaxPolygonalPoints = getInt("default-max-polygon-points", defaultMaxPolygonalPoints);
maxPolygonalPoints = getInt("max-polygon-points", maxPolygonalPoints); 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); shellSaveType = getString("shell-save-type", shellSaveType);
maxRadius = getInt("max-radius", maxRadius); maxRadius = getInt("max-radius", maxRadius);
maxSuperPickaxeSize = getInt("max-super-pickaxe-size", maxSuperPickaxeSize); maxSuperPickaxeSize = getInt("max-super-pickaxe-size", maxSuperPickaxeSize);

Datei anzeigen

@ -65,6 +65,9 @@ public class YAMLConfiguration extends LocalConfiguration {
maxPolygonalPoints = Math.max(-1, maxPolygonalPoints = Math.max(-1,
config.getInt("limits.max-polygonal-points.maximum", maxPolygonalPoints)); 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)); maxRadius = Math.max(-1, config.getInt("limits.max-radius", maxRadius));
maxBrushRadius = config.getInt("limits.max-brush-radius", maxBrushRadius); maxBrushRadius = config.getInt("limits.max-brush-radius", maxBrushRadius);
maxSuperPickaxeSize = Math.max(1, config.getInt( maxSuperPickaxeSize = Math.max(1, config.getInt(