Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-10 05:20:04 +01:00
Add config entries for polygonal region points limit
Dieser Commit ist enthalten in:
Ursprung
d2a72579ae
Commit
cd64ca459d
@ -82,6 +82,8 @@ public abstract class LocalConfiguration {
|
|||||||
public Set<Integer> disallowedBlocks = new HashSet<Integer>();
|
public Set<Integer> disallowedBlocks = new HashSet<Integer>();
|
||||||
public int defaultChangeLimit = -1;
|
public int defaultChangeLimit = -1;
|
||||||
public int maxChangeLimit = -1;
|
public int maxChangeLimit = -1;
|
||||||
|
public int defaultMaxPolygonalPoints = -1;
|
||||||
|
public int maxPolygonalPoints = 20;
|
||||||
public String shellSaveType = "";
|
public String shellSaveType = "";
|
||||||
public SnapshotRepository snapshotRepo = null;
|
public SnapshotRepository snapshotRepo = null;
|
||||||
public int maxRadius = -1;
|
public int maxRadius = -1;
|
||||||
|
@ -761,6 +761,18 @@ public class WorldEdit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMaximumPolygonalPoints(LocalPlayer player) {
|
||||||
|
if (player.hasPermission("worldedit.limit.unrestricted") || config.maxPolygonalPoints < 0) {
|
||||||
|
return config.defaultMaxPolygonalPoints;
|
||||||
|
} else {
|
||||||
|
if (config.defaultMaxPolygonalPoints < 0) {
|
||||||
|
return config.maxPolygonalPoints;
|
||||||
|
}
|
||||||
|
return Math.min(config.defaultMaxPolygonalPoints,
|
||||||
|
config.maxPolygonalPoints);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if the specified radius is within bounds.
|
* Checks to see if the specified radius is within bounds.
|
||||||
*
|
*
|
||||||
|
@ -609,8 +609,12 @@ public class SelectionCommands {
|
|||||||
selector = new ExtendingCuboidRegionSelector(oldSelector);
|
selector = new ExtendingCuboidRegionSelector(oldSelector);
|
||||||
player.print("Cuboid: left click for a starting point, right click to extend");
|
player.print("Cuboid: left click for a starting point, right click to extend");
|
||||||
} else if (typeName.equalsIgnoreCase("poly")) {
|
} else if (typeName.equalsIgnoreCase("poly")) {
|
||||||
selector = new Polygonal2DRegionSelector(oldSelector);
|
int maxPoints = we.getMaximumPolygonalPoints(player);
|
||||||
|
selector = new Polygonal2DRegionSelector(oldSelector, maxPoints);
|
||||||
player.print("2D polygon selector: Left/right click to add a point.");
|
player.print("2D polygon selector: Left/right click to add a point.");
|
||||||
|
if (maxPoints > -1) {
|
||||||
|
player.print(maxPoints + " points maximum.");
|
||||||
|
}
|
||||||
} else if (typeName.equalsIgnoreCase("ellipsoid")) {
|
} else if (typeName.equalsIgnoreCase("ellipsoid")) {
|
||||||
selector = new EllipsoidRegionSelector(oldSelector);
|
selector = new EllipsoidRegionSelector(oldSelector);
|
||||||
player.print("Ellipsoid selector: left click=center, right click to extend");
|
player.print("Ellipsoid selector: left click=center, right click to extend");
|
||||||
|
@ -40,15 +40,25 @@ import com.sk89q.worldedit.cui.SelectionShapeEvent;
|
|||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion {
|
public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion {
|
||||||
|
private int maxPoints;
|
||||||
private BlockVector pos1;
|
private BlockVector pos1;
|
||||||
private Polygonal2DRegion region;
|
private Polygonal2DRegion region;
|
||||||
|
|
||||||
public Polygonal2DRegionSelector(LocalWorld world) {
|
public Polygonal2DRegionSelector(LocalWorld world) {
|
||||||
|
this(world, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Polygonal2DRegionSelector(LocalWorld world, int maxPoints) {
|
||||||
|
this.maxPoints = maxPoints;
|
||||||
region = new Polygonal2DRegion(world);
|
region = new Polygonal2DRegion(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Polygonal2DRegionSelector(RegionSelector oldSelector) {
|
public Polygonal2DRegionSelector(RegionSelector oldSelector) {
|
||||||
this(oldSelector.getIncompleteRegion().getWorld());
|
this(oldSelector, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Polygonal2DRegionSelector(RegionSelector oldSelector, int maxPoints) {
|
||||||
|
this(oldSelector.getIncompleteRegion().getWorld(), maxPoints);
|
||||||
if (oldSelector instanceof Polygonal2DRegionSelector) {
|
if (oldSelector instanceof Polygonal2DRegionSelector) {
|
||||||
final Polygonal2DRegionSelector polygonal2DRegionSelector = (Polygonal2DRegionSelector) oldSelector;
|
final Polygonal2DRegionSelector polygonal2DRegionSelector = (Polygonal2DRegionSelector) oldSelector;
|
||||||
|
|
||||||
@ -108,7 +118,7 @@ public class Polygonal2DRegionSelector implements RegionSelector, CUIRegion {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (points.size() >= 20) {
|
if (maxPoints > -1 && points.size() >= maxPoints) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,10 @@ public class YAMLConfiguration extends LocalConfiguration {
|
|||||||
"limits.max-blocks-changed.default", defaultChangeLimit));
|
"limits.max-blocks-changed.default", defaultChangeLimit));
|
||||||
maxChangeLimit = Math.max(-1,
|
maxChangeLimit = Math.max(-1,
|
||||||
config.getInt("limits.max-blocks-changed.maximum", maxChangeLimit));
|
config.getInt("limits.max-blocks-changed.maximum", maxChangeLimit));
|
||||||
|
defaultMaxPolygonalPoints = Math.max(-1,
|
||||||
|
config.getInt("limits.max-polygonal-points.default", defaultMaxPolygonalPoints));
|
||||||
|
maxPolygonalPoints = Math.max(-1,
|
||||||
|
config.getInt("limits.max-polygonal-points.maximum", maxPolygonalPoints));
|
||||||
maxRadius = Math.max(-1, config.getInt("limits.max-radius", maxRadius));
|
maxRadius = Math.max(-1, config.getInt("limits.max-radius", maxRadius));
|
||||||
maxSuperPickaxeSize = Math.max(1, config.getInt(
|
maxSuperPickaxeSize = Math.max(1, config.getInt(
|
||||||
"limits.max-super-pickaxe-size", maxSuperPickaxeSize));
|
"limits.max-super-pickaxe-size", maxSuperPickaxeSize));
|
||||||
|
@ -19,6 +19,9 @@ limits:
|
|||||||
max-blocks-changed:
|
max-blocks-changed:
|
||||||
default: -1
|
default: -1
|
||||||
maximum: -1
|
maximum: -1
|
||||||
|
max-polygonal-points:
|
||||||
|
default: -1
|
||||||
|
maximum: 20
|
||||||
max-radius: -1
|
max-radius: -1
|
||||||
max-super-pickaxe-size: 5
|
max-super-pickaxe-size: 5
|
||||||
max-brush-radius: 5
|
max-brush-radius: 5
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren