diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/AnvilCommands.java b/worldedit-core/src/main/java/com/boydti/fawe/command/AnvilCommands.java index ee5a57d05..6dca6b38a 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/AnvilCommands.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/AnvilCommands.java @@ -147,7 +147,7 @@ public class AnvilCommands { descFooter = "The -d flag disabled wildcard data matching\n" ) @CommandPermissions("worldedit.anvil.replaceall") - public void replaceAll(Player player, String folder, @Optional String from, String to, @Switch('d') boolean useData) throws WorldEditException { + public void replaceAll(Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, String to, @Switch('d') boolean useData) throws WorldEditException { // final FaweBlockMatcher matchFrom; // if (from == null) { // matchFrom = FaweBlockMatcher.NOT_AIR; @@ -191,7 +191,7 @@ public class AnvilCommands { "The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`" ) @CommandPermissions("worldedit.anvil.deleteallunvisited") - public void deleteAllUnvisited(Player player, String folder, int inhabitedTicks, @Optional("60000") int fileDurationMillis) throws WorldEditException { + public void deleteAllUnvisited(Player player, String folder, int inhabitedTicks, @Arg(name = "filedurationmillis", desc = "int", def = "60000") int fileDurationMillis) throws WorldEditException { DeleteUninhabitedFilter filter = new DeleteUninhabitedFilter(fileDurationMillis, inhabitedTicks, fileDurationMillis); DeleteUninhabitedFilter result = runWithWorld(player, folder, filter, true); if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal())); @@ -208,7 +208,7 @@ public class AnvilCommands { "The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`" ) @CommandPermissions("worldedit.anvil.deleteallunclaimed") - public void deleteAllUnclaimed(Player player, int inhabitedTicks, @Optional("60000") int fileDurationMillis, @Switch('d') boolean debug) throws WorldEditException { + public void deleteAllUnclaimed(Player player, int inhabitedTicks, @Arg(name = "filedurationmillis", desc = "int", def = "60000") int fileDurationMillis, @Switch('d') boolean debug) throws WorldEditException { String folder = player.getWorld().getName(); DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis); if (debug) filter.enableDebug(); @@ -227,7 +227,7 @@ public class AnvilCommands { "The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`" ) @CommandPermissions("worldedit.anvil.deleteunclaimed") - public void deleteUnclaimed(Player player, EditSession editSession, @Selection Region selection, int inhabitedTicks, @Optional("60000") int fileDurationMillis, @Switch('d') boolean debug) throws WorldEditException { + public void deleteUnclaimed(Player player, EditSession editSession, @Selection Region selection, int inhabitedTicks, @Arg(name = "filedurationmillis", desc = "int", def = "60000") int fileDurationMillis, @Switch('d') boolean debug) throws WorldEditException { DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis); if (debug) filter.enableDebug(); DeleteUnclaimedFilter result = runWithSelection(player, editSession, selection, filter); @@ -308,7 +308,7 @@ public class AnvilCommands { desc = "Replace all blocks in the selection with another" ) @CommandPermissions("worldedit.anvil.replaceall") - public void replaceAllPattern(Player player, String folder, @Optional String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap) throws WorldEditException { + public void replaceAllPattern(Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap) throws WorldEditException { // MCAFilterCounter filter; // if (useMap) { // if (to instanceof RandomPattern) { @@ -507,7 +507,7 @@ public class AnvilCommands { desc = "Replace all blocks in the selection with another" ) @CommandPermissions("worldedit.anvil.replace") - public void replace(Player player, EditSession editSession, @Selection Region selection, @Optional String from, String to, @Switch('d') boolean useData) throws WorldEditException { + public void replace(Player player, EditSession editSession, @Selection Region selection, @Arg(name = "from", desc = "String", def = "") String from, String to, @Switch('d') boolean useData) throws WorldEditException { // final FaweBlockMatcher matchFrom; // if (from == null) { // matchFrom = FaweBlockMatcher.NOT_AIR; @@ -528,8 +528,8 @@ public class AnvilCommands { desc = "Replace all blocks in the selection with a pattern" ) @CommandPermissions("worldedit.anvil.replace") - // Player player, String folder, @Optional String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap - public void replacePattern(Player player, EditSession editSession, @Selection Region selection, @Optional String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap) throws WorldEditException { + // Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap + public void replacePattern(Player player, EditSession editSession, @Selection Region selection, @Arg(name = "from", desc = "String", def = "") String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap) throws WorldEditException { // MCAFilterCounter filter; // if (useMap) { // if (to instanceof RandomPattern) { @@ -559,7 +559,7 @@ public class AnvilCommands { desc = "Set all blocks in the selection with a pattern" ) @CommandPermissions("worldedit.anvil.set") - // Player player, String folder, @Optional String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap + // Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap public void set(Player player, EditSession editSession, @Selection Region selection, final Pattern to) throws WorldEditException { MCAFilterCounter filter = new SetPatternFilter(to); MCAFilterCounter result = runWithSelection(player, editSession, selection, filter); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java b/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java index 153b87bfa..e78e98205 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java @@ -105,7 +105,7 @@ public class CFICommands extends MethodCommands { desc = "Start CFI with a height map as a base" ) @CommandPermissions("worldedit.anvil.cfi") - public void heightmap(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional("1") double yscale) throws ParameterException { + public void heightmap(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Arg(name = "yscale", desc = "double", def = "1") double yscale) throws ParameterException { if (yscale != 0) { int[] raw = ((DataBufferInt) image.load().getRaster().getDataBuffer()).getData(); int[] table = IntStream.range(0, 256).map(i -> Math.min(255, (int) (i * yscale))) @@ -241,7 +241,7 @@ public class CFICommands extends MethodCommands { desc = "Set the floor and main block" ) @CommandPermissions("worldedit.anvil.cfi") - public void column(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ + public void column(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); if (image != null) gen.setColumn(load(image), pattern, !disableWhiteOnly); else if (mask != null) gen.setColumn(mask, pattern); @@ -256,14 +256,14 @@ public class CFICommands extends MethodCommands { desc = "Set the floor (default: grass)" ) @CommandPermissions("worldedit.anvil.cfi") - public void floorCmd(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ + public void floorCmd(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ floor(fp, pattern, image, mask, disableWhiteOnly); fp.sendMessage("Set floor!"); assertSettings(fp).resetComponent(); component(fp); } - private void floor(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException { + private void floor(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException { HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); if (image != null) gen.setFloor(load(image), pattern, !disableWhiteOnly); else if (mask != null) gen.setFloor(mask, pattern); @@ -275,14 +275,14 @@ public class CFICommands extends MethodCommands { desc = "Set the main block (default: stone)" ) @CommandPermissions("worldedit.anvil.cfi") - public void mainCmd(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ + public void mainCmd(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ main(fp, pattern, image, mask, disableWhiteOnly); fp.sendMessage("Set main!"); assertSettings(fp).resetComponent(); component(fp); } - public void main(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ + public void main(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); if (image != null) gen.setMain(load(image), pattern, !disableWhiteOnly); else if (mask != null) gen.setMain(mask, pattern); @@ -298,7 +298,7 @@ public class CFICommands extends MethodCommands { "e.g. Tallgrass" ) @CommandPermissions("worldedit.anvil.cfi") - public void overlay(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ + public void overlay(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); if (image != null) gen.setOverlay(load(image), pattern, !disableWhiteOnly); else if (mask != null) gen.setOverlay(mask, pattern); @@ -316,13 +316,13 @@ public class CFICommands extends MethodCommands { " - A good value for radius and iterations would be 1 8." ) @CommandPermissions("worldedit.anvil.cfi") - public void smoothCmd(FawePlayer fp, int radius, int iterations, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ + public void smoothCmd(FawePlayer fp, int radius, int iterations, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ smooth(fp, radius, iterations, image, mask, disableWhiteOnly); assertSettings(fp).resetComponent(); component(fp); } - private void smooth(FawePlayer fp, int radius, int iterations, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ + private void smooth(FawePlayer fp, int radius, int iterations, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); if (image != null) gen.smooth(load(image), !disableWhiteOnly, radius, iterations); else gen.smooth(mask, radius, iterations); @@ -333,7 +333,7 @@ public class CFICommands extends MethodCommands { desc = "Create some snow" ) @CommandPermissions("worldedit.anvil.cfi") - public void snow(FawePlayer fp, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ + public void snow(FawePlayer fp, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); floor(fp, BlockTypes.SNOW.getDefaultState().with(PropertyKey.LAYERS, 7), image, mask, disableWhiteOnly); main(fp, BlockTypes.SNOW_BLOCK, image, mask, disableWhiteOnly); @@ -365,7 +365,7 @@ public class CFICommands extends MethodCommands { "`#clipboard` will only use the blocks present in your clipboard." ) @CommandPermissions("worldedit.anvil.cfi") - public void paletteblocks(FawePlayer fp, Player player, LocalSession session, @Optional String arg) throws ParameterException, EmptyClipboardException, InputParseException, FileNotFoundException { + public void paletteblocks(FawePlayer fp, Player player, LocalSession session, @Arg(name = "arg", desc = "String", def = "") String arg) throws ParameterException, EmptyClipboardException, InputParseException, FileNotFoundException { if (arg == null) { msg("What blocks do you want to color with?").newline() .text("[All]").cmdTip(alias() + " PaletteBlocks *").text(" - All available blocks") @@ -498,7 +498,7 @@ public class CFICommands extends MethodCommands { " - If a mask is used, the biome will be set anywhere the mask applies" ) @CommandPermissions("worldedit.anvil.cfi") - public void biome(FawePlayer fp, BiomeType biome, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ + public void biome(FawePlayer fp, BiomeType biome, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); if (image != null) gen.setBiome(load(image), biome, !disableWhiteOnly); else if (mask != null) gen.setBiome(mask, biome); @@ -661,7 +661,7 @@ public class CFICommands extends MethodCommands { ) // ![79,174,212,5:3,5:4,18,161,20] @CommandPermissions("worldedit.anvil.cfi") - public void glass(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException { + public void glass(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException { CFISettings settings = assertSettings(fp); settings.getGenerator().setColorWithGlass(load(image)); msg("Set color with glass!").send(fp); @@ -678,7 +678,7 @@ public class CFICommands extends MethodCommands { "The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance" ) @CommandPermissions("worldedit.anvil.cfi") - public void color(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException { + public void color(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException { CFISettings settings = assertSettings(fp); HeightMapMCAGenerator gen = settings.getGenerator(); if (imageMask != null) gen.setColor(load(image), load(imageMask), !disableWhiteOnly); @@ -698,7 +698,7 @@ public class CFICommands extends MethodCommands { "The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance" ) @CommandPermissions("worldedit.anvil.cfi") - public void blockbiome(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException { + public void blockbiome(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException { CFISettings settings = assertSettings(fp); settings.getGenerator().setBlockAndBiomeColor(load(image), mask, load(imageMask), !disableWhiteOnly); msg("Set color with blocks and biomes!").send(fp); @@ -714,7 +714,7 @@ public class CFICommands extends MethodCommands { " - If you changed the block to something other than grass you will not see anything." ) @CommandPermissions("worldedit.anvil.cfi") - public void biomecolor(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException { + public void biomecolor(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException { CFISettings settings = assertSettings(fp); settings.getGenerator().setBiomeColor(load(image)); msg("Set color with biomes!").send(fp); @@ -806,7 +806,7 @@ public class CFICommands extends MethodCommands { desc = "Select a mask" ) @CommandPermissions("worldedit.anvil.cfi") - public void mask(FawePlayer fp, @Optional FawePrimitiveBinding.ImageUri imageMask, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly, CommandContext context) throws ParameterException{ + public void mask(FawePlayer fp, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly, CommandContext context) throws ParameterException{ CFISettings settings = assertSettings(fp); String[] split = getArguments(context).split(" "); int index = 2; @@ -831,7 +831,7 @@ public class CFICommands extends MethodCommands { desc = "Select a pattern" ) @CommandPermissions("worldedit.anvil.cfi") - public void pattern(FawePlayer fp, @Optional Pattern pattern, CommandContext context) throws ParameterException, CommandException { + public void pattern(FawePlayer fp, @Arg(name = "pattern", desc = "Pattern", def = "") Pattern pattern, CommandContext context) throws ParameterException, CommandException { CFISettings settings = assertSettings(fp); String[] split = getArguments(context).split(" "); int index = 2; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java index 3f56d27ab..212152396 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java @@ -448,7 +448,7 @@ public class BrushCommands { "Set [copies] to a value > 0 if you want to have your selection pasted a limited amount of times equally spaced on the curve" ) @CommandPermissions("worldedit.brush.sweep") - public BrushSettings sweepBrush(Player player, LocalSession session, EditSession editSession, @Optional("-1") int copies, CommandContext context) throws WorldEditException { + public BrushSettings sweepBrush(Player player, LocalSession session, EditSession editSession, @Arg(name = "copies", desc = "int", def = "-1") int copies, CommandContext context) throws WorldEditException { player.print(BBC.BRUSH_SPLINE.s()); Brush brush = new SweepBrush(copies); CommandLocals locals = context.getLocals(); @@ -537,7 +537,7 @@ public class BrushCommands { @CommandPermissions("worldedit.brush.surfacespline") // 0, 0, 0, 10, 0, public BrushSettings surfaceSpline(Player player, EditSession editSession, LocalSession session, Pattern fill, @Arg(desc = "The radius to sample for blending", def = "0") - double radius, @Optional("0") double tension, @Optional("0") double bias, @Optional("0") double continuity, @Optional("10") double quality, CommandContext context) throws WorldEditException { + double radius, @Arg(name = "tension", desc = "double", def = "0") double tension, @Arg(name = "bias", desc = "double", def = "0") double bias, @Arg(name = "continuity", desc = "double", def = "0") double continuity, @Arg(name = "quality", desc = "double", def = "10") double quality, CommandContext context) throws WorldEditException { player.print(BBC.BRUSH_SPLINE.f(radius)); worldEdit.checkMaxBrushRadius(radius); Brush brush = new SurfaceSpline(tension, bias, continuity, quality); @@ -577,7 +577,7 @@ public class BrushCommands { desc = "Creates a distorted sphere" ) @CommandPermissions("worldedit.brush.rock") - public BrushSettings blobBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Optional("10") Vector3 radius, @Optional("100") double sphericity, @Optional("30") double frequency, @Optional("50") double amplitude, CommandContext context) throws WorldEditException { + public BrushSettings blobBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Vector3", def = "10") Vector3 radius, @Arg(name = "sphericity", desc = "double", def = "100") double sphericity, @Arg(name = "frequency", desc = "double", def = "30") double frequency, @Arg(name = "amplitude", desc = "double", def = "50") double amplitude, CommandContext context) throws WorldEditException { double max = MathMan.max(radius.getX(), radius.getY(), radius.getZ()); worldEdit.checkMaxBrushRadius(max); Brush brush = new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100); @@ -728,7 +728,7 @@ public class BrushCommands { "The -r flag will apply random rotation" ) @CommandPermissions("worldedit.brush.stencil") - public BrushSettings stencilBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Optional("5") Expression radius, @Optional() final String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Optional("1") final double yscale, @Switch('w') boolean onlyWhite, @Switch('r') boolean randomRotate, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException { + public BrushSettings stencilBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Arg(name = "yscale", desc = "double", def = "1") final double yscale, @Switch('w') boolean onlyWhite, @Switch('r') boolean randomRotate, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException { worldEdit.checkMaxBrushRadius(radius); InputStream stream = getHeightmapStream(image); HeightBrush brush; @@ -779,7 +779,7 @@ public class BrushCommands { "The -f blends the image with the existing terrain" ) @CommandPermissions("worldedit.brush.stencil") - public BrushSettings imageBrush(Player player, EditSession editSession, LocalSession session, @Optional("5") Expression radius, FawePrimitiveBinding.ImageUri imageUri, @Optional("1") @Range(min=Double.MIN_NORMAL) final double yscale, @Switch('a') boolean alpha, @Switch('f') boolean fadeOut, CommandContext context) throws WorldEditException, IOException, ParameterException { + public BrushSettings imageBrush(Player player, EditSession editSession, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, FawePrimitiveBinding.ImageUri imageUri, @Optional("1") @Range(min=Double.MIN_NORMAL) final double yscale, @Switch('a') boolean alpha, @Switch('f') boolean fadeOut, CommandContext context) throws WorldEditException, IOException, ParameterException { BufferedImage image = imageUri.load(); worldEdit.checkMaxBrushRadius(radius); if (yscale != 1) { @@ -830,7 +830,7 @@ public class BrushCommands { "The -r flag will apply random rotation" ) @CommandPermissions("worldedit.brush.surface") - public BrushSettings surfaceBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Optional("5") Expression radius, CommandContext context) throws WorldEditException { + public BrushSettings surfaceBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, CommandContext context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); Brush brush = new SurfaceSphereBrush(); CommandLocals locals = context.getLocals(); @@ -871,7 +871,7 @@ public class BrushCommands { "Video: https://youtu.be/RPZIaTbqoZw?t=34s" ) @CommandPermissions("worldedit.brush.scatter") - public BrushSettings scatterBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Optional("5") Expression radius, @Optional("5") double points, @Optional("1") double distance, @Switch('o') boolean overlay, CommandContext context) throws WorldEditException { + public BrushSettings scatterBrush(Player player, EditSession editSession, 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('o') boolean overlay, CommandContext context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); Brush brush; if (overlay) { @@ -917,7 +917,7 @@ public class BrushCommands { "The -r flag will apply random rotation" ) @CommandPermissions("worldedit.brush.populateschematic") - public BrushSettings scatterSchemBrush(Player player, EditSession editSession, LocalSession session, Mask mask, String clipboard, @Optional("30") Expression radius, @Optional("50") double density, @Switch('r') boolean rotate, CommandContext context) throws WorldEditException { + public BrushSettings scatterSchemBrush(Player player, EditSession editSession, 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('r') boolean rotate, CommandContext context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); @@ -1038,7 +1038,7 @@ public class BrushCommands { "Note: The seeds define how many splotches there are, recursion defines how large, solid defines whether the pattern is applied per seed, else per block." ) @CommandPermissions("worldedit.brush.splatter") - public BrushSettings splatterBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Optional("5") Expression radius, @Optional("1") double points, @Optional("5") double recursion, @Optional("true") boolean solid, CommandContext context) throws WorldEditException { + public BrushSettings splatterBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "1") double points, @Arg(name = "recursion", desc = "double", def = "5") double recursion, @Arg(name = "solid", desc = "boolean", def = "true") boolean solid, CommandContext context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); Brush brush = new SplatterBrush((int) points, (int) recursion, solid); CommandLocals locals = context.getLocals(); @@ -1415,7 +1415,7 @@ public class BrushCommands { "Snow Pic: https://i.imgur.com/Hrzn0I4.png" ) @CommandPermissions("worldedit.brush.height") - public BrushSettings heightBrush(Player player, LocalSession session, @Optional("5") Expression radius, @Optional() final String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Optional("1") final double yscale, @Switch('r') boolean randomRotate, @Switch('l') boolean layers, @Switch('s') boolean dontSmooth, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException { + public BrushSettings heightBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") final String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Arg(name = "yscale", desc = "double", def = "1") final double yscale, @Switch('r') boolean randomRotate, @Switch('l') boolean layers, @Switch('s') boolean dontSmooth, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException { return terrainBrush(player, session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context); } @@ -1429,7 +1429,7 @@ public class BrushCommands { " - The `-s` flag disables smoothing" ) @CommandPermissions("worldedit.brush.height") - public BrushSettings cliffBrush(Player player, LocalSession session, @Optional("5") Expression radius, @Optional() final String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Optional("1") final double yscale, @Switch('r') boolean randomRotate, @Switch('l') boolean layers, @Switch('s') boolean dontSmooth, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException { + public BrushSettings cliffBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Arg(name = "yscale", desc = "double", def = "1") final double yscale, @Switch('r') boolean randomRotate, @Switch('l') boolean layers, @Switch('s') boolean dontSmooth, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException { return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context); } @@ -1443,7 +1443,7 @@ public class BrushCommands { desc = "This brush raises or lowers land towards the clicked point" ) @CommandPermissions("worldedit.brush.height") - public BrushSettings flattenBrush(Player player, LocalSession session, @Optional("5") Expression radius, @Optional() final String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Optional("1") final double yscale, @Switch('r') boolean randomRotate, @Switch('l') boolean layers, @Switch('s') boolean dontSmooth, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException { + public BrushSettings flattenBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") final String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Arg(name = "yscale", desc = "double", def = "1") final double yscale, @Switch('r') boolean randomRotate, @Switch('l') boolean layers, @Switch('s') boolean dontSmooth, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException { return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context); } @@ -1519,7 +1519,7 @@ public class BrushCommands { "Video: https://www.youtube.com/watch?v=RPZIaTbqoZw" ) @CommandPermissions("worldedit.brush.copy") - public BrushSettings copy(Player player, LocalSession session, @Optional("5") Expression radius, @Switch('r') boolean randomRotate, @Switch('a') boolean autoRotate, CommandContext context) throws WorldEditException { + public BrushSettings copy(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Switch('r') boolean randomRotate, @Switch('a') boolean autoRotate, CommandContext context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); player.print(BBC.BRUSH_COPY.f(radius)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushOptionsCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushOptionsCommands.java index 4f061a9b3..856fe48aa 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushOptionsCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushOptionsCommands.java @@ -135,7 +135,7 @@ public class BrushOptionsCommands extends MethodCommands { " -p prints the requested page\n" ) @CommandPermissions("worldedit.brush.list") - public void list(Actor actor, CommandContext args, @Switch('p') @Optional("1") int page) throws WorldEditException { + public void list(Actor actor, CommandContext args, @Switch('p') @Arg(name = "page", desc = "int", def = "1") int page) throws WorldEditException { String baseCmd = Commands.getAlias(BrushCommands.class, "brush") + " " + Commands.getAlias(BrushOptionsCommands.class, "loadbrush"); File dir = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes"); UtilityCommands.list(dir, actor, args, page, null, true, baseCmd); @@ -251,7 +251,7 @@ public class BrushOptionsCommands extends MethodCommands { desc = "Toggle between different target modes" ) @CommandPermissions("worldedit.brush.target") - public void target(Player player, LocalSession session, @Optional("0") int mode) throws WorldEditException { + public void target(Player player, LocalSession session, @Arg(name = "mode", desc = "int", def = "0") int mode) throws WorldEditException { BrushTool tool = session.getBrushTool(player, false); if (tool == null) { BBC.BRUSH_NONE.send(player); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java index d111de1a4..65339f6d9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java @@ -280,7 +280,7 @@ public class ClipboardCommands { ) @Deprecated @CommandPermissions({"worldedit.clipboard.download"}) - public void download(final Player player, final LocalSession session, @Optional("schem") final String formatName) throws WorldEditException { + public void download(final Player player, final LocalSession session, @Arg(name = "format", desc = "String", def = "schem") final String formatName) throws WorldEditException { final ClipboardFormat format = ClipboardFormats.findByAlias(formatName); if (format == null) { BBC.CLIPBOARD_INVALID_FORMAT.send(player, formatName); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java index 4ebcdf89e..76b64190d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java @@ -130,8 +130,8 @@ public class GenerationCommands { ) @CommandPermissions("worldedit.generation.image") @Logging(PLACEMENT) - public void image(Player player, LocalSession session, EditSession editSession, String arg, @Optional("true") boolean randomize, - @Arg(desc = "TODO", def = "100") int threshold, @Optional BlockVector2 dimensions) throws WorldEditException, IOException { + public void image(Player player, LocalSession session, EditSession editSession, String arg, @Arg(name = "randomize", desc = "boolean", def = "true") boolean randomize, + @Arg(desc = "TODO", def = "100") int threshold, @Arg(name = "dimensions", desc = "BlockVector2", def = "") BlockVector2 dimensions) throws WorldEditException, IOException { TextureUtil tu = Fawe.get().getCachedTextureUtil(randomize, 0, threshold); URL url = new URL(arg); if (!url.getHost().equalsIgnoreCase("i.imgur.com") && !url.getHost().equalsIgnoreCase("empcraft.com")) { @@ -190,7 +190,7 @@ public class GenerationCommands { BlockVector2 radius, @Arg(desc = "The height of the cylinder", def = "1") int height, - @Range(min = 1) @Optional("1") double thickness, CommandContext context) throws WorldEditException { + @Range(min = 1) @Arg(name = "thickness", desc = "double", def = "1") double thickness, CommandContext context) throws WorldEditException { double max = MathMan.max(radius.getBlockX(), radius.getBlockZ()); worldEdit.checkMaxRadius(max); BlockVector3 pos = session.getPlacementPosition(player); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java index 9c46ab94a..431b51213 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistoryCommands.java @@ -33,6 +33,7 @@ import com.boydti.fawe.object.changeset.DiskStorageHistory; import com.boydti.fawe.regions.FaweMaskManager; import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.MathMan; +import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; @@ -78,7 +79,7 @@ public class HistoryCommands extends MethodCommands { " - Import from disk: /frb #import" ) @CommandPermissions("worldedit.history.rollback") - public void faweRollback(final Player player, LocalSession session, final String user, @Optional("0") @Range(min = 0) int radius, @Optional("0") String time, @Switch('r') boolean restore) throws WorldEditException { + public void faweRollback(final Player player, LocalSession session, final String user, @Optional("0") @Range(min = 0) int radius, @Arg(name = "time", desc = "String", def = "0") String time, @Switch('r') boolean restore) throws WorldEditException { if (!Settings.IMP.HISTORY.USE_DATABASE) { BBC.SETTING_DISABLE.send(player, "history.use-database (Import with /frb #import )"); return; @@ -204,7 +205,7 @@ public class HistoryCommands extends MethodCommands { " - Import from disk: /frb #import" ) @CommandPermissions("worldedit.history.rollback") - public void restore(final Player player, LocalSession session, final String user, @Optional("0") @Range(min = 0) int radius, @Optional("0") String time) throws WorldEditException { + public void restore(final Player player, LocalSession session, final String user, @Optional("0") @Range(min = 0) int radius, @Arg(name = "time", desc = "String", def = "0") String time) throws WorldEditException { faweRollback(player, session, user, radius, time, true); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java index a345f3792..f9c278b06 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java @@ -257,7 +257,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('o') boolean overlay, @Optional("1") int distance) throws ExpressionException { + public Mask angle(Extent extent, String min, String max, @Switch('o') boolean overlay, @Arg(name = "distance", desc = "int", def = "1") int distance) throws ExpressionException { double y1, y2; boolean override; if (max.endsWith("d")) { @@ -282,7 +282,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('o') boolean overlay, @Optional("4") int distance) throws ExpressionException { + public Mask roc(Extent extent, String min, String max, @Switch('o') boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distance) throws ExpressionException { double y1, y2; boolean override; if (max.endsWith("d")) { @@ -307,7 +307,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('o') boolean overlay, @Optional("4") int distance) throws ExpressionException { + public Mask extrema(Extent extent, String min, String max, @Switch('o') boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distance) throws ExpressionException { double y1, y2; boolean override; if (max.endsWith("d")) { @@ -345,7 +345,7 @@ public class MaskCommands extends MethodCommands { aliases = {"#~", "#adjacent"}, desc = "Adjacent to a specific number of other blocks" ) - public Mask adjacent(Mask mask, @Optional("-1") double min, @Optional("-1") double max) throws ExpressionException { + public Mask adjacent(Mask mask, @Arg(name = "min", desc = "double", def = "-1") double min, @Arg(name = "max", desc = "double", def = "-1") double max) throws ExpressionException { if (min == -1 && max == -1) { min = 1; max = 8; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/OptionsCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/OptionsCommands.java index e0cc29605..1fc22813b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/OptionsCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/OptionsCommands.java @@ -103,7 +103,7 @@ public class OptionsCommands { max = -1 ) @CommandPermissions("worldedit.global-texture") - public void gtexture(FawePlayer player, LocalSession session, EditSession editSession, @Optional CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException { + public void gtexture(FawePlayer player, LocalSession session, EditSession editSession, @Arg(name = "context", desc = "CommandContext", def = "") CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException { if (context == null || context.argsLength() == 0) { session.setTextureUtil(null); BBC.TEXTURE_DISABLED.send(player); @@ -162,7 +162,7 @@ public class OptionsCommands { max = -1 ) @CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"}) - public void gmask(Player player, LocalSession session, EditSession editSession, @Optional CommandContext context) throws WorldEditException { + public void gmask(Player player, LocalSession session, EditSession editSession, @Arg(name = "context", desc = "CommandContext", def = "") CommandContext context) throws WorldEditException { if (context == null || context.argsLength() == 0) { session.setMask((Mask) null); BBC.MASK_DISABLED.send(player); @@ -186,7 +186,7 @@ public class OptionsCommands { max = -1 ) @CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"}) - public void gsmask(Player player, LocalSession session, EditSession editSession, @Optional CommandContext context) throws WorldEditException { + public void gsmask(Player player, LocalSession session, EditSession editSession, @Arg(name = "context", desc = "CommandContext", def = "") CommandContext context) throws WorldEditException { if (context == null || context.argsLength() == 0) { session.setSourceMask((Mask) null); BBC.SOURCE_MASK_DISABLED.send(player); @@ -209,7 +209,7 @@ public class OptionsCommands { max = -1 ) @CommandPermissions({"worldedit.global-transform", "worldedit.transform.global"}) - public void gtransform(Player player, EditSession editSession, LocalSession session, @Optional CommandContext context) throws WorldEditException { + public void gtransform(Player player, EditSession editSession, LocalSession session, @Arg(name = "context", desc = "CommandContext", def = "") CommandContext context) throws WorldEditException { if (context == null || context.argsLength() == 0) { session.setTransform(null); BBC.TRANSFORM_DISABLED.send(player); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/PatternCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/PatternCommands.java index 1cc00941b..6635883c0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/PatternCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/PatternCommands.java @@ -56,7 +56,7 @@ public class PatternCommands extends MethodCommands { desc = "Use the block that is already there", usage = "[properties]" ) - public Pattern existing(Extent extent, @Optional String properties) { // TODO FIXME , @Optional String properties + public Pattern existing(Extent extent, @Arg(name = "properties", desc = "String", def = "") String properties) { // TODO FIXME , @Arg(name = "properties", desc = "String", def = "") String properties if (properties == null) return new ExistingPattern(extent); return new PropertyPattern(extent).addRegex(".*[" + properties + "]"); } @@ -97,7 +97,7 @@ public class PatternCommands extends MethodCommands { name = "#anglecolor", desc = "A darker block based on the existing terrain angle" ) - public Pattern anglecolor(Extent extent, LocalSession session, @Optional("true") boolean randomize, @Optional("100") double maxComplexity, @Optional("1") int distance) { + public Pattern anglecolor(Extent extent, LocalSession session, @Arg(name = "randomize", desc = "boolean", def = "true") boolean randomize, @Arg(name = "maxcomplexity", desc = "double", def = "100") double maxComplexity, @Arg(name = "distance", desc = "int", def = "1") int distance) { return new AngleColorPattern(extent, session, distance); } @@ -105,7 +105,7 @@ public class PatternCommands extends MethodCommands { name = "#angledata", desc = "Block data based on the existing terrain angle" ) - public Pattern angledata(Extent extent, @Optional("1") int distance) { + public Pattern angledata(Extent extent, @Arg(name = "distance", desc = "int", def = "1") int distance) { return new DataAnglePattern(extent, distance); } @@ -131,7 +131,7 @@ public class PatternCommands extends MethodCommands { name = "#desaturate", desc = "Desaturated color of the existing block" ) - public Pattern desaturate(Extent extent, LocalSession session, @Optional("100") double percent) { + public Pattern desaturate(Extent extent, LocalSession session, @Arg(name = "percent", desc = "double", def = "100") double percent) { return new DesaturatePattern(extent, percent / 100d, session); } @@ -155,7 +155,7 @@ public class PatternCommands extends MethodCommands { name = "#fullcopy", desc = "Places your full clipboard at each block" ) - public Pattern fullcopy(Player player, Extent extent, LocalSession session, @Optional("#copy") String location, @Optional("false") boolean rotate, @Optional("false") boolean flip) throws EmptyClipboardException, InputParseException, IOException { + public Pattern fullcopy(Player player, Extent extent, LocalSession session, @Arg(name = "location", desc = "String", def = "#copy") String location, @Arg(name = "rotate", desc = "boolean", def = "false") boolean rotate, @Arg(name = "flip", desc = "boolean", def = "false") boolean flip) throws EmptyClipboardException, InputParseException, IOException { List clipboards; switch (location.toLowerCase()) { case "#copy": diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java index 5712c4138..d34fcb180 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java @@ -280,7 +280,7 @@ public class RegionCommands { ) @CommandPermissions("worldedit.region.replace") @Logging(REGION) - public void replace(FawePlayer player, EditSession editSession, @Selection Region region, @Optional Mask from, Pattern to, CommandContext context) throws WorldEditException { + public void replace(FawePlayer player, EditSession editSession, @Selection Region region, @Arg(name = "from", desc = "Mask", def = "") Mask from, Pattern to, CommandContext context) throws WorldEditException { player.checkConfirmationRegion(() -> { int affected = editSession.replaceBlocks(region, from == null ? new ExistingBlockMask(editSession) : from, to); BBC.VISITOR_BLOCK.send(player, affected); @@ -412,7 +412,7 @@ public class RegionCommands { ) @CommandPermissions("worldedit.region.smooth") @Logging(REGION) - public void smooth(FawePlayer player, EditSession editSession, @Selection Region region, @Optional("1") int iterations, @Optional Mask mask, @Switch('s') boolean snow, CommandContext context) throws WorldEditException { + public void smooth(FawePlayer player, EditSession editSession, @Selection Region region, @Arg(name = "iterations", desc = "int", def = "1") int iterations, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('s') boolean snow, CommandContext 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)); @@ -524,7 +524,7 @@ public class RegionCommands { @Logging(ORIENTATION_REGION) public void fall(FawePlayer player, EditSession editSession, LocalSession session, @Selection Region region, - @Optional("air") BlockStateHolder replace, + @Arg(name = "replace", desc = "BlockStateHolder", def = "air") BlockStateHolder replace, @Switch('m') boolean notFullHeight, CommandContext context) throws WorldEditException { player.checkConfirmationRegion(() -> { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/TransformCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/TransformCommands.java index 9ca7a8e92..1d4fed28f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/TransformCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/TransformCommands.java @@ -39,7 +39,7 @@ public class TransformCommands extends MethodCommands { aliases = {"#l"}, desc = "Sequentially pick from a list of transform" ) - public ResettableExtent linear(Actor actor, LocalSession session, @Optional("#null") ResettableExtent other) { + public ResettableExtent linear(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { if (other instanceof RandomTransform) { Set extents = ((RandomTransform) other).getExtents(); return new LinearTransform(extents.toArray(new ResettableExtent[extents.size()])); @@ -52,7 +52,7 @@ public class TransformCommands extends MethodCommands { aliases = {"#l3d"}, desc = "Use the x,y,z coordinate to pick a transform from the list" ) - public ResettableExtent linear3d(Actor actor, LocalSession session, @Optional("#null") ResettableExtent other) { + public ResettableExtent linear3d(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { if (other instanceof RandomTransform) { Set extents = ((RandomTransform) other).getExtents(); return new Linear3DTransform(extents.toArray(new ResettableExtent[extents.size()])); @@ -64,7 +64,7 @@ public class TransformCommands extends MethodCommands { name = "#pattern", desc = "Always use a specific pattern" ) - public ResettableExtent pattern(Actor actor, LocalSession session, Pattern pattern, @Optional("#null") ResettableExtent other) { + public ResettableExtent pattern(Actor actor, LocalSession session, Pattern pattern, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { return new PatternTransform(other, pattern); } @@ -72,7 +72,7 @@ public class TransformCommands extends MethodCommands { name = "#offset", desc = "Offset transform" ) - public ResettableExtent offset(Actor actor, LocalSession session, double x, double y, double z, @Optional("#null") ResettableExtent other) { + public ResettableExtent offset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { return new OffsetExtent(other, (int) x, (int) y, (int) z); } @@ -81,7 +81,7 @@ public class TransformCommands extends MethodCommands { aliases = {"#randomoffset"}, desc = "Random offset transform" ) - public ResettableExtent randomoffset(Actor actor, LocalSession session, double x, double y, double z, @Optional("#null") ResettableExtent other) { + public ResettableExtent randomoffset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { return new RandomOffsetTransform(other, (int) x, (int) y, (int) z); } @@ -89,7 +89,7 @@ public class TransformCommands extends MethodCommands { name = "#scale", desc = "All changes will be scaled" ) - public ResettableExtent scale(Actor actor, LocalSession session, double x, double y, double z, @Optional("#null") ResettableExtent other) { + public ResettableExtent scale(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { return new ScaleTransform(other, x, y, z); } @@ -97,7 +97,7 @@ public class TransformCommands extends MethodCommands { name = "#rotate", desc = "All changes will be rotate around the initial position" ) - public ResettableExtent rotate(Player player, LocalSession session, double x, double y, double z, @Optional("#null") ResettableExtent other) { + public ResettableExtent rotate(Player player, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { ExtentTraverser traverser = new ExtentTraverser(other).find(TransformExtent.class); BlockTransformExtent affine = (TransformExtent) (traverser != null ? traverser.get() : null); if (affine == null) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java index 8f8ac42f9..7b320a1e3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java @@ -114,7 +114,7 @@ public class UtilityCommands { desc = "Generate the heightmap interface: https://github.com/boy0001/HeightMap" ) @CommandPermissions("fawe.admin") - public void heightmapInterface(Player player, @Optional("100") int min, @Optional("200") int max) throws IOException { + public void heightmapInterface(Player player, @Arg(name = "min", desc = "int", def = "100") int min, @Arg(name = "max", desc = "int", def = "200") int max) throws IOException { player.print("Please wait while we generate the minified heightmaps."); File srcFolder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HEIGHTMAP);