mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Mainly formatting and some work on schematic commands
This commit is contained in:
@ -204,7 +204,7 @@ public class BrushCommands extends MethodCommands {
|
||||
public BrushSettings recursiveBrush(Player player, LocalSession session, EditSession editSession, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "5")
|
||||
Expression radius,
|
||||
@Switch(name='d', desc = "Apply in depth first order")
|
||||
@Switch(name = 'd', desc = "Apply in depth first order")
|
||||
boolean depthFirst,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
@ -224,11 +224,11 @@ public class BrushCommands extends MethodCommands {
|
||||
public BrushSettings lineBrush(Player player, LocalSession session, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "0")
|
||||
Expression radius,
|
||||
@Switch(name='h', desc = "Create only a shell")
|
||||
@Switch(name = 'h', desc = "Create only a shell")
|
||||
boolean shell,
|
||||
@Switch(name='s', desc = "Selects the clicked point after drawing")
|
||||
@Switch(name = 's', desc = "Selects the clicked point after drawing")
|
||||
boolean select,
|
||||
@Switch(name='f', desc = "Create a flat line")
|
||||
@Switch(name = 'f', desc = "Create a flat line")
|
||||
boolean flat, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
@ -279,14 +279,14 @@ public class BrushCommands extends MethodCommands {
|
||||
desc = "Create a hanging line between two points"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.spline")
|
||||
public BrushSettings catenaryBrush(LocalSession session, Pattern fill, @Arg(def = "1.2", desc = "Length of wire compared to distance between points") @Range(min=1) double lengthFactor,
|
||||
public BrushSettings catenaryBrush(LocalSession session, Pattern fill, @Arg(def = "1.2", desc = "Length of wire compared to distance between points") @Range(min = 1) double lengthFactor,
|
||||
@Arg(desc = "The radius to sample for blending", def = "0")
|
||||
Expression radius,
|
||||
@Switch(name='h', desc = "Create only a shell")
|
||||
@Switch(name = 'h', desc = "Create only a shell")
|
||||
boolean shell,
|
||||
@Switch(name='s', desc = "Select the clicked point after drawing")
|
||||
@Switch(name = 's', desc = "Select the clicked point after drawing")
|
||||
boolean select,
|
||||
@Switch(name='d', desc = "sags the catenary toward the facing direction")
|
||||
@Switch(name = 'd', desc = "sags the catenary toward the facing direction")
|
||||
boolean facingDirection,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
@ -403,10 +403,10 @@ public class BrushCommands extends MethodCommands {
|
||||
public BrushSettings stencilBrush(Player player, LocalSession session, Pattern fill,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||
@Arg(name = "image", desc = "String", def = "") String image,
|
||||
@Arg(def = "0", desc = "rotation") @Range(min=0, max=360) int rotation,
|
||||
@Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation,
|
||||
@Arg(name = "yscale", desc = "double", def = "1") double yscale,
|
||||
@Switch(name='w', desc = "Apply at maximum saturation") boolean onlyWhite,
|
||||
@Switch(name='r', desc = "Apply random rotation") boolean randomRotate,
|
||||
@Switch(name = 'w', desc = "Apply at maximum saturation") boolean onlyWhite,
|
||||
@Switch(name = 'r', desc = "Apply random rotation") boolean randomRotate,
|
||||
InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
InputStream stream = getHeightmapStream(image);
|
||||
@ -433,9 +433,9 @@ public class BrushCommands extends MethodCommands {
|
||||
@CommandPermissions("worldedit.brush.stencil")
|
||||
public BrushSettings imageBrush(LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||
ProvideBindings.ImageUri imageUri,
|
||||
@Arg(def = "1", desc = "scale height") @Range(min=Double.MIN_NORMAL) double yscale,
|
||||
@Switch(name='a', desc = "Use image Alpha") boolean alpha,
|
||||
@Switch(name='f', desc = "Blend the image with existing terrain") boolean fadeOut,
|
||||
@Arg(def = "1", desc = "scale height") @Range(min = Double.MIN_NORMAL) double yscale,
|
||||
@Switch(name = 'a', desc = "Use image Alpha") boolean alpha,
|
||||
@Switch(name = 'f', desc = "Blend the image with existing terrain") boolean fadeOut,
|
||||
InjectedValueAccess context) throws WorldEditException, IOException {
|
||||
BufferedImage image = imageUri.load();
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
@ -460,7 +460,7 @@ public class BrushCommands extends MethodCommands {
|
||||
descFooter = "Use a height map to paint any surface.\n" +
|
||||
"The -w flag will only apply at maximum saturation\n" +
|
||||
"The -r flag will apply random rotation"
|
||||
)
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.surface")
|
||||
public BrushSettings surfaceBrush(LocalSession session, Pattern fill,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5")
|
||||
@ -474,11 +474,10 @@ public class BrushCommands extends MethodCommands {
|
||||
name = "scatter",
|
||||
desc = "Scatter a pattern on a surface",
|
||||
descFooter = "Set a number of blocks randomly on a surface each a certain distance apart.\n" +
|
||||
" The -o flag will overlay the block\n" +
|
||||
"Video: https://youtu.be/RPZIaTbqoZw?t=34s"
|
||||
)
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.scatter")
|
||||
public BrushSettings scatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "5") double points, @Arg(name = "distance", desc = "double", def = "1") double distance, @Switch(name='o', desc = "TODO") boolean overlay, InjectedValueAccess context) throws WorldEditException {
|
||||
public BrushSettings scatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "5") double points, @Arg(name = "distance", desc = "double", def = "1") double distance, @Switch(name = 'o', desc = "Overlay the block") boolean overlay, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
Brush brush;
|
||||
if (overlay) {
|
||||
@ -495,12 +494,10 @@ public class BrushCommands extends MethodCommands {
|
||||
@Command(
|
||||
name = "populateschematic",
|
||||
aliases = {"populateschem", "popschem", "pschem", "ps"},
|
||||
desc = "Scatter a schematic on a surface",
|
||||
descFooter = "Chooses the scatter schematic brush.\n" +
|
||||
"The -r flag will apply random rotation"
|
||||
desc = "Scatter a schematic on a surface"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.populateschematic")
|
||||
public BrushSettings scatterSchemBrush(Player player, LocalSession session, Mask mask, String clipboard, @Arg(name = "radius", desc = "Expression", def = "30") Expression radius, @Arg(name = "density", desc = "double", def = "50") double density, @Switch(name='r', desc = "TODO") boolean rotate, InjectedValueAccess context) throws WorldEditException {
|
||||
public BrushSettings scatterSchemBrush(Player player, LocalSession session, Mask mask, String clipboard, @Arg(name = "radius", desc = "Expression", def = "30") Expression radius, @Arg(name = "density", desc = "double", def = "50") double density, @Switch(name = 'r', desc = "Apply random rotation") boolean rotate, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
try {
|
||||
MultiClipboardHolder clipboards = ClipboardFormats.loadAllFromInput(player, clipboard, null, true);
|
||||
@ -704,7 +701,7 @@ public class BrushCommands extends MethodCommands {
|
||||
"Snow Pic: https://i.imgur.com/Hrzn0I4.png"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public BrushSettings heightBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Range(min=0, max=360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale, @Switch(name='r', desc = "TODO") boolean randomRotate, @Switch(name='l', desc = "TODO") boolean layers, @Switch(name='s', desc = "TODO") boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
public BrushSettings heightBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale, @Switch(name = 'r', desc = "TODO") boolean randomRotate, @Switch(name = 'l', desc = "TODO") boolean layers, @Switch(name = 's', desc = "TODO") boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
return terrainBrush(player, session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
|
||||
}
|
||||
|
||||
@ -712,13 +709,24 @@ public class BrushCommands extends MethodCommands {
|
||||
name = "cliff",
|
||||
aliases = {"flatcylinder"},
|
||||
desc = "Cliff brush",
|
||||
descFooter = "This brush flattens terrain and creates cliffs.\n" +
|
||||
" - The `-r` flag enables random off-axis rotation\n" +
|
||||
" - The `-l` flag will work on snow layers\n" +
|
||||
" - The `-s` flag disables smoothing"
|
||||
descFooter = "This brush flattens terrain and creates cliffs."
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public BrushSettings cliffBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Step(90) @Range(min=0, max=360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale, @Switch(name='r', desc = "TODO") boolean randomRotate, @Switch(name='l', desc = "TODO") boolean layers, @Switch(name='s', desc = "TODO") boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
public BrushSettings cliffBrush(Player player, LocalSession session,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5")
|
||||
Expression radius,
|
||||
@Arg(name = "image", desc = "String", def = "")
|
||||
String image,
|
||||
@Arg(def = "0", desc = "rotation") @Step(90) @Range(min = 0, max = 360)
|
||||
int rotation,
|
||||
@Arg(name = "yscale", desc = "double", def = "1")
|
||||
double yscale,
|
||||
@Switch(name = 'r', desc = "Enables random off-axis rotation")
|
||||
boolean randomRotate,
|
||||
@Switch(name = 'l', desc = "Will work on snow layers")
|
||||
boolean layers,
|
||||
@Switch(name = 's', desc = "Disables smoothing")
|
||||
boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context);
|
||||
}
|
||||
|
||||
@ -728,12 +736,12 @@ public class BrushCommands extends MethodCommands {
|
||||
desc = "This brush raises or lowers land towards the clicked point"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public BrushSettings flattenBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Step(90) @Range(min=0, max=360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale,
|
||||
@Switch(name='r', desc = "Enables random off-axis rotation")
|
||||
public BrushSettings flattenBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Step(90) @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale,
|
||||
@Switch(name = 'r', desc = "Enables random off-axis rotation")
|
||||
boolean randomRotate,
|
||||
@Switch(name='l', desc = "Will work on snow layers")
|
||||
@Switch(name = 'l', desc = "Will work on snow layers")
|
||||
boolean layers,
|
||||
@Switch(name='s', desc = "Disables smoothing")
|
||||
@Switch(name = 's', desc = "Disables smoothing")
|
||||
boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
|
||||
}
|
||||
@ -783,7 +791,7 @@ public class BrushCommands extends MethodCommands {
|
||||
"Video: https://www.youtube.com/watch?v=RPZIaTbqoZw"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.copy")
|
||||
public BrushSettings copy(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Switch(name='r', desc = "Apply random rotation on paste") boolean randomRotate, @Switch(name='a', desc = "Apply auto view based rotation on paste") boolean autoRotate, InjectedValueAccess context) throws WorldEditException {
|
||||
public BrushSettings copy(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Switch(name = 'r', desc = "Apply random rotation on paste") boolean randomRotate, @Switch(name = 'a', desc = "Apply auto view based rotation on paste") boolean autoRotate, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
player.print(BBC.BRUSH_COPY.f(radius));
|
||||
|
||||
|
@ -13,43 +13,38 @@ import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.sk89q.worldedit.command.argument.Arguments;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.internal.command.CommandArgParser;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.command.argument.Arguments;
|
||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.internal.annotation.Range;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
|
||||
import com.sk89q.worldedit.internal.command.CommandArgParser;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.util.List;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
|
||||
/**
|
||||
* Tool commands.
|
||||
@ -317,7 +312,7 @@ public class BrushOptionsCommands {
|
||||
public void scroll(Player player, EditSession editSession, LocalSession session,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand,
|
||||
@Arg(desc="Target Modes")
|
||||
@Arg(desc = "Target Modes")
|
||||
String modes,
|
||||
@Arg(desc = "The scroll action", variable = true)
|
||||
List<String> command) throws WorldEditException {
|
||||
|
@ -19,6 +19,11 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
@ -26,11 +31,6 @@ import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.TextureUtil;
|
||||
import com.boydti.fawe.util.image.ImageUtil;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.function.generator.CavesGen;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -38,16 +38,14 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.function.generator.CavesGen;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.RegionVisitor;
|
||||
import com.sk89q.worldedit.internal.annotation.Range;
|
||||
import com.sk89q.worldedit.internal.annotation.Selection;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
@ -55,19 +53,18 @@ import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
import com.sk89q.worldedit.internal.annotation.Range;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
|
||||
import java.util.List;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
|
||||
/**
|
||||
* Commands for the generation of shapes and other objects.
|
||||
@ -278,7 +275,7 @@ public class GenerationCommands extends MethodCommands {
|
||||
int size,
|
||||
@Arg(desc = "The type of forest", def = "tree")
|
||||
TreeType type,
|
||||
@Range(min=0, max = 100) @Arg(desc = "The density of the forest, between 0 and 100", def = "5")
|
||||
@Range(min = 0, max = 100) @Arg(desc = "The density of the forest, between 0 and 100", def = "5")
|
||||
double density) throws WorldEditException {
|
||||
density = density / 100;
|
||||
int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, type);
|
||||
@ -297,7 +294,7 @@ public class GenerationCommands extends MethodCommands {
|
||||
int size,
|
||||
@Arg(desc = "//TODO", def = "10")
|
||||
int apothem,
|
||||
@Range(min=0, max = 100) @Arg(desc = "//TODO ", def = "0.02")
|
||||
@Range(min = 0, max = 100) @Arg(desc = "//TODO ", def = "0.02")
|
||||
double density) throws WorldEditException {
|
||||
int affected = editSession.makePumpkinPatches(session.getPlacementPosition(player), apothem, density);
|
||||
BBC.COMMAND_PUMPKIN.send(player, affected);
|
||||
@ -409,7 +406,6 @@ public class GenerationCommands extends MethodCommands {
|
||||
name = "/generatebiome",
|
||||
aliases = { "/genbiome", "/gb" },
|
||||
desc = "Sets biome according to a formula.",
|
||||
|
||||
descFooter = "Formula must return positive numbers (true) if the point is inside the shape\n" +
|
||||
"Sets the biome of blocks in that shape.\n"
|
||||
+"See also https://tinyurl.com/weexpr."
|
||||
|
@ -82,7 +82,7 @@ public class HistoryCommands extends MethodCommands {
|
||||
" - Import from disk: /frb #import"
|
||||
)
|
||||
@CommandPermissions("worldedit.history.rollback")
|
||||
public void faweRollback(Player player, LocalSession session, String user, @Arg(def = "0", desc = "radius") @Range(min = 0) int radius, @Arg(name = "time", desc = "String", def = "0") String time, @Switch(name='r', desc = "TODO") boolean restore) throws WorldEditException {
|
||||
public void faweRollback(Player player, LocalSession session, String user, @Arg(def = "0", desc = "radius") @Range(min = 0) int radius, @Arg(name = "time", desc = "String", def = "0") String time, @Switch(name = 'r', desc = "TODO") boolean restore) throws WorldEditException {
|
||||
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
BBC.SETTING_DISABLE.send(player, "history.use-database (Import with /frb #import )");
|
||||
return;
|
||||
|
@ -282,7 +282,7 @@ public class MaskCommands extends MethodCommands {
|
||||
"Example: /[3][20]\n" +
|
||||
"Explanation: Allows any block where the adjacent block is between 3 and 20 blocks below"
|
||||
)
|
||||
public Mask angle(Extent extent, String min, String max, @Switch(name='o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "1") int distance) throws ExpressionException {
|
||||
public Mask angle(Extent extent, String min, String max, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "1") int distance) throws ExpressionException {
|
||||
double y1, y2;
|
||||
boolean override;
|
||||
if (max.endsWith("d")) {
|
||||
@ -307,7 +307,7 @@ public class MaskCommands extends MethodCommands {
|
||||
"Explanation: Restrict near where the angle changes between 0-45 degrees within 5 blocks\n" +
|
||||
"Note: Use negatives for decreasing slope"
|
||||
)
|
||||
public Mask roc(Extent extent, String min, String max, @Switch(name='o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distance) throws ExpressionException {
|
||||
public Mask roc(Extent extent, String min, String max, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distance) throws ExpressionException {
|
||||
double y1, y2;
|
||||
boolean override;
|
||||
if (max.endsWith("d")) {
|
||||
@ -332,7 +332,7 @@ public class MaskCommands extends MethodCommands {
|
||||
"Explanation: Restrict to near 45 degrees of local maxima\n" +
|
||||
"Note: Use negatives for local minima"
|
||||
)
|
||||
public Mask extrema(Extent extent, String min, String max, @Switch(name='o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distance) throws ExpressionException {
|
||||
public Mask extrema(Extent extent, String min, String max, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distance) throws ExpressionException {
|
||||
double y1, y2;
|
||||
boolean override;
|
||||
if (max.endsWith("d")) {
|
||||
|
@ -19,6 +19,15 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ORIENTATION_REGION;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
|
||||
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
|
||||
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
|
||||
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
@ -62,25 +71,15 @@ import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.ORIENTATION_REGION;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
|
||||
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
|
||||
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
|
||||
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
|
||||
|
||||
/**
|
||||
* Commands that operate on regions.
|
||||
*/
|
||||
@ -404,7 +403,7 @@ public class RegionCommands extends MethodCommands {
|
||||
int iterations,
|
||||
@Arg(desc = "The mask of blocks to use as the height map", def = "")
|
||||
Mask mask,
|
||||
@Switch(name='s', desc = "TODO") boolean snow, InjectedValueAccess context) throws WorldEditException {
|
||||
@Switch(name = 's', desc = "TODO") boolean snow, InjectedValueAccess context) throws WorldEditException {
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
@ -483,11 +482,11 @@ public class RegionCommands extends MethodCommands {
|
||||
boolean moveSelection,
|
||||
@Switch(name = 'a', desc = "Ignore air blocks")
|
||||
boolean ignoreAirBlocks,
|
||||
@Switch(name='b', desc = "TODO")
|
||||
@Switch(name = 'b', desc = "TODO")
|
||||
boolean copyBiomes,
|
||||
@Switch(name='e', desc = "TODO")
|
||||
@Switch(name = 'e', desc = "TODO")
|
||||
boolean skipEntities,
|
||||
@Switch(name='a', desc = "TODO")
|
||||
@Switch(name = 'a', desc = "TODO")
|
||||
boolean skipAir,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
checkCommandArgument(count >= 1, "Count must be >= 1");
|
||||
@ -520,7 +519,7 @@ public class RegionCommands extends MethodCommands {
|
||||
public void fall(FawePlayer player, EditSession editSession, LocalSession session,
|
||||
@Selection Region region,
|
||||
@Arg(name = "replace", desc = "BlockStateHolder", def = "air") BlockStateHolder replace,
|
||||
@Switch(name='m', desc = "TODO") boolean notFullHeight,
|
||||
@Switch(name = 'm', desc = "TODO") boolean notFullHeight,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
player.checkConfirmationRegion(() -> {
|
||||
int affected = editSession.fall(region, !notFullHeight, replace);
|
||||
@ -547,7 +546,7 @@ public class RegionCommands extends MethodCommands {
|
||||
@Switch(name = 'e', desc = "//TODO") boolean skipEntities,
|
||||
@Switch(name = 'a', desc = "Ignore air blocks")
|
||||
boolean ignoreAirBlocks,
|
||||
@Switch(name='m', desc = "TODO") Mask sourceMask, InjectedValueAccess context) throws WorldEditException {
|
||||
@Switch(name = 'm', desc = "TODO") Mask sourceMask, InjectedValueAccess context) throws WorldEditException {
|
||||
player.checkConfirmationStack(() -> {
|
||||
if (sourceMask != null) {
|
||||
editSession.addSourceMask(sourceMask);
|
||||
@ -674,7 +673,7 @@ public class RegionCommands extends MethodCommands {
|
||||
@Range(min = 0) int thickness,
|
||||
@Arg(desc = "The pattern of blocks to replace the hollowed area with", def = "air")
|
||||
Pattern pattern,
|
||||
@Switch(name='m', desc = "Mask to hollow with") Mask mask,
|
||||
@Switch(name = 'm', desc = "Mask to hollow with") Mask mask,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
Mask finalMask = mask == null ? new SolidBlockMask(editSession) : mask;
|
||||
player.checkConfirmationRegion(() -> {
|
||||
|
@ -35,19 +35,23 @@ import com.boydti.fawe.object.schematic.StructureFormat;
|
||||
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.chat.Message;
|
||||
import com.sk89q.worldedit.command.util.AsyncCommandBuilder;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.util.AsyncCommandBuilder;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.extent.PlayerSaveClipboardEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||
@ -55,6 +59,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.formatting.component.CodeFormat;
|
||||
import com.sk89q.worldedit.util.formatting.component.ErrorFormat;
|
||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.SchematicPaginationBox;
|
||||
@ -116,17 +121,15 @@ public class SchematicCommands {
|
||||
|
||||
@Command(
|
||||
name = "loadall",
|
||||
desc = "Load multiple clipboards (paste will randomly choose one)",
|
||||
descFooter = "Load multiple clipboards (paste will randomly choose one)\n" +
|
||||
"The -r flag will apply random rotation"
|
||||
desc = "Load multiple clipboards (paste will randomly choose one)"
|
||||
)
|
||||
@Deprecated
|
||||
@CommandPermissions({"worldedit.clipboard.load", "worldedit.schematic.load", "worldedit.schematic.load.web", "worldedit.schematic.load.asset"})
|
||||
public void loadall(final Player player, final LocalSession session,
|
||||
public void loadall(Player player, LocalSession session,
|
||||
@Arg(desc = "Format name.", def = "schematic")
|
||||
final String formatName,
|
||||
String formatName,
|
||||
@Arg(desc = "File name.")
|
||||
final String filename,
|
||||
String filename,
|
||||
@Switch(name = 'r', desc = "Apply random rotation")
|
||||
boolean randomRotate) throws FilenameException {
|
||||
final ClipboardFormat format = ClipboardFormats.findByAlias(formatName);
|
||||
@ -195,7 +198,7 @@ public class SchematicCommands {
|
||||
)
|
||||
@Deprecated
|
||||
@CommandPermissions({"worldedit.schematic.remap"})
|
||||
public void remap(final Player player, final LocalSession session) throws WorldEditException {
|
||||
public void remap(Player player, LocalSession session) throws WorldEditException {
|
||||
ClipboardRemapper remapper = new ClipboardRemapper(ClipboardRemapper.RemapPlatform.PE, ClipboardRemapper.RemapPlatform.PC);
|
||||
|
||||
for (Clipboard clip : session.getClipboard().getClipboards()) {
|
||||
@ -251,7 +254,7 @@ public class SchematicCommands {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").matcher(filename).find() && !player.hasPermission("worldedit.schematic.load.other")) {
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !player.hasPermission("worldedit.schematic.load.other") && Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").matcher(filename).find()) {
|
||||
BBC.NO_PERM.send(player, "worldedit.schematic.load.other");
|
||||
return;
|
||||
}
|
||||
@ -359,16 +362,6 @@ public class SchematicCommands {
|
||||
}
|
||||
}
|
||||
|
||||
if (f.getName().replaceAll("." + format.getPrimaryFileExtension(), "").isEmpty()) {
|
||||
File directory = f.getParentFile();
|
||||
if (directory.exists()) {
|
||||
int max = MainUtil.getMaxFileId(directory);
|
||||
f = new File(directory, max + "." + format.getPrimaryFileExtension());
|
||||
} else {
|
||||
f = new File(directory, "1." + format.getPrimaryFileExtension());
|
||||
}
|
||||
}
|
||||
|
||||
// Create parent directories
|
||||
File parent = f.getParentFile();
|
||||
if (parent != null && !parent.exists()) {
|
||||
@ -377,55 +370,16 @@ public class SchematicCommands {
|
||||
"Could not create folder for schematics!"));
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (!f.exists()) {
|
||||
f.createNewFile();
|
||||
} else if (!allowOverwrite) {
|
||||
BBC.SCHEMATIC_MOVE_EXISTS.send(player, f.getName());
|
||||
}
|
||||
|
||||
try (FileOutputStream fos = new FileOutputStream(f)) {
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
Transform transform = holder.getTransform();
|
||||
Clipboard target;
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
|
||||
// If we have a transform, bake it into the copy
|
||||
if (!transform.isIdentity()) {
|
||||
FlattenedClipboardTransform result = FlattenedClipboardTransform.transform(clipboard, transform);
|
||||
target = new BlockArrayClipboard(result.getTransformedRegion(), UUID.randomUUID());
|
||||
target.setOrigin(clipboard.getOrigin());
|
||||
Operations.completeLegacy(result.copyTo(target));
|
||||
} else {
|
||||
target = clipboard;
|
||||
}
|
||||
|
||||
URI uri = null;
|
||||
if (holder instanceof URIClipboardHolder) {
|
||||
uri = ((URIClipboardHolder) holder).getURI(clipboard);
|
||||
}
|
||||
if (new PlayerSaveClipboardEvent(player, clipboard, uri, f.toURI()).call()) {
|
||||
try (ClipboardWriter writer = format.getWriter(fos)) {
|
||||
if (writer instanceof MinecraftStructure) {
|
||||
((MinecraftStructure) writer).write(target, player.getName());
|
||||
} else {
|
||||
writer.write(target);
|
||||
}
|
||||
log.info(player.getName() + " saved " + f.getCanonicalPath());
|
||||
BBC.SCHEMATIC_SAVED.send(player, filename);
|
||||
}
|
||||
} else {
|
||||
BBC.WORLDEDIT_CANCEL_REASON_MANUAL.send(player);
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
player.printError("Unknown filename: " + filename);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
player.printError("Schematic could not written: " + e.getMessage());
|
||||
log.warn("Failed to write a saved clipboard", e);
|
||||
}
|
||||
SchematicSaveTask task = new SchematicSaveTask(player, f, format, holder, overwrite);
|
||||
AsyncCommandBuilder.wrap(task, player)
|
||||
.registerWithSupervisor(worldEdit.getSupervisor(), "Saving schematic " + filename)
|
||||
.sendMessageAfterDelay("(Please wait... saving schematic.)")
|
||||
.onSuccess(filename + " saved" + (overwrite ? " (overwriting previous file)." : "."), null)
|
||||
.onFailure("Failed to load schematic", worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter())
|
||||
.buildAndExec(worldEdit.getExecutorService());
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -505,7 +459,8 @@ public class SchematicCommands {
|
||||
}
|
||||
for (File f : files) {
|
||||
if (!MainUtil.isInSubDirectory(working, f) || !f.exists()) {
|
||||
actor.printError("Schematic " + filename + " does not exist! (" + f.exists() + "|" + f + "|" + (!MainUtil.isInSubDirectory(working, f)) + ")");
|
||||
actor.printError("Schematic " + filename + " does not exist! (" + f.exists() + "|" + f + "|" + !MainUtil.isInSubDirectory(working, f)
|
||||
+ ")");
|
||||
continue;
|
||||
}
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, f) && !actor.hasPermission("worldedit.schematic.delete.other")) {
|
||||
@ -753,9 +708,21 @@ public class SchematicCommands {
|
||||
FileOutputStream fos = closer.register(new FileOutputStream(file));
|
||||
BufferedOutputStream bos = closer.register(new BufferedOutputStream(fos));
|
||||
ClipboardWriter writer = closer.register(format.getWriter(bos));
|
||||
writer.write(target);
|
||||
|
||||
log.info(player.getName() + " saved " + file.getCanonicalPath() + (overwrite ? " (overwriting previous file)" : ""));
|
||||
URI uri = null;
|
||||
if (holder instanceof URIClipboardHolder) {
|
||||
uri = ((URIClipboardHolder) holder).getURI(clipboard);
|
||||
}
|
||||
if (new PlayerSaveClipboardEvent(player, clipboard, uri, file.toURI()).call()) {
|
||||
if (writer instanceof MinecraftStructure) {
|
||||
((MinecraftStructure) writer).write(target, player.getName());
|
||||
} else {
|
||||
writer.write(target);
|
||||
}
|
||||
log.info(player.getName() + " saved " + file.getCanonicalPath());
|
||||
BBC.SCHEMATIC_SAVED.send(player, file.getName());
|
||||
} else {
|
||||
BBC.WORLDEDIT_CANCEL_REASON_MANUAL.send(player);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -188,11 +188,14 @@ public class UtilityCommands {
|
||||
@Arg(desc = "The blocks to fill with")
|
||||
Pattern pattern,
|
||||
@Arg(desc = "The radius to fill in")
|
||||
@Range(min=1) double radius,
|
||||
double radius,
|
||||
@Arg(desc = "The depth to fill", def = "1")
|
||||
@Range(min=1) int depth,
|
||||
@Arg(desc = "Direction to fill", def = "down") BlockVector3 direction) throws WorldEditException {
|
||||
int depth,
|
||||
@Arg(desc = "Direction to fill", def = "down")
|
||||
BlockVector3 direction) throws WorldEditException {
|
||||
radius = Math.max(1, radius);
|
||||
we.checkMaxRadius(radius);
|
||||
depth = Math.max(1, depth);
|
||||
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
int affected = editSession.fillDirection(pos, pattern, radius, depth, direction);
|
||||
@ -281,9 +284,10 @@ public class UtilityCommands {
|
||||
@Arg(desc = "The blocks to fill with")
|
||||
Pattern pattern,
|
||||
@Arg(desc = "The radius to fill in")
|
||||
@Range(min=1) double radius,
|
||||
double radius,
|
||||
@Arg(desc = "The depth to fill", def = "")
|
||||
@Range(min=1) Integer depth) throws WorldEditException {
|
||||
Integer depth) throws WorldEditException {
|
||||
radius = Math.max(1, radius);
|
||||
we.checkMaxRadius(radius);
|
||||
depth = depth == null ? Integer.MAX_VALUE : Math.max(1, depth);
|
||||
we.checkMaxRadius(radius);
|
||||
@ -302,9 +306,10 @@ public class UtilityCommands {
|
||||
@Logging(PLACEMENT)
|
||||
public int drain(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The radius to drain")
|
||||
@Range(min=0) double radius,
|
||||
double radius,
|
||||
@Switch(name = 'w', desc = "Also un-waterlog blocks")
|
||||
boolean waterlogged) throws WorldEditException {
|
||||
radius = Math.max(0, radius);
|
||||
we.checkMaxRadius(radius);
|
||||
int affected = editSession.drainArea(
|
||||
session.getPlacementPosition(player), radius, waterlogged);
|
||||
@ -321,7 +326,8 @@ public class UtilityCommands {
|
||||
@Logging(PLACEMENT)
|
||||
public int fixLava(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The radius to fix in")
|
||||
@Range(min=0) double radius) throws WorldEditException {
|
||||
double radius) throws WorldEditException {
|
||||
radius = Math.max(0, radius);
|
||||
we.checkMaxRadius(radius);
|
||||
int affected = editSession.fixLiquid(session.getPlacementPosition(player), radius, BlockTypes.LAVA);
|
||||
player.print(affected + " block(s) have been changed.");
|
||||
@ -337,7 +343,8 @@ public class UtilityCommands {
|
||||
@Logging(PLACEMENT)
|
||||
public int fixWater(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The radius to fix in")
|
||||
@Range(min=0) double radius) throws WorldEditException {
|
||||
double radius) throws WorldEditException {
|
||||
radius = Math.max(0, radius);
|
||||
we.checkMaxRadius(radius);
|
||||
int affected = editSession.fixLiquid(session.getPlacementPosition(player), radius, BlockTypes.WATER);
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
@ -353,10 +360,14 @@ public class UtilityCommands {
|
||||
@Logging(PLACEMENT)
|
||||
public int removeAbove(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The apothem of the square to remove from", def = "1")
|
||||
@Range(min=1) int size,
|
||||
int size,
|
||||
@Arg(desc = "The maximum height above you to remove from", def = "")
|
||||
Integer height) throws WorldEditException {
|
||||
size = Math.max(1, size);
|
||||
we.checkMaxRadius(size);
|
||||
World world = player.getWorld();
|
||||
height = height != null ? Math.min((world.getMaxY() + 1), height + 1) : (world.getMaxY() + 1);
|
||||
|
||||
int affected = editSession.removeAbove(session.getPlacementPosition(player), size, height);
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
return affected;
|
||||
@ -371,9 +382,10 @@ public class UtilityCommands {
|
||||
@Logging(PLACEMENT)
|
||||
public int removeBelow(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The apothem of the square to remove from", def = "1")
|
||||
@Range(min=1) int size,
|
||||
int size,
|
||||
@Arg(desc = "The maximum height below you to remove from", def = "")
|
||||
Integer height) throws WorldEditException {
|
||||
size = Math.max(1, size);
|
||||
we.checkMaxRadius(size);
|
||||
World world = player.getWorld();
|
||||
height = height != null ? Math.min((world.getMaxY() + 1), height + 1) : (world.getMaxY() + 1);
|
||||
@ -394,7 +406,8 @@ public class UtilityCommands {
|
||||
@Arg(desc = "The mask of blocks to remove")
|
||||
Mask mask,
|
||||
@Arg(desc = "The radius of the square to remove from", def = "50")
|
||||
@Range(min=1) int radius) throws WorldEditException {
|
||||
int radius) throws WorldEditException {
|
||||
radius = Math.max(1, radius);
|
||||
we.checkMaxRadius(radius);
|
||||
|
||||
int affected = editSession.removeNear(session.getPlacementPosition(player), mask, radius);
|
||||
@ -411,11 +424,12 @@ public class UtilityCommands {
|
||||
@Logging(PLACEMENT)
|
||||
public int replaceNear(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The radius of the square to remove in")
|
||||
@Range(min=1) int radius,
|
||||
int radius,
|
||||
@Arg(desc = "The mask matching blocks to remove", def = "")
|
||||
Mask from,
|
||||
@Arg(desc = "The pattern of blocks to replace with")
|
||||
Pattern to) throws WorldEditException {
|
||||
radius = Math.max(1, radius);
|
||||
we.checkMaxRadius(radius);
|
||||
|
||||
BlockVector3 base = session.getPlacementPosition(player);
|
||||
@ -441,7 +455,8 @@ public class UtilityCommands {
|
||||
@Logging(PLACEMENT)
|
||||
public int snow(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The radius of the circle to snow in", def = "10")
|
||||
@Range(min=1) double size) throws WorldEditException {
|
||||
double size) throws WorldEditException {
|
||||
size = Math.max(1, size);
|
||||
we.checkMaxRadius(size);
|
||||
|
||||
int affected = editSession.simulateSnow(session.getPlacementPosition(player), size);
|
||||
@ -458,11 +473,12 @@ public class UtilityCommands {
|
||||
@Logging(PLACEMENT)
|
||||
public int thaw(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The radius of the circle to thaw in", def = "10")
|
||||
@Range(min=1) double size) throws WorldEditException {
|
||||
double size) throws WorldEditException {
|
||||
size = Math.max(1, size);
|
||||
we.checkMaxRadius(size);
|
||||
|
||||
int affected = editSession.thaw(session.getPlacementPosition(player), size);
|
||||
player.print(affected + " surfaces thawed.");
|
||||
player.print(affected + " surface(s) thawed.");
|
||||
return affected;
|
||||
}
|
||||
|
||||
@ -475,9 +491,10 @@ public class UtilityCommands {
|
||||
@Logging(PLACEMENT)
|
||||
public int green(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The radius of the circle to convert in", def = "10")
|
||||
@Range(min=1) double size,
|
||||
double size,
|
||||
@Switch(name = 'f', desc = "Also convert coarse dirt")
|
||||
boolean convertCoarse) throws WorldEditException {
|
||||
size = Math.max(1, size);
|
||||
we.checkMaxRadius(size);
|
||||
final boolean onlyNormalDirt = !convertCoarse;
|
||||
|
||||
@ -495,12 +512,12 @@ public class UtilityCommands {
|
||||
@Logging(PLACEMENT)
|
||||
public void extinguish(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The radius of the square to remove in", def = "")
|
||||
@Range(min=1) Integer radius) throws WorldEditException {
|
||||
Integer radius) throws WorldEditException {
|
||||
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
int defaultRadius = config.maxRadius != -1 ? Math.min(40, config.maxRadius) : 40;
|
||||
int size = radius != null ? radius : defaultRadius;
|
||||
int size = radius != null ? Math.max(1, radius) : defaultRadius;
|
||||
we.checkMaxRadius(size);
|
||||
|
||||
Mask mask = new BlockTypeMask(editSession, BlockTypes.FIRE);
|
||||
@ -656,7 +673,8 @@ public class UtilityCommands {
|
||||
return;
|
||||
}
|
||||
WorldEditAsyncCommandBuilder.createAndSendMessage(actor, () -> {
|
||||
double result = expression.evaluateTimeout(WorldEdit.getInstance().getSessionManager().get(actor).getTimeout());
|
||||
double result = expression.evaluate(
|
||||
new double[]{}, WorldEdit.getInstance().getSessionManager().get(actor).getTimeout());
|
||||
String formatted = Double.isNaN(result) ? "NaN" : formatter.format(result);
|
||||
return SubtleFormat.wrap(input + " = ").append(TextComponent.of(formatted, TextColor.LIGHT_PURPLE));
|
||||
}, null);
|
||||
|
Reference in New Issue
Block a user