geforkt von Mirrors/FastAsyncWorldEdit
fix #2349
Dieser Commit ist enthalten in:
Ursprung
c0e20a6fe5
Commit
0a19f643b6
@ -23,9 +23,11 @@ import com.sk89q.worldedit.world.World;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
@ -192,6 +194,10 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
maskedRegion = new RegionIntersection(world, weRegions);
|
||||
}
|
||||
|
||||
if (plot == null) {
|
||||
return new FaweMask(maskedRegion);
|
||||
}
|
||||
|
||||
return new PlotSquaredMask(maskedRegion, finalPlot);
|
||||
}
|
||||
|
||||
@ -201,9 +207,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
private final WeakReference<Set<Plot>> connectedPlots;
|
||||
private final boolean singlePlot;
|
||||
|
||||
private PlotSquaredMask(Region region, Plot plot) {
|
||||
private PlotSquaredMask(@Nonnull Region region, @Nonnull Plot plot) {
|
||||
super(region);
|
||||
this.plot = plot;
|
||||
this.plot = Objects.requireNonNull(plot);
|
||||
Set<Plot> connected = plot.getConnectedPlots();
|
||||
connectedPlots = new WeakReference<>(connected);
|
||||
singlePlot = connected.size() == 1;
|
||||
|
@ -4,12 +4,15 @@ import com.fastasyncworldedit.core.extent.processor.ProcessorScope;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Objects;
|
||||
|
||||
public class FaweMask implements IDelegateRegion {
|
||||
|
||||
private final Region region;
|
||||
|
||||
public FaweMask(Region region) {
|
||||
this.region = region;
|
||||
public FaweMask(@Nonnull Region region) {
|
||||
this.region = Objects.requireNonNull(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,12 +50,19 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.function.EntityFunction;
|
||||
import com.sk89q.worldedit.function.block.BlockReplace;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.mask.BoundedHeightMask;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.MaskIntersection;
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.mask.RegionMask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.DownwardVisitor;
|
||||
import com.sk89q.worldedit.function.visitor.EntityVisitor;
|
||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
||||
import com.sk89q.worldedit.internal.annotation.VertHeight;
|
||||
import com.sk89q.worldedit.internal.expression.EvaluationException;
|
||||
@ -63,8 +70,10 @@ import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector2;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.CylinderRegion;
|
||||
import com.sk89q.worldedit.regions.EllipsoidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.formatting.component.SubtleFormat;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
@ -836,6 +845,55 @@ public class UtilityCommands {
|
||||
}
|
||||
}
|
||||
|
||||
// @Command(
|
||||
// name = "/hollowr",
|
||||
// desc = "Hollow out a space recursively with a pattern"
|
||||
// )
|
||||
// @CommandPermissions("worldedit.hollowr")
|
||||
// @Logging(PLACEMENT)
|
||||
// public int hollowr(
|
||||
// Actor actor,
|
||||
// LocalSession session,
|
||||
// EditSession editSession,
|
||||
// @Arg(desc = "The radius to hollow out") Expression radiusExp,
|
||||
// @ArgFlag(name = 'p', desc = "The blocks to fill with") Pattern pattern,
|
||||
// @ArgFlag(name = 'm', desc = "The blocks remove", def = "") Mask mask
|
||||
// ) throws WorldEditException {
|
||||
// //FAWE start
|
||||
// double radius = radiusExp.evaluate();
|
||||
// //FAWE end
|
||||
// radius = Math.max(1, radius);
|
||||
// we.checkMaxRadius(radius);
|
||||
// if (mask == null) {
|
||||
// Mask mask = new MaskIntersection(
|
||||
// new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))),
|
||||
// new BoundedHeightMask(
|
||||
// Math.max(lowerBound, minY),
|
||||
// Math.min(maxY, origin.getBlockY())
|
||||
// ),
|
||||
// Masks.negate(new ExistingBlockMask(this))
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// // Want to replace blocks
|
||||
// BlockReplace replace = new BlockReplace(this, pattern);
|
||||
//
|
||||
// // Pick how we're going to visit blocks
|
||||
// RecursiveVisitor visitor;
|
||||
// //FAWE start - provide extent for preloading, min/max y
|
||||
// if (recursive) {
|
||||
// visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1), minY, maxY, this);
|
||||
// } else {
|
||||
// visitor = new DownwardVisitor(mask, replace, origin.getBlockY(), (int) (radius * 2 + 1), minY, maxY, this);
|
||||
// }
|
||||
// //FAWE end
|
||||
//
|
||||
// BlockVector3 pos = session.getPlacementPosition(actor);
|
||||
// int affected = editSession.res(pos, pattern, radius, depth, true);
|
||||
// actor.print(Caption.of("worldedit.fillr.created", TextComponent.of(affected)));
|
||||
// return affected;
|
||||
// }
|
||||
|
||||
public static List<Map.Entry<URI, String>> filesToEntry(final File root, final List<File> files, final UUID uuid) {
|
||||
return files.stream()
|
||||
.map(input -> { // Keep this functional, as transform is evaluated lazily
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren