fix some Command annotations

This commit is contained in:
Jesse Boyd 2019-07-17 15:43:18 +10:00
parent 0e54f196fc
commit cedb261313
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
16 changed files with 524 additions and 739 deletions

View File

@ -65,8 +65,8 @@ processResources {
version: "${project.parent.version}", version: "${project.parent.version}",
name: project.parent.name, name: project.parent.name,
commit: "${git.head().abbreviatedId}", commit: "${git.head().abbreviatedId}",
date: "${git.head().getDate().format("yy.MM.dd")}", date: "${git.head().getDate().format("yy.MM.dd")}"
) )
} }
} }

View File

@ -141,13 +141,11 @@ public class AnvilCommands {
} }
@Command( @Command(
aliases = {"replaceall", "rea", "repall"}, name = "replaceall",
usage = "<folder> [from-block] <to-block>", aliases = {"rea", "repall"},
desc = "Replace all blocks in the selection with another", desc = "Replace all blocks in the selection with another",
help = "Replace all blocks in the selection with another\n" + descFooter = "The -d flag disabled wildcard data matching\n"
"The -d flag disabled wildcard data matching\n", )
flags = "df"
)
@CommandPermissions("worldedit.anvil.replaceall") @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, @Optional String from, String to, @Switch('d') boolean useData) throws WorldEditException {
// final FaweBlockMatcher matchFrom; // final FaweBlockMatcher matchFrom;
@ -166,9 +164,8 @@ public class AnvilCommands {
} }
@Command( @Command(
aliases = {"remapall"}, name = "remapall",
usage = "<folder>", descFooter = "Remap the world between MCPE/PC values",
help = "Remap the world between MCPE/PC values",
desc = "Remap the world between MCPE/PC values" desc = "Remap the world between MCPE/PC values"
) )
@CommandPermissions("worldedit.anvil.remapall") @CommandPermissions("worldedit.anvil.remapall")
@ -185,10 +182,10 @@ public class AnvilCommands {
@Command( @Command(
aliases = {"deleteallunvisited", "delunvisited" }, name = "deleteallunvisited",
usage = "<folder> <age-ticks> [file-age=60000]", aliases = {"delunvisited" },
desc = "Delete all chunks which haven't been occupied", desc = "Delete all chunks which haven't been occupied",
help = "Delete all chunks which haven't been occupied for `age-ticks` (20t = 1s) and \n" + descFooter = "occupied for `age-ticks` (20t = 1s) and \n" +
"Have not been accessed since `file-duration` (ms) after creation and\n" + "Have not been accessed since `file-duration` (ms) after creation and\n" +
"Have not been used in the past `chunk-inactivity` (ms)" + "Have not been used in the past `chunk-inactivity` (ms)" +
"The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`" "The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
@ -201,16 +198,15 @@ public class AnvilCommands {
} }
@Command( @Command(
aliases = {"deleteallunclaimed", "delallunclaimed" }, name = "deleteallunclaimed",
usage = "<age-ticks> [file-age=60000]", aliases = {"delallunclaimed" },
desc = "(Supports: WG, P2, GP) Delete all chunks which haven't been occupied AND claimed", desc = "Delete all chunks which haven't been occupied",
help = "(Supports: WG, P2, GP) Delete all chunks which aren't claimed AND haven't been occupied for `age-ticks` (20t = 1s) and \n" + descFooter = "Supports: WG, P2, GP:\n" +
"Delete all chunks which aren't claimed AND haven't been occupied for `age-ticks` (20t = 1s) and \n" +
"Have not been accessed since `file-duration` (ms) after creation and\n" + "Have not been accessed since `file-duration` (ms) after creation and\n" +
"Have not been used in the past `chunk-inactivity` (ms)" + "Have not been used in the past `chunk-inactivity` (ms)" +
"The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`", "The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
min = 1, )
max = 3
)
@CommandPermissions("worldedit.anvil.deleteallunclaimed") @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, @Optional("60000") int fileDurationMillis, @Switch('d') boolean debug) throws WorldEditException {
String folder = player.getWorld().getName(); String folder = player.getWorld().getName();
@ -222,15 +218,14 @@ public class AnvilCommands {
@Command( @Command(
name = "deleteunclaimed", name = "deleteunclaimed",
usage = "<age-ticks> [file-age=60000]", desc = "Delete all chunks which haven't been occupied",
desc = "(Supports: WG, P2, GP) Delete all chunks which haven't been occupied AND claimed", descFooter = "(Supports: WG, P2, GP):\n" +
help = "(Supports: WG, P2, GP) Delete all chunks which aren't claimed AND haven't been occupied for `age-ticks` (20t = 1s) and \n" + "Is not claimed\n" +
"Has not been occupied for `age-ticks` (20t = 1s) and \n" +
"Have not been accessed since `file-duration` (ms) after creation and\n" + "Have not been accessed since `file-duration` (ms) after creation and\n" +
"Have not been used in the past `chunk-inactivity` (ms)" + "Have not been used in the past `chunk-inactivity` (ms)" +
"The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`", "The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
min = 1, )
max = 3
)
@CommandPermissions("worldedit.anvil.deleteunclaimed") @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, @Optional("60000") int fileDurationMillis, @Switch('d') boolean debug) throws WorldEditException {
DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis); DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis);
@ -240,11 +235,10 @@ public class AnvilCommands {
} }
@Command( @Command(
aliases = {"deletealloldregions", "deloldreg" }, name = "deletealloldregions",
usage = "<folder> <time>", aliases = {"deloldreg" },
desc = "Delete regions which haven't been accessed in a certain amount of time", desc = "Delete regions which haven't been accessed in a certain amount of time",
help = "Delete regions which haven't been accessed in a certain amount of time\n" + descFooter = "You can use seconds (s), minutes (m), hours (h), days (d), weeks (w), years (y)\n" +
"You can use seconds (s), minutes (m), hours (h), days (d), weeks (w), years (y)\n" +
"(months are not a unit of time)\n" + "(months are not a unit of time)\n" +
"E.g. 8h5m12s\n" "E.g. 8h5m12s\n"
) )
@ -259,8 +253,7 @@ public class AnvilCommands {
@Command( @Command(
name = "trimallplots", name = "trimallplots",
desc = "Trim chunks in a Plot World", desc = "Trim chunks in a Plot World",
help = "Trim chunks in a Plot World\n" + descFooter = "Unclaimed chunks will be deleted\n" +
"Unclaimed chunks will be deleted\n" +
"Unmodified chunks will be deleted\n" + "Unmodified chunks will be deleted\n" +
"Use -v to also delete unvisited chunks\n" "Use -v to also delete unvisited chunks\n"
) )
@ -310,11 +303,10 @@ public class AnvilCommands {
} }
@Command( @Command(
aliases = {"replaceallpattern", "reap", "repallpat"}, name = "replaceallpattern",
usage = "<folder> [from-block] <to-pattern>", aliases = {"reap", "repallpat"},
desc = "Replace all blocks in the selection with another", desc = "Replace all blocks in the selection with another"
flags = "dm" )
)
@CommandPermissions("worldedit.anvil.replaceall") @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, @Optional String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap) throws WorldEditException {
// MCAFilterCounter filter; // MCAFilterCounter filter;
@ -340,11 +332,9 @@ public class AnvilCommands {
} }
// //
@Command( @Command(
aliases = {"countall"}, name = "countall",
usage = "<folder> [hasSky] <id>", desc = "Count all blocks in a world"
desc = "Count all blocks in a world", )
flags = "d"
)
@CommandPermissions("worldedit.anvil.countall") @CommandPermissions("worldedit.anvil.countall")
public void countAll(Player player, EditSession editSession, String folder, String arg, @Switch('d') boolean useData) throws WorldEditException { public void countAll(Player player, EditSession editSession, String folder, String arg, @Switch('d') boolean useData) throws WorldEditException {
// Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true); // Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true);
@ -363,7 +353,8 @@ public class AnvilCommands {
} }
@Command( @Command(
aliases = {"clear", "unset"}, name = "clear",
aliases = {"unset"},
desc = "Clear the chunks in a selection (delete without defrag)" desc = "Clear the chunks in a selection (delete without defrag)"
) )
@CommandPermissions("worldedit.anvil.clear") @CommandPermissions("worldedit.anvil.clear")
@ -413,13 +404,9 @@ public class AnvilCommands {
} }
@Command( @Command(
aliases = {"count"}, name = "count",
usage = "<ids>", desc = "Count blocks in a selection"
desc = "Count blocks in a selection", )
flags = "d",
min = 1,
max = 2
)
@CommandPermissions("worldedit.anvil.count") @CommandPermissions("worldedit.anvil.count")
public void count(Player player, EditSession editSession, @Selection Region selection, String arg, @Switch('d') boolean useData) throws WorldEditException { public void count(Player player, EditSession editSession, @Selection Region selection, String arg, @Switch('d') boolean useData) throws WorldEditException {
// Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true); // Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true);
@ -438,7 +425,7 @@ public class AnvilCommands {
} }
// //
@Command( @Command(
aliases = {"distr"}, name = "distr",
desc = "Replace all blocks in the selection with another" desc = "Replace all blocks in the selection with another"
) )
@CommandPermissions("worldedit.anvil.distr") @CommandPermissions("worldedit.anvil.distr")
@ -515,8 +502,8 @@ public class AnvilCommands {
} }
// //
@Command( @Command(
aliases = {"replace", "r"}, name = "replace",
usage = "[from-block] <to-block>", aliases = {"r"},
desc = "Replace all blocks in the selection with another" desc = "Replace all blocks in the selection with another"
) )
@CommandPermissions("worldedit.anvil.replace") @CommandPermissions("worldedit.anvil.replace")
@ -536,8 +523,8 @@ public class AnvilCommands {
} }
// //
@Command( @Command(
aliases = {"replacepattern", "preplace", "rp"}, name = "replacepattern",
usage = "[from-mask] <to-pattern>", aliases = {"preplace", "rp"},
desc = "Replace all blocks in the selection with a pattern" desc = "Replace all blocks in the selection with a pattern"
) )
@CommandPermissions("worldedit.anvil.replace") @CommandPermissions("worldedit.anvil.replace")
@ -568,8 +555,7 @@ public class AnvilCommands {
} }
@Command( @Command(
aliases = {"set"}, name = "set",
usage = "<to-pattern>",
desc = "Set all blocks in the selection with a pattern" desc = "Set all blocks in the selection with a pattern"
) )
@CommandPermissions("worldedit.anvil.set") @CommandPermissions("worldedit.anvil.set")
@ -583,10 +569,9 @@ public class AnvilCommands {
} }
@Command( @Command(
aliases = {"removelayers"}, name = "removelayers",
usage = "<id>",
desc = "Removes matching chunk layers", desc = "Removes matching chunk layers",
help = "Remove if all the selected layers in a chunk match the provided id" descFooter = "Only if a chunk matches the provided id"
) )
@CommandPermissions("worldedit.anvil.removelayer") @CommandPermissions("worldedit.anvil.removelayer")
public void removeLayers(Player player, EditSession editSession, @Selection Region selection, int id) throws WorldEditException { public void removeLayers(Player player, EditSession editSession, @Selection Region selection, int id) throws WorldEditException {
@ -603,7 +588,7 @@ public class AnvilCommands {
@Command( @Command(
aliases = {"copy"}, name = "copy",
desc = "Lazily copy chunks to your anvil clipboard" desc = "Lazily copy chunks to your anvil clipboard"
) )
@CommandPermissions("worldedit.anvil.copychunks") @CommandPermissions("worldedit.anvil.copychunks")
@ -624,12 +609,11 @@ public class AnvilCommands {
} }
@Command( @Command(
aliases = {"paste"}, name = "paste",
desc = "Paste chunks from your anvil clipboard", desc = "Paste chunks from your anvil clipboard",
help = descFooter =
"Paste the chunks from your anvil clipboard.\n" + "Paste the chunks from your anvil clipboard.\n" +
"The -c flag will align the paste to the chunks.", "The -c flag will align the paste to the chunks.",
flags = "c"
) )
@CommandPermissions("worldedit.anvil.pastechunks") @CommandPermissions("worldedit.anvil.pastechunks")

View File

@ -101,7 +101,7 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"heightmap"}, name = "heightmap",
desc = "Start CFI with a height map as a base" desc = "Start CFI with a height map as a base"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
@ -291,7 +291,8 @@ public class CFICommands extends MethodCommands {
@Command( @Command(
name = "overlay", name = "overlay",
aliases = {"overlay", "setoverlay"}, name = "overlay",
aliases = {"setoverlay"},
desc = "Set the overlay block", desc = "Set the overlay block",
descFooter = "Change the block directly above the floor (default: air)\n" + descFooter = "Change the block directly above the floor (default: air)\n" +
"e.g. Tallgrass" "e.g. Tallgrass"
@ -307,7 +308,7 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"smooth"}, name = "smooth",
desc = "Smooth the terrain", desc = "Smooth the terrain",
descFooter = "Smooth terrain within an image-mask, or worldedit mask\n" + descFooter = "Smooth terrain within an image-mask, or worldedit mask\n" +
" - You can use !0 as the mask to smooth everything\n" + " - You can use !0 as the mask to smooth everything\n" +
@ -572,7 +573,8 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"baseid", "bedrockid"}, name = "baseid",
aliases = {"bedrockid"},
desc = "Change the block used for the base\ne.g. Bedrock" desc = "Change the block used for the base\ne.g. Bedrock"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
@ -585,7 +587,8 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"worldthickness", "width", "thickness"}, name = "worldthickness",
aliases = {"width", "thickness"},
desc = "Set the thickness of the generated world\n" + desc = "Set the thickness of the generated world\n" +
" - A value of 0 is the default and will not modify the height" " - A value of 0 is the default and will not modify the height"
) )
@ -597,7 +600,8 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"floorthickness", "floorheight", "floorwidth"}, name = "floorthickness",
aliases = {"floorheight", "floorwidth"},
desc = "Set the thickness of the top layer\n" + desc = "Set the thickness of the top layer\n" +
" - A value of 0 is the default and will only set the top block" " - A value of 0 is the default and will only set the top block"
) )
@ -609,7 +613,8 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"update", "refresh", "resend"}, name = "update",
aliases = {"refresh", "resend"},
desc = "Resend the CFI chunks" desc = "Resend the CFI chunks"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
@ -620,7 +625,8 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"tp", "visit", "home"}, name = "tp",
aliases = {"visit", "home"},
desc = "Teleport to the CFI virtual world" desc = "Teleport to the CFI virtual world"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
@ -635,7 +641,8 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"waterheight", "sealevel", "setwaterheight"}, name = "waterheight",
aliases = {"sealevel", "setwaterheight"},
desc = "Set the level water is generated at\n" + desc = "Set the level water is generated at\n" +
"Set the level water is generated at\n" + "Set the level water is generated at\n" +
" - By default water is disabled (with a value of 0)" " - By default water is disabled (with a value of 0)"
@ -648,8 +655,8 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"glass", "glasscolor", "setglasscolor"}, name = "glass",
usage = "<url>", aliases = {"glasscolor", "setglasscolor"},
desc = "Color terrain using glass" desc = "Color terrain using glass"
) )
// ![79,174,212,5:3,5:4,18,161,20] // ![79,174,212,5:3,5:4,18,161,20]
@ -663,10 +670,10 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"color", "setcolor", "blockcolor", "blocks"}, name = "color",
usage = "<url> [imageMask|mask]", aliases = {"setcolor", "blockcolor", "blocks"},
desc = "Set the color with blocks and biomes", desc = "Set the color with blocks and biomes",
help = "Color the terrain using only blocks\n" + descFooter = "Color the terrain using only blocks\n" +
"Provide an image, or worldedit mask for the 2nd argument to restrict what areas are colored\n" + "Provide an image, or worldedit mask for the 2nd argument to restrict what areas are colored\n" +
"The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance" "The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance"
) )
@ -683,10 +690,10 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"blockbiomecolor", "setblockandbiomecolor", "blockandbiome"}, name = "blockbiomecolor",
usage = "<url> [imageMask|mask]", aliases = {"setblockandbiomecolor", "blockandbiome"},
desc = "Set the color with blocks and biomes", desc = "Set the color with blocks and biomes",
help = "Color the terrain using blocks and biomes.\n" + descFooter = "Color the terrain using blocks and biomes.\n" +
"Provide an image, or worldedit mask to restrict what areas are colored\n" + "Provide an image, or worldedit mask to restrict what areas are colored\n" +
"The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance" "The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance"
) )
@ -700,8 +707,8 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"biomecolor", "setbiomecolor", "biomes"}, name = "biomecolor",
usage = "<url> [imageMask|mask]", aliases = {"setbiomecolor", "biomes"},
desc = "Color the terrain using biomes.\n" + desc = "Color the terrain using biomes.\n" +
"Note: Biome coloring does not change blocks:\n" + "Note: Biome coloring does not change blocks:\n" +
" - If you changed the block to something other than grass you will not see anything." " - If you changed the block to something other than grass you will not see anything."
@ -717,7 +724,8 @@ public class CFICommands extends MethodCommands {
@Command( @Command(
aliases = {"coloring", "palette"}, name = "coloring",
aliases = {"palette"},
usage = "", usage = "",
desc = "Color the world using an image" desc = "Color the world using an image"
) )
@ -794,8 +802,7 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"mask"}, name = "mask",
usage = "<imageMask|mask>",
desc = "Select a mask" desc = "Select a mask"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
@ -820,8 +827,7 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"pattern"}, name = "pattern",
usage = "<pattern>",
desc = "Select a pattern" desc = "Select a pattern"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
@ -845,7 +851,7 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"download"}, name = "download",
desc = "Download the current image" desc = "Download the current image"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
@ -861,8 +867,7 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"image"}, name = "image",
usage = "<image>",
desc = "Select an image" desc = "Select an image"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
@ -895,7 +900,7 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"populate"}, name = "populate",
usage = "", usage = "",
desc = "" desc = ""
) )
@ -912,7 +917,8 @@ public class CFICommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"component", "components"}, name = "component",
aliases = {"components"},
usage = "", usage = "",
desc = "Components menu" desc = "Components menu"
) )

View File

@ -14,7 +14,6 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
command = "trimchunks", command = "trimchunks",
permission = "plots.admin", permission = "plots.admin",
description = "Delete unmodified portions of your plotworld", description = "Delete unmodified portions of your plotworld",
usage = "/plot trimchunks <world> <boolean-delete-unowned>",
requiredType = RequiredType.PLAYER, requiredType = RequiredType.PLAYER,
category = CommandCategory.ADMINISTRATION) category = CommandCategory.ADMINISTRATION)
public class FaweTrim extends SubCommand { public class FaweTrim extends SubCommand {

View File

@ -60,6 +60,8 @@ import com.boydti.fawe.object.mask.IdMask;
import com.boydti.fawe.util.ColorUtil; import com.boydti.fawe.util.ColorUtil;
import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.image.ImageUtil; import com.boydti.fawe.util.image.ImageUtil;
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandLocals;
import com.sk89q.minecraft.util.commands.Step; import com.sk89q.minecraft.util.commands.Step;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.EmptyClipboardException; import com.sk89q.worldedit.EmptyClipboardException;
@ -98,6 +100,7 @@ import com.sk89q.worldedit.util.command.CallableProcessor;
import com.sk89q.worldedit.util.command.CommandCallable; import com.sk89q.worldedit.util.command.CommandCallable;
import com.sk89q.worldedit.util.command.InvalidUsageException; import com.sk89q.worldedit.util.command.InvalidUsageException;
import com.sk89q.worldedit.util.command.parametric.AParametricCallable; import com.sk89q.worldedit.util.command.parametric.AParametricCallable;
import com.sk89q.worldedit.util.command.parametric.Optional;
import com.sk89q.worldedit.util.command.parametric.ParameterException; import com.sk89q.worldedit.util.command.parametric.ParameterException;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
@ -137,9 +140,10 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"blendball", "bb", "blend"}, name = "blendball",
aliases = {"bb", "blend"},
desc = "Smooths and blends terrain", desc = "Smooths and blends terrain",
help = "Smooths and blends terrain\n" + descFooter = "Smooths and blends terrain\n" +
"Pic: https://i.imgur.com/cNUQUkj.png -> https://i.imgur.com/hFOFsNf.png" "Pic: https://i.imgur.com/cNUQUkj.png -> https://i.imgur.com/hFOFsNf.png"
) )
@CommandPermissions("worldedit.brush.blendball") @CommandPermissions("worldedit.brush.blendball")
@ -299,10 +303,10 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"recursive", "recurse", "r"}, name = "recursive",
usage = "<pattern-to> [radius=5]", aliases = {"recurse", "r"},
desc = "Set all connected blocks", desc = "Set all connected blocks",
help = "Set all connected blocks\n" + descFooter = "Set all connected blocks\n" +
"The -d flag Will apply in depth first order\n" + "The -d flag Will apply in depth first order\n" +
"Note: Set a mask to recurse along specific blocks" "Note: Set a mask to recurse along specific blocks"
) )
@ -343,11 +347,10 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"line", "l"}, name = "line",
usage = "<pattern> [radius=0]", aliases = {"l"},
flags = "hsf",
desc = "Create lines", desc = "Create lines",
help = "Create lines.\n" + descFooter = "Create lines.\n" +
"The -h flag creates only a shell\n" + "The -h flag creates only a shell\n" +
"The -s flag selects the clicked point after drawing\n" + "The -s flag selects the clicked point after drawing\n" +
"The -f flag creates a flat line" "The -f flag creates a flat line"
@ -389,10 +392,10 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"spline", "spl", "curve"}, name = "spline",
usage = "<pattern>", aliases = {"spl", "curve"},
desc = "Join multiple objects together in a curve", desc = "Join multiple objects together in a curve",
help = "Click to select some objects,click the same block twice to connect the objects.\n" + descFooter = "Click to select some objects,click the same block twice to connect the objects.\n" +
"Insufficient brush radius, or clicking the the wrong spot will result in undesired shapes. The shapes must be simple lines or loops.\n" + "Insufficient brush radius, or clicking the the wrong spot will result in undesired shapes. The shapes must be simple lines or loops.\n" +
"Pic1: http://i.imgur.com/CeRYAoV.jpg -> http://i.imgur.com/jtM0jA4.png\n" + "Pic1: http://i.imgur.com/CeRYAoV.jpg -> http://i.imgur.com/jtM0jA4.png\n" +
"Pic2: http://i.imgur.com/bUeyc72.png -> http://i.imgur.com/tg6MkcF.png" + "Pic2: http://i.imgur.com/bUeyc72.png -> http://i.imgur.com/tg6MkcF.png" +
@ -437,10 +440,10 @@ public class BrushCommands {
// Adapted from: https://github.com/Rafessor/VaeronTools // Adapted from: https://github.com/Rafessor/VaeronTools
@Command( @Command(
aliases = {"sweep", "sw", "vaesweep"}, name = "sweep",
usage = "[copies=-1]", aliases = {"sw", "vaesweep"},
desc = "Sweep your clipboard content along a curve", desc = "Sweep your clipboard content along a curve",
help = "Sweeps your clipboard content along a curve.\n" + descFooter = "Sweeps your clipboard content along a curve.\n" +
"Define a curve by selecting the individual points with a brush\n" + "Define a curve by selecting the individual points with a brush\n" +
"Set [copies] to a value > 0 if you want to have your selection pasted a limited amount of times equally spaced on the curve" "Set [copies] to a value > 0 if you want to have your selection pasted a limited amount of times equally spaced on the curve"
) )
@ -479,10 +482,10 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"catenary", "cat", "gravityline", "saggedline"}, name = "catenary",
usage = "<pattern> [lengthFactor=1.2] [size=0]", aliases = {"cat", "gravityline", "saggedline"},
desc = "Create a hanging line between two points", desc = "Create a hanging line between two points",
help = "Create a hanging line between two points.\n" + descFooter = "Create a hanging line between two points.\n" +
"The lengthFactor controls how long the line is\n" + "The lengthFactor controls how long the line is\n" +
"The -h flag creates only a shell\n" + "The -h flag creates only a shell\n" +
"The -s flag selects the clicked point after drawing\n" + "The -s flag selects the clicked point after drawing\n" +
@ -525,10 +528,10 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"sspl", "sspline", "surfacespline"}, name = "sspl",
usage = "<pattern> [size=0] [tension=0] [bias=0] [continuity=0] [quality=10]", aliases = {"sspline", "surfacespline"},
desc = "Draws a spline (curved line) on the surface", desc = "Draws a spline (curved line) on the surface",
help = "Create a spline on the surface\n" + descFooter = "Create a spline on the surface\n" +
"Video: https://www.youtube.com/watch?v=zSN-2jJxXlM" "Video: https://www.youtube.com/watch?v=zSN-2jJxXlM"
) )
@CommandPermissions("worldedit.brush.surfacespline") // 0, 0, 0, 10, 0, @CommandPermissions("worldedit.brush.surfacespline") // 0, 0, 0, 10, 0,
@ -569,9 +572,8 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"rock", "blob"}, name = "rock",
usage = "<pattern> [radius=10] [roundness=100] [frequency=30] [amplitude=50]", aliases = {"blob"},
flags = "h",
desc = "Creates a distorted sphere" desc = "Creates a distorted sphere"
) )
@CommandPermissions("worldedit.brush.rock") @CommandPermissions("worldedit.brush.rock")
@ -675,10 +677,10 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"shatter", "partition", "split"}, name = "shatter",
usage = "<pattern> [radius=10] [count=10]", aliases = {"partition", "split"},
desc = "Creates random lines to break the terrain into pieces", desc = "Creates random lines to break the terrain into pieces",
help = "Creates uneven lines separating terrain into multiple pieces\n" + descFooter = "Creates uneven lines separating terrain into multiple pieces\n" +
"Pic: https://i.imgur.com/2xKsZf2.png" "Pic: https://i.imgur.com/2xKsZf2.png"
) )
@CommandPermissions("worldedit.brush.shatter") @CommandPermissions("worldedit.brush.shatter")
@ -719,14 +721,12 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"stencil"}, name = "stencil",
usage = "<pattern> [radius=5] [file|#clipboard|imgur=null] [rotation=360] [yscale=1.0]",
desc = "Use a height map to paint a surface", desc = "Use a height map to paint a surface",
help = "Use a height map to paint any surface.\n" + descFooter = "Use a height map to paint any surface.\n" +
"The -w flag will only apply at maximum saturation\n" + "The -w flag will only apply at maximum saturation\n" +
"The -r flag will apply random rotation", "The -r flag will apply random rotation"
min = 1 )
)
@CommandPermissions("worldedit.brush.stencil") @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, @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 {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
@ -771,15 +771,13 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"image", "color"}, name = "image",
usage = "<radius> <image> [yscale=1]", aliases = {"color"},
desc = "Use a height map to paint a surface", desc = "Use a height map to paint a surface",
flags = "a", descFooter = "Use a height map to paint any surface.\n" +
help = "Use a height map to paint any surface.\n" +
"The -a flag will use image alpha\n" + "The -a flag will use image alpha\n" +
"The -f blends the image with the existing terrain", "The -f blends the image with the existing terrain"
min = 1 )
)
@CommandPermissions("worldedit.brush.stencil") @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, @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 {
BufferedImage image = imageUri.load(); BufferedImage image = imageUri.load();
@ -824,14 +822,13 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"surface", "surf"}, name = "surface",
usage = "<pattern> [radius=5]", aliases = {"surf"},
desc = "Use a height map to paint a surface", desc = "Use a height map to paint a surface",
help = "Use a height map to paint any surface.\n" + descFooter = "Use a height map to paint any surface.\n" +
"The -w flag will only apply at maximum saturation\n" + "The -w flag will only apply at maximum saturation\n" +
"The -r flag will apply random rotation", "The -r flag will apply random rotation"
min = 1 )
)
@CommandPermissions("worldedit.brush.surface") @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, @Optional("5") Expression radius, CommandContext context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
@ -868,12 +865,11 @@ public class BrushCommands {
@Command( @Command(
name = "scatter", name = "scatter",
usage = "<pattern> [radius=5] [points=5] [distance=1]",
desc = "Scatter a pattern on a surface", desc = "Scatter a pattern on a surface",
help = "Set a number of blocks randomly on a surface each a certain distance apart.\n" + descFooter = "Set a number of blocks randomly on a surface each a certain distance apart.\n" +
" The -o flag will overlay the block\n" + " The -o flag will overlay the block\n" +
"Video: https://youtu.be/RPZIaTbqoZw?t=34s", "Video: https://youtu.be/RPZIaTbqoZw?t=34s"
) )
@CommandPermissions("worldedit.brush.scatter") @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, @Optional("5") Expression radius, @Optional("5") double points, @Optional("1") double distance, @Switch('o') boolean overlay, CommandContext context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
@ -914,10 +910,10 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"populateschematic", "populateschem", "popschem", "pschem", "ps"}, name = "populateschematic",
usage = "<mask> <file|folder|url> [radius=30] [points=5]", aliases = {"populateschem", "popschem", "pschem", "ps"},
desc = "Scatter a schematic on a surface", desc = "Scatter a schematic on a surface",
help = "Chooses the scatter schematic brush.\n" + descFooter = "Chooses the scatter schematic brush.\n" +
"The -r flag will apply random rotation" "The -r flag will apply random rotation"
) )
@CommandPermissions("worldedit.brush.populateschematic") @CommandPermissions("worldedit.brush.populateschematic")
@ -973,9 +969,8 @@ public class BrushCommands {
@Command( @Command(
name = "layer", name = "layer",
usage = "<radius> [color|<pattern1> <patern2>...]",
desc = "Replaces terrain with a layer.", desc = "Replaces terrain with a layer.",
help = "Replaces terrain with a layer.\n" + descFooter = "Replaces terrain with a layer.\n" +
"Example: /br layer 5 95:1 95:2 35:15 - Places several layers on a surface\n" + "Example: /br layer 5 95:1 95:2 35:15 - Places several layers on a surface\n" +
"Pic: https://i.imgur.com/XV0vYoX.png" "Pic: https://i.imgur.com/XV0vYoX.png"
) )
@ -1037,7 +1032,7 @@ public class BrushCommands {
@Command( @Command(
name = "splatter", name = "splatter",
desc = "Splatter a pattern on a surface", desc = "Splatter a pattern on a surface",
help = "Sets a bunch of blocks randomly on a surface.\n" + descFooter = "Sets a bunch of blocks randomly on a surface.\n" +
"Pic: https://i.imgur.com/hMD29oO.png\n" + "Pic: https://i.imgur.com/hMD29oO.png\n" +
"Example: /br splatter stone,dirt 30 15\n" + "Example: /br splatter stone,dirt 30 15\n" +
"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." "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."
@ -1077,10 +1072,10 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"scmd", "scattercmd", "scattercommand", "scommand"}, name = "scmd",
usage = "<scatter-radius> <points> <cmd-radius=1> <cmd1;cmd2...>", aliases = {"scattercmd", "scattercommand", "scommand"},
desc = "Run commands at random points on a surface", desc = "Run commands at random points on a surface",
help = descFooter =
"Run commands at random points on a surface\n" + "Run commands at random points on a surface\n" +
" - The scatter radius is the min distance between each point\n" + " - The scatter radius is the min distance between each point\n" +
" - Your selection will be expanded to the specified size around each point\n" + " - Your selection will be expanded to the specified size around each point\n" +
@ -1209,7 +1204,7 @@ public class BrushCommands {
name = "clipboard", name = "clipboard",
aliases = { "copy" }, aliases = { "copy" },
desc = "Choose the clipboard brush (Recommended: `/br copypaste`)", desc = "Choose the clipboard brush (Recommended: `/br copypaste`)",
help = "Chooses the clipboard brush.\n" + descFooter = "Chooses the clipboard brush.\n" +
"The -a flag makes it not paste air.\n" + "The -a flag makes it not paste air.\n" +
"Without the -p flag, the paste will appear centered at the target location. " + "Without the -p flag, the paste will appear centered at the target location. " +
"With the flag, then the paste will appear relative to where you had " + "With the flag, then the paste will appear relative to where you had " +
@ -1409,11 +1404,10 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"height", "heightmap"}, name = "height",
usage = "[radius=5] [file|#clipboard|imgur=null] [rotation=0] [yscale=1.00]", aliases = {"heightmap"},
flags = "h",
desc = "Raise or lower terrain using a heightmap", desc = "Raise or lower terrain using a heightmap",
help = "This brush raises and lowers land.\n" + descFooter = "This brush raises and lowers land.\n" +
" - The `-r` flag enables random off-axis rotation\n" + " - The `-r` flag enables random off-axis rotation\n" +
" - The `-l` flag will work on snow layers\n" + " - The `-l` flag will work on snow layers\n" +
" - The `-s` flag disables smoothing\n" + " - The `-s` flag disables smoothing\n" +
@ -1426,11 +1420,10 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"cliff", "flatcylinder"}, name = "cliff",
usage = "[radius=5] [file|#clipboard|imgur=null] [rotation=0] [yscale=1.00]", aliases = {"flatcylinder"},
flags = "h",
desc = "Cliff brush", desc = "Cliff brush",
help = "This brush flattens terrain and creates cliffs.\n" + descFooter = "This brush flattens terrain and creates cliffs.\n" +
" - The `-r` flag enables random off-axis rotation\n" + " - The `-r` flag enables random off-axis rotation\n" +
" - The `-l` flag will work on snow layers\n" + " - The `-l` flag will work on snow layers\n" +
" - The `-s` flag disables smoothing" " - The `-s` flag disables smoothing"
@ -1441,10 +1434,9 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"flatten", "flatmap", "flat"}, name = "flatten",
usage = "[radius=5] [file|#clipboard|imgur=null] [rotation=0] [yscale=1.00]", aliases = {"flatmap", "flat"},
flags = "h", descFooter = "Flatten brush flattens terrain\n" +
help = "Flatten brush flattens terrain\n" +
" - The `-r` flag enables random off-axis rotation\n" + " - The `-r` flag enables random off-axis rotation\n" +
" - The `-l` flag will work on snow layers\n" + " - The `-l` flag will work on snow layers\n" +
" - The `-s` flag disables smoothing", " - The `-s` flag disables smoothing",
@ -1516,10 +1508,10 @@ public class BrushCommands {
@Command( @Command(
aliases = {"copypaste", "copy", "paste", "cp", "copypasta"}, name = "copypaste",
usage = "[depth=5]", aliases = {"copy", "paste", "cp", "copypasta"},
desc = "Copy Paste brush", desc = "Copy Paste brush",
help = "Left click the base of an object to copy.\n" + descFooter = "Left click the base of an object to copy.\n" +
"Right click to paste\n" + "Right click to paste\n" +
"The -r flag Will apply random rotation on paste\n" + "The -r flag Will apply random rotation on paste\n" +
"The -a flag Will apply auto view based rotation on paste\n" + "The -a flag Will apply auto view based rotation on paste\n" +
@ -1563,10 +1555,10 @@ public class BrushCommands {
} }
@Command( @Command(
aliases = {"command", "cmd"}, name = "command",
usage = "<radius> [cmd1;cmd2...]", aliases = {"cmd"},
desc = "Command brush", desc = "Command brush",
help = "Run the commands at the clicked position.\n" + descFooter = "Run the commands at the clicked position.\n" +
" - Your selection will be expanded to the specified size around each point\n" + " - Your selection will be expanded to the specified size around each point\n" +
" - Placeholders: {x}, {y}, {z}, {world}, {size}" " - Placeholders: {x}, {y}, {z}, {world}, {size}"
) )

View File

@ -55,13 +55,12 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"savebrush", "save"}, name = "savebrush",
usage = "[name]", aliases = {"save"},
desc = "Save your current brush", desc = "Save your current brush",
help = "Save your current brush\n" + descFooter = "Save your current brush\n" +
"use the -g flag to save globally", "use the -g flag to save globally"
min = 1 )
)
@CommandPermissions("worldedit.brush.save") @CommandPermissions("worldedit.brush.save")
public void saveBrush(Player player, LocalSession session, String name, @Switch('g') boolean root) throws WorldEditException, IOException { public void saveBrush(Player player, LocalSession session, String name, @Switch('g') boolean root) throws WorldEditException, IOException {
BrushTool tool = session.getBrushTool(player); BrushTool tool = session.getBrushTool(player);
@ -93,11 +92,10 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"loadbrush", "load"}, name = "loadbrush",
desc = "load a brush", aliases = {"load"},
usage = "[name]", desc = "load a brush"
min = 1 )
)
@CommandPermissions("worldedit.brush.load") @CommandPermissions("worldedit.brush.load")
public void loadBrush(Player player, LocalSession session, String name) throws WorldEditException, IOException { public void loadBrush(Player player, LocalSession session, String name) throws WorldEditException, IOException {
name = FileSystems.getDefault().getPath(name).getFileName().toString(); name = FileSystems.getDefault().getPath(name).getFileName().toString();
@ -130,13 +128,10 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"/listbrush"}, name = "/listbrush",
desc = "List saved brushes", desc = "List saved brushes",
usage = "[mine|<filter>] [page=1]",
min = 0,
max = -1, max = -1,
flags = "dnp", descFooter = "List all brushes in the brush directory\n" +
help = "List all brushes in the brush directory\n" +
" -p <page> prints the requested page\n" " -p <page> prints the requested page\n"
) )
@CommandPermissions("worldedit.brush.list") @CommandPermissions("worldedit.brush.list")
@ -153,20 +148,19 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"none", "/none"}, name = "none",
aliases = {"/none"},
usage = "", usage = "",
desc = "Unbind a bound tool from your current item", desc = "Unbind a bound tool from your current item"
min = 0, )
max = 0
)
public void none(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void none(Player player, LocalSession session, CommandContext args) throws WorldEditException {
session.setTool(player, null); session.setTool(player, null);
BBC.TOOL_NONE.send(player); BBC.TOOL_NONE.send(player);
} }
@Command( @Command(
aliases = {"/", ","}, name = "/",
usage = "[on|off]", aliases = {","},
desc = "Toggle the super pickaxe function" desc = "Toggle the super pickaxe function"
) )
@CommandPermissions("worldedit.superpickaxe") @CommandPermissions("worldedit.superpickaxe")
@ -192,12 +186,10 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"primary"}, name = "primary",
usage = "[brush-arguments]",
desc = "Set the right click brush", desc = "Set the right click brush",
help = "Set the right click brush", descFooter = "Set the right click brush"
min = 1 )
)
@CommandPermissions("worldedit.brush.primary") @CommandPermissions("worldedit.brush.primary")
public void primary(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void primary(Player player, LocalSession session, CommandContext args) throws WorldEditException {
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND); BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
@ -213,12 +205,10 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"secondary"}, name = "secondary",
usage = "[brush-arguments]",
desc = "Set the left click brush", desc = "Set the left click brush",
help = "Set the left click brush", descFooter = "Set the left click brush"
min = 1 )
)
@CommandPermissions("worldedit.brush.secondary") @CommandPermissions("worldedit.brush.secondary")
public void secondary(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void secondary(Player player, LocalSession session, CommandContext args) throws WorldEditException {
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND); BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
@ -234,16 +224,14 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"visualize", "visual", "vis"}, name = "visualize",
usage = "[mode=0]", aliases = {"visual", "vis"},
desc = "Toggle between different visualization modes", desc = "Toggle between different visualization modes",
help = "Toggle between different visualization modes\n" + descFooter = "Toggle between different visualization modes\n" +
"0 = No visualization\n" + "0 = No visualization\n" +
"1 = Single block at target position\n" + "1 = Single block at target position\n" +
"2 = Glass showing what blocks will be changed", "2 = Glass showing what blocks will be changed"
min = 0, )
max = 1
)
@CommandPermissions("worldedit.brush.visualize") @CommandPermissions("worldedit.brush.visualize")
public void visual(Player player, LocalSession session, @Range(min = 0, max = 2)int mode) throws WorldEditException { public void visual(Player player, LocalSession session, @Range(min = 0, max = 2)int mode) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false); BrushTool tool = session.getBrushTool(player, false);
@ -258,12 +246,10 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"target", "tar"}, name = "target",
usage = "[mode]", aliases = {"tar"},
desc = "Toggle between different target modes", desc = "Toggle between different target modes"
min = 0, )
max = 1
)
@CommandPermissions("worldedit.brush.target") @CommandPermissions("worldedit.brush.target")
public void target(Player player, LocalSession session, @Optional("0") int mode) throws WorldEditException { public void target(Player player, LocalSession session, @Optional("0") int mode) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false); BrushTool tool = session.getBrushTool(player, false);
@ -278,10 +264,9 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"targetmask", "tarmask", "tm"}, name = "targetmask",
usage = "[mask]", aliases = {"tarmask", "tm"},
desc = "Set the targeting mask", desc = "Set the targeting mask",
min = 1,
max = -1 max = -1
) )
@CommandPermissions("worldedit.brush.targetmask") @CommandPermissions("worldedit.brush.targetmask")
@ -302,10 +287,9 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"targetoffset", "to"}, name = "targetoffset",
usage = "[mask]", aliases = {"to"},
desc = "Set the targeting mask", desc = "Set the targeting mask",
min = 1,
max = -1 max = -1
) )
@CommandPermissions("worldedit.brush.targetoffset") @CommandPermissions("worldedit.brush.targetoffset")
@ -320,10 +304,8 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"scroll"}, name = "scroll",
usage = "[none|clipboard|mask|pattern|range|size|visual|target|targetoffset]",
desc = "Toggle between different target modes", desc = "Toggle between different target modes",
min = 1,
max = -1 max = -1
) )
@CommandPermissions("worldedit.brush.scroll") @CommandPermissions("worldedit.brush.scroll")
@ -347,10 +329,9 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"mask", "/mask"}, name = "mask",
usage = "[mask]", aliases = {"/mask"},
desc = "Set the brush destination mask", desc = "Set the brush destination mask",
min = 0,
max = -1 max = -1
) )
@CommandPermissions({"worldedit.brush.options.mask", "worldedit.mask.brush"}) @CommandPermissions({"worldedit.brush.options.mask", "worldedit.mask.brush"})
@ -379,11 +360,10 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"smask", "/smask", "/sourcemask", "sourcemask"}, name = "smask",
usage = "[mask]", aliases = {"/smask", "/sourcemask", "sourcemask"},
desc = "Set the brush source mask", desc = "Set the brush source mask",
help = "Set the brush source mask", descFooter = "Set the brush source mask",
min = 0,
max = -1 max = -1
) )
@CommandPermissions({"worldedit.brush.options.mask", "worldedit.mask.brush"}) @CommandPermissions({"worldedit.brush.options.mask", "worldedit.mask.brush"})
@ -412,10 +392,8 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"transform"}, name = "transform",
usage = "[transform]",
desc = "Set the brush transform", desc = "Set the brush transform",
min = 0,
max = -1 max = -1
) )
@CommandPermissions({"worldedit.brush.options.transform", "worldedit.transform.brush"}) @CommandPermissions({"worldedit.brush.options.transform", "worldedit.transform.brush"})
@ -444,12 +422,10 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"mat", "material"}, name = "mat",
usage = "[pattern]", aliases = {"material"},
desc = "Set the brush material", desc = "Set the brush material"
min = 1, )
max = 1
)
@CommandPermissions("worldedit.brush.options.material") @CommandPermissions("worldedit.brush.options.material")
public void material(Player player, EditSession editSession, LocalSession session, Pattern pattern, @Switch('h') boolean offHand, CommandContext context) throws WorldEditException { public void material(Player player, EditSession editSession, LocalSession session, Pattern pattern, @Switch('h') boolean offHand, CommandContext context) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false); BrushTool tool = session.getBrushTool(player, false);
@ -470,12 +446,9 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"range"}, name = "range",
usage = "[pattern]", desc = "Set the brush range"
desc = "Set the brush range", )
min = 1,
max = 1
)
@CommandPermissions("worldedit.brush.options.range") @CommandPermissions("worldedit.brush.options.range")
public void range(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void range(Player player, LocalSession session, CommandContext args) throws WorldEditException {
int range = Math.max(0, Math.min(256, args.getInteger(0))); int range = Math.max(0, Math.min(256, args.getInteger(0)));
@ -489,12 +462,9 @@ public class BrushOptionsCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"size"}, name = "size",
usage = "[pattern]", desc = "Set the brush size"
desc = "Set the brush size", )
min = 1,
max = 1
)
@CommandPermissions("worldedit.brush.options.size") @CommandPermissions("worldedit.brush.options.size")
public void size(Player player, LocalSession session, CommandContext args, @Switch('h') boolean offHand) throws WorldEditException { public void size(Player player, LocalSession session, CommandContext args, @Switch('h') boolean offHand) throws WorldEditException {
int radius = args.getInteger(0); int radius = args.getInteger(0);

View File

@ -379,8 +379,8 @@ public class ClipboardCommands {
@Command( @Command(
name = "asset", name = "asset",
desc = "Saves your clipboard to the asset web interface", desc = "Saves your clipboard to the asset web interface"
) )
@CommandPermissions({"worldedit.clipboard.asset"}) @CommandPermissions({"worldedit.clipboard.asset"})
public void asset(final Player player, final LocalSession session, String category) throws WorldEditException { public void asset(final Player player, final LocalSession session, String category) throws WorldEditException {
final ClipboardFormat format = BuiltInClipboardFormat.MCEDIT_SCHEMATIC; final ClipboardFormat format = BuiltInClipboardFormat.MCEDIT_SCHEMATIC;
@ -479,8 +479,8 @@ public class ClipboardCommands {
@Command( @Command(
name = "/place", name = "/place",
desc = "Place the clipboard's contents without applying transformations (e.g. rotate)", desc = "Place the clipboard's contents without applying transformations (e.g. rotate)"
) )
@CommandPermissions("worldedit.clipboard.place") @CommandPermissions("worldedit.clipboard.place")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public void place(Player player, LocalSession session, final EditSession editSession, public void place(Player player, LocalSession session, final EditSession editSession,

View File

@ -71,8 +71,8 @@ public class HistoryCommands extends MethodCommands {
@Command( @Command(
name = "fawerollback", name = "fawerollback",
aliases = {"/frb", "frb", "fawerollback", "/fawerollback", "/rollback"}, name = "/frb",
usage = "<user=Empire92> <radius=5> <time=3d4h>", aliases = {"frb", "fawerollback", "/fawerollback", "/rollback"},
desc = "Undo a specific edit. " + desc = "Undo a specific edit. " +
" - The time uses s, m, h, d, y.\n" + " - The time uses s, m, h, d, y.\n" +
" - Import from disk: /frb #import" " - Import from disk: /frb #import"
@ -199,7 +199,6 @@ public class HistoryCommands extends MethodCommands {
@Command( @Command(
name = "fawerestore", name = "fawerestore",
alias = {"/fawerestore", "/frestore"}, alias = {"/fawerestore", "/frestore"},
usage = "<user=Empire92|*> <radius=5> <time=3d4h>",
desc = "Redo a specific edit. " + desc = "Redo a specific edit. " +
" - The time uses s, m, h, d, y.\n" + " - The time uses s, m, h, d, y.\n" +
" - Import from disk: /frb #import" " - Import from disk: /frb #import"

View File

@ -25,7 +25,7 @@ import java.util.function.Predicate;
@Command(aliases = {"masks"}, @Command(aliases = {"masks"},
desc = "Help for the various masks. [More Info](https://git.io/v9r4K)", desc = "Help for the various masks. [More Info](https://git.io/v9r4K)",
help = "Masks determine if a block can be placed\n" + descFooter = "Masks determine if a block can be placed\n" +
" - Use [brackets] for arguments\n" + " - Use [brackets] for arguments\n" +
" - Use , to OR multiple\n" + " - Use , to OR multiple\n" +
" - Use & to AND multiple\n" + " - Use & to AND multiple\n" +
@ -38,12 +38,9 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#simplex"}, name = "#simplex",
desc = "Use simplex noise as the mask", desc = "Use simplex noise as the mask"
usage = "<scale=10> <min=0> <max=100>", )
min = 3,
max = 3
)
public Mask simplex(double scale, double min, double max) { public Mask simplex(double scale, double min, double max) {
scale = (1d / Math.max(1, scale)); scale = (1d / Math.max(1, scale));
min = (min - 50) / 50; min = (min - 50) / 50;
@ -52,18 +49,16 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#light"}, name = "#light",
desc = "Restrict to specific light levels", desc = "Restrict to specific light levels"
usage = "<min> <max>", )
min = 2,
max = 2
)
public Mask light(Extent extent, double min, double max) { public Mask light(Extent extent, double min, double max) {
return new LightMask(extent, (int) min, (int) max); return new LightMask(extent, (int) min, (int) max);
} }
@Command( @Command(
aliases = {"false", "#false"}, name = "false",
aliases = {"#false"},
desc = "Always false" desc = "Always false"
) )
public Mask falseMask(Extent extent) { public Mask falseMask(Extent extent) {
@ -71,7 +66,8 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"true", "#true"}, name = "true",
aliases = {"#true"},
desc = "Always true" desc = "Always true"
) )
public Mask trueMask(Extent extent) { public Mask trueMask(Extent extent) {
@ -79,62 +75,48 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#skylight"}, name = "#skylight",
desc = "Restrict to specific sky light levels", desc = "Restrict to specific sky light levels"
usage = "<min> <max>", )
min = 2,
max = 2
)
public Mask skylight(Extent extent, double min, double max) { public Mask skylight(Extent extent, double min, double max) {
return new SkyLightMask(extent, (int) min, (int) max); return new SkyLightMask(extent, (int) min, (int) max);
} }
@Command( @Command(
aliases = {"#blocklight", "#emittedlight"}, name = "#blocklight",
desc = "Restrict to specific block light levels", aliases = {"#emittedlight"},
usage = "<min> <max>", desc = "Restrict to specific block light levels"
min = 2, )
max = 2
)
public Mask blocklight(Extent extent, double min, double max) { public Mask blocklight(Extent extent, double min, double max) {
return new BlockLightMask(extent, (int) min, (int) max); return new BlockLightMask(extent, (int) min, (int) max);
} }
@Command( @Command(
aliases = {"#opacity"}, name = "#opacity",
desc = "Restrict to specific opacity levels", desc = "Restrict to specific opacity levels"
usage = "<min> <max>", )
min = 2,
max = 2
)
public Mask opacity(Extent extent, double min, double max) { public Mask opacity(Extent extent, double min, double max) {
return new OpacityMask(extent, (int) min, (int) max); return new OpacityMask(extent, (int) min, (int) max);
} }
@Command( @Command(
aliases = {"#brightness"}, name = "#brightness",
desc = "Restrict to specific block brightness", desc = "Restrict to specific block brightness"
usage = "<min> <max>", )
min = 2,
max = 2
)
public Mask brightness(Extent extent, double min, double max) { public Mask brightness(Extent extent, double min, double max) {
return new BrightnessMask(extent, (int) min, (int) max); return new BrightnessMask(extent, (int) min, (int) max);
} }
@Command( @Command(
aliases = {"#offset"}, name = "#offset",
desc = "Offset a mask", desc = "Offset a mask"
usage = "<dx> <dy> <dz> <mask>", )
min = 4,
max = 4
)
public Mask offset(double x, double y, double z, Mask mask) { public Mask offset(double x, double y, double z, Mask mask) {
return new OffsetMask(mask, BlockVector3.at(x, y, z)); return new OffsetMask(mask, BlockVector3.at(x, y, z));
} }
@Command( @Command(
aliases = {"#haslight"}, name = "#haslight",
desc = "Restricts to blocks with light (sky or emitted)" desc = "Restricts to blocks with light (sky or emitted)"
) )
public Mask haslight(Extent extent) { public Mask haslight(Extent extent) {
@ -142,7 +124,7 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#nolight"}, name = "#nolight",
desc = "Restrict to blocks without light (sky or emitted)" desc = "Restrict to blocks without light (sky or emitted)"
) )
public Mask nolight(Extent extent) { public Mask nolight(Extent extent) {
@ -150,7 +132,7 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#existing"}, name = "#existing",
desc = "If there is a non air block" desc = "If there is a non air block"
) )
public Mask existing(Extent extent) { public Mask existing(Extent extent) {
@ -158,7 +140,7 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#solid"}, name = "#solid",
desc = "If there is a solid block" desc = "If there is a solid block"
) )
public Mask solid(Extent extent) { public Mask solid(Extent extent) {
@ -166,7 +148,7 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#liquid"}, name = "#liquid",
desc = "If there is a solid block" desc = "If there is a solid block"
) )
public Mask liquid(Extent extent) { public Mask liquid(Extent extent) {
@ -174,7 +156,8 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#dregion", "#dselection", "#dsel"}, name = "#dregion",
aliases = {"#dselection", "#dsel"},
desc = "inside the player's selection" desc = "inside the player's selection"
) )
public Mask dregion() { public Mask dregion() {
@ -182,7 +165,8 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#region", "#selection", "#sel"}, name = "#region",
aliases = {"#selection", "#sel"},
desc = "inside the provided selection" desc = "inside the provided selection"
) )
public Mask selection(Player player, LocalSession session) throws IncompleteRegionException { public Mask selection(Player player, LocalSession session) throws IncompleteRegionException {
@ -190,7 +174,7 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#xaxis"}, name = "#xaxis",
desc = "Restrict to initial x axis" desc = "Restrict to initial x axis"
) )
public Mask xaxis() { public Mask xaxis() {
@ -198,7 +182,7 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#yaxis"}, name = "#yaxis",
desc = "Restrict to initial y axis" desc = "Restrict to initial y axis"
) )
public Mask yaxis() { public Mask yaxis() {
@ -206,7 +190,7 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#zaxis"}, name = "#zaxis",
desc = "Restrict to initial z axis" desc = "Restrict to initial z axis"
) )
public Mask zaxis() { public Mask zaxis() {
@ -214,7 +198,7 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#id"}, name = "#id",
desc = "Restrict to initial id" desc = "Restrict to initial id"
) )
public Mask id(Extent extent) { public Mask id(Extent extent) {
@ -222,7 +206,7 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#data"}, name = "#data",
desc = "Restrict to initial data" desc = "Restrict to initial data"
) )
public Mask data(Extent extent) { public Mask data(Extent extent) {
@ -230,7 +214,7 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#iddata"}, name = "#iddata",
desc = "Restrict to initial block id and data" desc = "Restrict to initial block id and data"
) )
public Mask iddata(Extent extent) { public Mask iddata(Extent extent) {
@ -238,7 +222,7 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#air"}, name = "#air",
desc = "Restrict to types of air" desc = "Restrict to types of air"
) )
public Mask air(Extent extent) { public Mask air(Extent extent) {
@ -246,7 +230,7 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#wall"}, name = "#wall",
desc = "Restrict to walls (any block n,e,s,w of air)" desc = "Restrict to walls (any block n,e,s,w of air)"
) )
public Mask wall(Extent extent) { public Mask wall(Extent extent) {
@ -255,7 +239,7 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#surface"}, name = "#surface",
desc = "Restrict to surfaces (any solid block touching air)" desc = "Restrict to surfaces (any solid block touching air)"
) )
public Mask surface(Extent extent) { public Mask surface(Extent extent) {
@ -263,17 +247,16 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"\\", "/", "#angle", "#\\", "#/"}, name = "\\",
aliases = {"/", "#angle", "#\\", "#/"},
desc = "Restrict to specific terrain angle", desc = "Restrict to specific terrain angle",
help = "Restrict to specific terrain angle\n" + descFooter = "Restrict to specific terrain angle\n" +
"The -o flag will only overlay\n" + "The -o flag will only overlay\n" +
"Example: /[0d][45d]\n" + "Example: /[0d][45d]\n" +
"Explanation: Allows any block where the adjacent block is between 0 and 45 degrees.\n" + "Explanation: Allows any block where the adjacent block is between 0 and 45 degrees.\n" +
"Example: /[3][20]\n" + "Example: /[3][20]\n" +
"Explanation: Allows any block where the adjacent block is between 3 and 20 blocks below", "Explanation: Allows any block where the adjacent block is between 3 and 20 blocks below"
usage = "<min> <max> [distance=1]", )
min = 2
)
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, @Optional("1") int distance) throws ExpressionException {
double y1, y2; double y1, y2;
boolean override; boolean override;
@ -290,16 +273,15 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"(", ")", "#roc", "#(", "#)"}, name = "(",
aliases = {")", "#roc", "#(", "#)"},
desc = "Restrict to near specific terrain slope rate of change", desc = "Restrict to near specific terrain slope rate of change",
help = "Restrict to near specific terrain slope rate of change\n" + descFooter = "Restrict to near specific terrain slope rate of change\n" +
"The -o flag will only overlay\n" + "The -o flag will only overlay\n" +
"Example: ([0d][45d][5]\n" + "Example: ([0d][45d][5]\n" +
"Explanation: Restrict near where the angle changes between 0-45 degrees within 5 blocks\n" + "Explanation: Restrict near where the angle changes between 0-45 degrees within 5 blocks\n" +
"Note: Use negatives for decreasing slope", "Note: Use negatives for decreasing slope"
usage = "<min> <max> [distance=4]", )
min = 2
)
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, @Optional("4") int distance) throws ExpressionException {
double y1, y2; double y1, y2;
boolean override; boolean override;
@ -316,17 +298,15 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"^", "#extrema", "#^"}, name = "^",
aliases = {"#extrema", "#^"},
desc = "Restrict to near specific terrain extrema", desc = "Restrict to near specific terrain extrema",
help = "Restrict to near specific terrain extrema\n" + descFooter = "Restrict to near specific terrain extrema\n" +
"The -o flag will only overlay\n" + "The -o flag will only overlay\n" +
"Example: ([0d][45d][5]\n" + "Example: ([0d][45d][5]\n" +
"Explanation: Restrict to near 45 degrees of local maxima\n" + "Explanation: Restrict to near 45 degrees of local maxima\n" +
"Note: Use negatives for local minima", "Note: Use negatives for local minima"
usage = "<min> <max> [distance=1]", )
min = 2,
max = 4
)
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, @Optional("4") int distance) throws ExpressionException {
double y1, y2; double y1, y2;
boolean override; boolean override;
@ -343,34 +323,28 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"{", "#{"}, name = "{",
desc = "Restricts blocks to within a specific radius range of the initial block", aliases = {"#{"},
usage = "<min> <max>", desc = "Restricts blocks to within a specific radius range of the initial block"
min = 2, )
max = 2
)
public Mask radius(double min, double max) throws ExpressionException { public Mask radius(double min, double max) throws ExpressionException {
return new RadiusMask((int) min, (int) max); return new RadiusMask((int) min, (int) max);
} }
@Command( @Command(
aliases = {"|", "#|", "#side"}, name = "|",
desc = "sides with a specific number of other blocks", aliases = {"#|", "#side"},
usage = "<mask> <min> <max>", desc = "sides with a specific number of other blocks"
min = 3, )
max = 3
)
public Mask wall(Mask mask, double min, double max) throws ExpressionException { public Mask wall(Mask mask, double min, double max) throws ExpressionException {
return new WallMask(mask, (int) min, (int) max); return new WallMask(mask, (int) min, (int) max);
} }
@Command( @Command(
aliases = {"~", "#~", "#adjacent"}, name = "~",
desc = "Adjacent to a specific number of other blocks", aliases = {"#~", "#adjacent"},
usage = "<mask> [min=1] [max=8]", desc = "Adjacent to a specific number of other blocks"
min = 1, )
max = 3
)
public Mask adjacent(Mask mask, @Optional("-1") double min, @Optional("-1") double max) throws ExpressionException { public Mask adjacent(Mask mask, @Optional("-1") double min, @Optional("-1") double max) throws ExpressionException {
if (min == -1 && max == -1) { if (min == -1 && max == -1) {
min = 1; min = 1;
@ -383,60 +357,50 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"<", "#<", "#below"}, name = "<",
desc = "below a specific block", aliases = {"#<", "#below"},
usage = "<mask>", desc = "below a specific block"
min = 1, )
max = 1
)
public Mask below(Mask mask) throws ExpressionException { public Mask below(Mask mask) throws ExpressionException {
OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, 1, 0)); OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, 1, 0));
return new MaskIntersection(offsetMask, Masks.negate(mask)); return new MaskIntersection(offsetMask, Masks.negate(mask));
} }
@Command( @Command(
aliases = {">", "#>", "#above"}, name = ">",
desc = "above a specific block", aliases = {"#>", "#above"},
usage = "<mask>", desc = "above a specific block"
min = 1, )
max = 1
)
public Mask above(Mask mask) throws ExpressionException { public Mask above(Mask mask) throws ExpressionException {
OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, -1, 0)); OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, -1, 0));
return new MaskIntersection(offsetMask, Masks.negate(mask)); return new MaskIntersection(offsetMask, Masks.negate(mask));
} }
@Command( @Command(
aliases = {"$", "#biome", "#$"}, name = "$",
aliases = {"#biome", "#$"},
desc = "in a specific biome", desc = "in a specific biome",
help = "in a specific biome. For a list of biomes use //biomelist", descFooter = "in a specific biome. For a list of biomes use //biomelist"
usage = "<biome>", )
min = 1,
max = 1
)
public Mask biome(Extent extent, BiomeType biome) throws ExpressionException { public Mask biome(Extent extent, BiomeType biome) throws ExpressionException {
return new BiomeMask(extent, biome); return new BiomeMask(extent, biome);
} }
@Command( @Command(
aliases = {"%", "#%", "#percent"}, name = "%",
desc = "percentage chance", aliases = {"#%", "#percent"},
usage = "<chance>", desc = "percentage chance"
min = 1, )
max = 1
)
public Mask random(double chance) throws ExpressionException { public Mask random(double chance) throws ExpressionException {
chance = chance / 100; chance = chance / 100;
return new RandomMask(chance); return new RandomMask(chance);
} }
@Command( @Command(
aliases = {"=", "#=", "#expression"}, name = "=",
desc = "expression mask", aliases = {"#=", "#expression"},
usage = "<expression>", desc = "expression mask"
min = 1, )
max = 1
)
public Mask expression(Extent extent, String input) throws ExpressionException { public Mask expression(Extent extent, String input) throws ExpressionException {
Expression exp = Expression.compile(input, "x", "y", "z"); Expression exp = Expression.compile(input, "x", "y", "z");
WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO); WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
@ -445,12 +409,10 @@ public class MaskCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"!", "#not", "#negate", "#!"}, name = "!",
desc = "Negate another mask", aliases = {"#not", "#negate", "#!"},
usage = "<mask>", desc = "Negate another mask"
min = 1, )
max = 1
)
public Mask expression(Mask mask) throws ExpressionException { public Mask expression(Mask mask) throws ExpressionException {
return Masks.negate(mask); return Masks.negate(mask);
} }

View File

@ -54,7 +54,8 @@ public class OptionsCommands {
} }
@Command( @Command(
aliases = {"/tips", "tips"}, name = "/tips",
aliases = {"tips"},
desc = "Toggle FAWE tips" desc = "Toggle FAWE tips"
) )
@CommandPermissions("fawe.tips") @CommandPermissions("fawe.tips")
@ -68,12 +69,9 @@ public class OptionsCommands {
} }
@Command( @Command(
aliases = {"/fast"}, name = "/fast",
usage = "[on|off]", desc = "Toggles FAWE undo"
desc = "Toggles FAWE undo", )
min = 0,
max = 1
)
@CommandPermissions("worldedit.fast") @CommandPermissions("worldedit.fast")
public void fast(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void fast(Player player, LocalSession session, CommandContext args) throws WorldEditException {
@ -98,11 +96,10 @@ public class OptionsCommands {
} }
@Command( @Command(
aliases = {"/gtexture", "gtexture"}, name = "/gtexture",
usage = "[mask|#clipboard|complexity] [randomization=true]", aliases = {"gtexture"},
help = "The global destination mask applies to all edits you do and masks based on the destination blocks (i.e. the blocks in the world).", descFooter = "The global destination mask applies to all edits you do and masks based on the destination blocks (i.e. the blocks in the world).",
desc = "Set the global mask", desc = "Set the global mask",
min = 0,
max = -1 max = -1
) )
@CommandPermissions("worldedit.global-texture") @CommandPermissions("worldedit.global-texture")
@ -158,11 +155,10 @@ public class OptionsCommands {
} }
@Command( @Command(
aliases = {"/gmask", "gmask", "globalmask", "/globalmask"}, name = "/gmask",
usage = "[mask]", aliases = {"gmask", "globalmask", "/globalmask"},
help = "The global destination mask applies to all edits you do and masks based on the destination blocks (i.e. the blocks in the world).", descFooter = "The global destination mask applies to all edits you do and masks based on the destination blocks (i.e. the blocks in the world).",
desc = "Set the global mask", desc = "Set the global mask",
min = 0,
max = -1 max = -1
) )
@CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"}) @CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"})
@ -183,11 +179,10 @@ public class OptionsCommands {
} }
@Command( @Command(
aliases = {"/gsmask", "gsmask", "globalsourcemask", "/globalsourcemask"}, name = "/gsmask",
usage = "[mask]", aliases = {"gsmask", "globalsourcemask", "/globalsourcemask"},
desc = "Set the global source mask", desc = "Set the global source mask",
help = "The global source mask applies to all edits you do and masks based on the source blocks (e.g. the blocks in your clipboard)", descFooter = "The global source mask applies to all edits you do and masks based on the source blocks (e.g. the blocks in your clipboard)",
min = 0,
max = -1 max = -1
) )
@CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"}) @CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"})
@ -208,10 +203,9 @@ public class OptionsCommands {
} }
@Command( @Command(
aliases = {"/gtransform", "gtransform"}, name = "/gtransform",
usage = "[transform]", aliases = {"gtransform"},
desc = "Set the global transform", desc = "Set the global transform",
min = 0,
max = -1 max = -1
) )
@CommandPermissions({"worldedit.global-transform", "worldedit.transform.global"}) @CommandPermissions({"worldedit.global-transform", "worldedit.transform.global"})
@ -232,12 +226,11 @@ public class OptionsCommands {
} }
@Command( @Command(
aliases = {"/toggleplace", "toggleplace"}, name = "/toggleplace",
aliases = {"toggleplace"},
usage = "", usage = "",
desc = "Switch between your position and pos1 for placement", desc = "Switch between your position and pos1 for placement"
min = 0, )
max = 0
)
public void togglePlace(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void togglePlace(Player player, LocalSession session, CommandContext args) throws WorldEditException {
if (session.togglePlacementPosition()) { if (session.togglePlacementPosition()) {
@ -248,12 +241,9 @@ public class OptionsCommands {
} }
@Command( @Command(
aliases = { "/timeout" }, name = "/timeout",
usage = "[time]", desc = "Modify evaluation timeout time."
desc = "Modify evaluation timeout time.", )
min = 0,
max = 1
)
@CommandPermissions("worldedit.timeout") @CommandPermissions("worldedit.timeout")
public void timeout(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void timeout(Player player, LocalSession session, CommandContext args) throws WorldEditException {
@ -278,12 +268,9 @@ public class OptionsCommands {
} }
@Command( @Command(
aliases = { "/drawsel" }, name = "/drawsel",
usage = "[on|off]", desc = "Toggle drawing the current selection"
desc = "Toggle drawing the current selection", )
min = 0,
max = 1
)
@CommandPermissions("worldedit.drawsel") @CommandPermissions("worldedit.drawsel")
public void drawSelection(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void drawSelection(Player player, LocalSession session, CommandContext args) throws WorldEditException {
@ -313,18 +300,15 @@ public class OptionsCommands {
} }
@Command( @Command(
aliases = {"/searchitem", "/l", "/search", "searchitem"}, name = "/searchitem",
usage = "<query>", aliases = {"/l", "/search", "searchitem"},
flags = "bi",
desc = "Search for an item", desc = "Search for an item",
help = descFooter =
"Searches for an item.\n" + "Searches for an item.\n" +
"Flags:\n" + "Flags:\n" +
" -b only search for blocks\n" + " -b only search for blocks\n" +
" -i only search for items", " -i only search for items"
min = 1, )
max = 1
)
@CommandPermissions("worldedit.searchitem") @CommandPermissions("worldedit.searchitem")
public void searchItem(Actor actor, CommandContext args) throws WorldEditException { public void searchItem(Actor actor, CommandContext args) throws WorldEditException {

View File

@ -29,6 +29,8 @@ import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.command.binding.Range; import com.sk89q.worldedit.util.command.binding.Range;
import com.sk89q.worldedit.util.command.parametric.Optional; import com.sk89q.worldedit.util.command.parametric.Optional;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import org.enginehub.piston.annotation.param.Arg;
import java.awt.Color; import java.awt.Color;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
@ -37,7 +39,7 @@ import java.util.Set;
@Command(aliases = {"patterns"}, @Command(aliases = {"patterns"},
desc = "Help for the various patterns. [More Info](https://git.io/vSPmA)", desc = "Help for the various patterns. [More Info](https://git.io/vSPmA)",
help = "Patterns determine what blocks are placed\n" + descFooter = "Patterns determine what blocks are placed\n" +
" - Use [brackets] for arguments\n" + " - Use [brackets] for arguments\n" +
" - Use , to OR multiple\n" + " - Use , to OR multiple\n" +
"e.g. #surfacespread[10][#existing],andesite\n" + "e.g. #surfacespread[10][#existing],andesite\n" +
@ -49,7 +51,8 @@ public class PatternCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#existing", "#*", "*", ".*"}, name = "#existing",
aliases = {"#*", "*", ".*"},
desc = "Use the block that is already there", desc = "Use the block that is already there",
usage = "[properties]" usage = "[properties]"
) )
@ -59,7 +62,8 @@ public class PatternCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#clipboard", "#copy"}, name = "#clipboard",
aliases = {"#copy"},
desc = "Use the blocks in your clipboard as the pattern") desc = "Use the blocks in your clipboard as the pattern")
public Pattern clipboard(LocalSession session) throws EmptyClipboardException { public Pattern clipboard(LocalSession session) throws EmptyClipboardException {
ClipboardHolder holder = session.getClipboard(); ClipboardHolder holder = session.getClipboard();
@ -68,13 +72,10 @@ public class PatternCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#simplex"}, name = "#simplex",
desc = "Use simplex noise to randomize blocks. Tutorial: https://imgur.com/a/rwVAE", desc = "Use simplex noise to randomize blocks. Tutorial: https://imgur.com/a/rwVAE"
usage = "<scale=10> <pattern>", )
min = 2, public Pattern simplex(@Arg() double scale, Pattern other) {
max = 2
)
public Pattern simplex(double scale, Pattern other) {
if (other instanceof RandomPattern) { if (other instanceof RandomPattern) {
scale = (1d / Math.max(1, scale)); scale = (1d / Math.max(1, scale));
RandomCollection<Pattern> collection = ((RandomPattern) other).getCollection(); RandomCollection<Pattern> collection = ((RandomPattern) other).getCollection();
@ -84,31 +85,24 @@ public class PatternCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#color"}, name = "#color",
desc = "Use the block closest to a specific color", desc = "Use the block closest to a specific color"
usage = "<color>", )
min = 1, public Pattern color(TextureUtil textureUtil, String color) {
max = 1 Color colorObj = ColorUtil.parseColor(color);
) return textureUtil.getNearestBlock(colorObj.getRGB()).getDefaultState();
public Pattern color(TextureUtil textureUtil, String arg) {
Color color = ColorUtil.parseColor(arg);
return textureUtil.getNearestBlock(color.getRGB()).getDefaultState();
} }
@Command( @Command(
aliases = {"#anglecolor"}, name = "#anglecolor",
desc = "A darker block based on the existing terrain angle", desc = "A darker block based on the existing terrain angle"
usage = "[randomize=true] [max-complexity=100] [distance=1]", )
min = 0,
max = 3
)
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, @Optional("true") boolean randomize, @Optional("100") double maxComplexity, @Optional("1") int distance) {
return new AngleColorPattern(extent, session, distance); return new AngleColorPattern(extent, session, distance);
} }
@Command( @Command(
aliases = {"#angledata"}, name = "#angledata",
usage = "[distance=1]",
desc = "Block data based on the existing terrain angle" desc = "Block data based on the existing terrain angle"
) )
public Pattern angledata(Extent extent, @Optional("1") int distance) { public Pattern angledata(Extent extent, @Optional("1") int distance) {
@ -116,67 +110,51 @@ public class PatternCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#saturate"}, name = "#saturate",
desc = "Saturate the existing block with a color", desc = "Saturate the existing block with a color"
usage = "<color>", )
min = 1,
max = 3
)
public Pattern saturate(Extent extent, LocalSession session, String arg) { public Pattern saturate(Extent extent, LocalSession session, String arg) {
Color color = ColorUtil.parseColor(arg); Color color = ColorUtil.parseColor(arg);
return new SaturatePattern(extent, color.getRGB(), session); return new SaturatePattern(extent, color.getRGB(), session);
} }
@Command( @Command(
aliases = {"#averagecolor"}, name = "#averagecolor",
desc = "Average between the existing block and a color", desc = "Average between the existing block and a color"
usage = "<color>", )
min = 1,
max = 3
)
public Pattern averagecolor(Extent extent, LocalSession session, String arg) { public Pattern averagecolor(Extent extent, LocalSession session, String arg) {
Color color = ColorUtil.parseColor(arg); Color color = ColorUtil.parseColor(arg);
return new AverageColorPattern(extent, color.getRGB(), session); return new AverageColorPattern(extent, color.getRGB(), session);
} }
@Command( @Command(
aliases = {"#desaturate"}, name = "#desaturate",
desc = "Desaturated color of the existing block", desc = "Desaturated color of the existing block"
usage = "[percent=100] [randomize=true] [max-complexity=100]", )
min = 0,
max = 3
)
public Pattern desaturate(Extent extent, LocalSession session, @Optional("100") double percent) { public Pattern desaturate(Extent extent, LocalSession session, @Optional("100") double percent) {
return new DesaturatePattern(extent, percent / 100d, session); return new DesaturatePattern(extent, percent / 100d, session);
} }
@Command( @Command(
aliases = {"#lighten"}, name = "#lighten",
desc = "Lighten the existing block", desc = "Lighten the existing block"
min = 0, )
max = 2
)
public Pattern lighten(Extent extent, TextureUtil util) { public Pattern lighten(Extent extent, TextureUtil util) {
return new ShadePattern(extent, false, util); return new ShadePattern(extent, false, util);
} }
@Command( @Command(
aliases = {"#darken"}, name = "#darken",
desc = "Darken the existing block", desc = "Darken the existing block"
min = 0, )
max = 2
)
public Pattern darken(Extent extent, TextureUtil util) { public Pattern darken(Extent extent, TextureUtil util) {
return new ShadePattern(extent, true, util); return new ShadePattern(extent, true, util);
} }
@Command( @Command(
aliases = {"#fullcopy"}, name = "#fullcopy",
desc = "Places your full clipboard at each block", desc = "Places your full clipboard at each block"
usage = "[schem|folder|url=#copy] [rotate=false] [flip=false]", )
min = 0,
max = 2
)
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, @Optional("#copy") String location, @Optional("false") boolean rotate, @Optional("false") boolean flip) throws EmptyClipboardException, InputParseException, IOException {
List<ClipboardHolder> clipboards; List<ClipboardHolder> clipboards;
switch (location.toLowerCase()) { switch (location.toLowerCase()) {
@ -203,184 +181,143 @@ public class PatternCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#buffer"}, name = "#buffer",
desc = "Only place a block once while a pattern is in use", desc = "Only place a block once while a pattern is in use",
help = "Only place a block once while a pattern is in use\n" + descFooter = "Only place a block once while a pattern is in use\n" +
"Use with a brush when you don't want to apply to the same spot twice", "Use with a brush when you don't want to apply to the same spot twice"
usage = "<pattern>", )
min = 1,
max = 1
)
public Pattern buffer(Actor actor, Pattern pattern) { public Pattern buffer(Actor actor, Pattern pattern) {
return new BufferedPattern(FawePlayer.wrap(actor), pattern); return new BufferedPattern(FawePlayer.wrap(actor), pattern);
} }
@Command( @Command(
aliases = {"#buffer2d"}, name = "#buffer2d",
desc = "Only place a block once in a column while a pattern is in use", desc = "Only place a block once in a column while a pattern is in use"
usage = "<pattern>", )
min = 1,
max = 1
)
public Pattern buffer2d(Actor actor, Pattern pattern) { public Pattern buffer2d(Actor actor, Pattern pattern) {
return new BufferedPattern2D(FawePlayer.wrap(actor), pattern); return new BufferedPattern2D(FawePlayer.wrap(actor), pattern);
} }
@Command( @Command(
aliases = {"#iddatamask"}, name = "#iddatamask",
desc = "Use the pattern's id and the existing blocks data with the provided mask", desc = "Use the pattern's id and the existing blocks data with the provided mask",
help = "Use the pattern's id and the existing blocks data with the provided mask\n" + descFooter = "Use the pattern's id and the existing blocks data with the provided mask\n" +
" - Use to replace slabs or where the data values needs to be shifted instead of set", " - Use to replace slabs or where the data values needs to be shifted instead of set"
usage = "<bitmask=15> <pattern>", )
min = 2,
max = 2
)
public Pattern iddatamask(Actor actor, LocalSession session, Extent extent, @Range(min = 0, max = 15) int bitmask, Pattern pattern) { public Pattern iddatamask(Actor actor, LocalSession session, Extent extent, @Range(min = 0, max = 15) int bitmask, Pattern pattern) {
return new IdDataMaskPattern(extent, pattern, bitmask); return new IdDataMaskPattern(extent, pattern, bitmask);
} }
@Command( @Command(
aliases = {"#id"}, name = "#id",
desc = "Only change the block id", desc = "Only change the block id"
usage = "<pattern>", )
min = 1,
max = 1
)
public Pattern id(Actor actor, LocalSession session, Extent extent, Pattern pattern) { public Pattern id(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
return new IdPattern(extent, pattern); return new IdPattern(extent, pattern);
} }
@Command( @Command(
aliases = {"#data"}, name = "#data",
desc = "Only change the block data", desc = "Only change the block data"
usage = "<pattern>", )
min = 1,
max = 1
)
public Pattern data(Actor actor, LocalSession session, Extent extent, Pattern pattern) { public Pattern data(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
return new DataPattern(extent, pattern); return new DataPattern(extent, pattern);
} }
@Command( @Command(
aliases = {"#biome", "$"}, name = "#biome",
desc = "Set the biome", aliases = {"$"},
usage = "<biome>", desc = "Set the biome"
min = 1, )
max = 1
)
public Pattern biome(Actor actor, LocalSession session, Extent extent, BiomeType biome) { public Pattern biome(Actor actor, LocalSession session, Extent extent, BiomeType biome) {
return new BiomePattern(extent, biome); return new BiomePattern(extent, biome);
} }
@Command( @Command(
aliases = {"#relative", "#~", "#r", "#rel"}, name = "#relative",
desc = "Offset the pattern to where you click", aliases = {"#~", "#r", "#rel"},
usage = "<pattern>", desc = "Offset the pattern to where you click"
min = 1, )
max = 1
)
public Pattern relative(Actor actor, LocalSession session, Extent extent, Pattern pattern) { public Pattern relative(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
return new RelativePattern(pattern); return new RelativePattern(pattern);
} }
@Command( @Command(
aliases = {"#!x", "#nx", "#nox"}, name = "#!x",
aliases = {"#nx", "#nox"},
desc = "The pattern will not be provided the x axis info", desc = "The pattern will not be provided the x axis info",
help = "The pattern will not be provided the z axis info.\n" + descFooter = "The pattern will not be provided the z axis info.\n" +
"Example: #!x[#!z[#~[#l3d[pattern]]]]", "Example: #!x[#!z[#~[#l3d[pattern]]]]"
usage = "<pattern>", )
min = 1,
max = 1
)
public Pattern nox(Actor actor, LocalSession session, Extent extent, Pattern pattern) { public Pattern nox(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
return new NoXPattern(pattern); return new NoXPattern(pattern);
} }
@Command( @Command(
aliases = {"#!y", "#ny", "#noy"}, name = "#!y",
desc = "The pattern will not be provided the y axis info", aliases = {"#ny", "#noy"},
usage = "<pattern>", desc = "The pattern will not be provided the y axis info"
min = 1, )
max = 1
)
public Pattern noy(Actor actor, LocalSession session, Extent extent, Pattern pattern) { public Pattern noy(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
return new NoYPattern(pattern); return new NoYPattern(pattern);
} }
@Command( @Command(
aliases = {"#!z", "#nz", "#noz"}, name = "#!z",
desc = "The pattern will not be provided the z axis info", aliases = {"#nz", "#noz"},
usage = "<pattern>", desc = "The pattern will not be provided the z axis info"
min = 1, )
max = 1
)
public Pattern noz(Actor actor, LocalSession session, Extent extent, Pattern pattern) { public Pattern noz(Actor actor, LocalSession session, Extent extent, Pattern pattern) {
return new NoZPattern(pattern); return new NoZPattern(pattern);
} }
@Command( @Command(
aliases = {"#mask"}, name = "#mask",
desc = "Apply a pattern depending on a mask", desc = "Apply a pattern depending on a mask"
usage = "<mask> <pattern-true> <pattern-false>", )
min = 3,
max = 3
)
public Pattern mask(Actor actor, LocalSession session, Mask mask, Pattern pass, Pattern fail) { public Pattern mask(Actor actor, LocalSession session, Mask mask, Pattern pass, Pattern fail) {
PatternExtent extent = new PatternExtent(pass); PatternExtent extent = new PatternExtent(pass);
return new MaskedPattern(mask, extent, fail); return new MaskedPattern(mask, extent, fail);
} }
@Command( @Command(
aliases = {"#offset"}, name = "#offset",
desc = "Offset a pattern", desc = "Offset a pattern"
usage = "<dx> <dy> <dz> <pattern>", )
min = 4,
max = 4
)
public Pattern offset(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) { public Pattern offset(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) {
return new OffsetPattern(pattern, (int) x, (int) y, (int) z); return new OffsetPattern(pattern, (int) x, (int) y, (int) z);
} }
@Command( @Command(
aliases = {"#surfacespread"}, name = "#surfacespread",
desc = "Applies to only blocks on a surface. Selects a block from provided pattern with a given ranomized offset `[0, <distance>)`. e.g. Use `#existing` to randomly offset blocks in the world, or `#copy` to offset blocks in your clipboard", desc = "Applies to only blocks on a surface. Selects a block from provided pattern with a given ranomized offset `[0, <distance>)`. e.g. Use `#existing` to randomly offset blocks in the world, or `#copy` to offset blocks in your clipboard"
usage = "<distance> <pattern>", )
min = 2,
max = 2
)
public Pattern surfacespread(Actor actor, LocalSession session, double distance, Pattern pattern) { public Pattern surfacespread(Actor actor, LocalSession session, double distance, Pattern pattern) {
return new SurfaceRandomOffsetPattern(pattern, (int) distance); return new SurfaceRandomOffsetPattern(pattern, (int) distance);
} }
@Command( @Command(
aliases = {"#solidspread"}, name = "#solidspread",
desc = "Randomly spread solid blocks", desc = "Randomly spread solid blocks"
usage = "<dx> <dy> <dz> <pattern>", )
min = 4,
max = 4
)
public Pattern solidspread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) { public Pattern solidspread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) {
return new SolidRandomOffsetPattern(pattern, (int) x, (int) y, (int) z); return new SolidRandomOffsetPattern(pattern, (int) x, (int) y, (int) z);
} }
@Command( @Command(
aliases = {"#spread", "#randomoffset"}, name = "#spread",
desc = "Randomly spread blocks", aliases = {"#randomoffset"},
usage = "<dx> <dy> <dz> <pattern>", desc = "Randomly spread blocks"
min = 4, )
max = 4
)
public Pattern spread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) { public Pattern spread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) {
return new RandomOffsetPattern(pattern, (int) x, (int) y, (int) z); return new RandomOffsetPattern(pattern, (int) x, (int) y, (int) z);
} }
@Command( @Command(
aliases = {"#linear", "#l"}, name = "#linear",
desc = "Sequentially set blocks from a list of patterns", aliases = {"#l"},
usage = "<pattern>", desc = "Sequentially set blocks from a list of patterns"
min = 1, )
max = 1
)
public Pattern linear(Actor actor, LocalSession session, Pattern other) { public Pattern linear(Actor actor, LocalSession session, Pattern other) {
if (other instanceof RandomPattern) { if (other instanceof RandomPattern) {
Set<Pattern> patterns = ((RandomPattern) other).getPatterns(); Set<Pattern> patterns = ((RandomPattern) other).getPatterns();
@ -390,12 +327,10 @@ public class PatternCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#linear3d", "#l3d"}, name = "#linear3d",
desc = "Use the x,y,z coordinate to pick a block from the list", aliases = {"#l3d"},
usage = "<pattern>", desc = "Use the x,y,z coordinate to pick a block from the list"
min = 1, )
max = 1
)
public Pattern linear3d(Actor actor, LocalSession session, Pattern other) { public Pattern linear3d(Actor actor, LocalSession session, Pattern other) {
if (other instanceof RandomPattern) { if (other instanceof RandomPattern) {
Set<Pattern> patterns = ((RandomPattern) other).getPatterns(); Set<Pattern> patterns = ((RandomPattern) other).getPatterns();
@ -405,12 +340,10 @@ public class PatternCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#linear2d", "#l2d"}, name = "#linear2d",
desc = "Use the x,z coordinate to pick a block from the list", aliases = {"#l2d"},
usage = "<pattern>", desc = "Use the x,z coordinate to pick a block from the list"
min = 1, )
max = 1
)
public Pattern linear2d(Actor actor, LocalSession session, Pattern other) { public Pattern linear2d(Actor actor, LocalSession session, Pattern other) {
if (other instanceof RandomPattern) { if (other instanceof RandomPattern) {
Set<Pattern> patterns = ((RandomPattern) other).getPatterns(); Set<Pattern> patterns = ((RandomPattern) other).getPatterns();
@ -420,12 +353,10 @@ public class PatternCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"=", "#=", "#expression"}, name = "=",
desc = "Expression pattern: http://wiki.sk89q.com/wiki/WorldEdit/Expression_syntax", aliases = {"#=", "#expression"},
usage = "<expression>", desc = "Expression pattern: http://wiki.sk89q.com/wiki/WorldEdit/Expression_syntax"
min = 1, )
max = 1
)
public Pattern expression(Actor actor, LocalSession session, Extent extent, String input) throws ExpressionException { public Pattern expression(Actor actor, LocalSession session, Extent extent, String input) throws ExpressionException {
Expression exp = Expression.compile(input, "x", "y", "z"); Expression exp = Expression.compile(input, "x", "y", "z");
WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO); WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);

View File

@ -39,6 +39,7 @@ import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.visitor.Fast2DIterator; import com.boydti.fawe.object.visitor.Fast2DIterator;
import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.MathMan;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
@ -73,6 +74,7 @@ import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.regions.Regions; import com.sk89q.worldedit.regions.Regions;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TreeGenerator.TreeType; import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.util.command.parametric.Optional;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.biome.Biomes; import com.sk89q.worldedit.world.biome.Biomes;
@ -191,7 +193,7 @@ public class RegionCommands {
} }
@Command( @Command(
name = "/setskylight" name = "/setskylight",
desc = "Set sky lighting in a selection" desc = "Set sky lighting in a selection"
) )
@CommandPermissions("worldedit.light.set") @CommandPermissions("worldedit.light.set")
@ -295,11 +297,8 @@ public class RegionCommands {
@Command( @Command(
aliases = { "/set", "/s" }, aliases = { "/set", "/s" },
usage = "[pattern]", desc = "Set all blocks within selection"
desc = "Set all blocks within selection", )
min = 1,
max = 1
)
@CommandPermissions("worldedit.region.set") @CommandPermissions("worldedit.region.set")
@Logging(REGION) @Logging(REGION)
public void set(FawePlayer player, LocalSession session, EditSession editSession, @Selection Region selection, Pattern to, CommandContext context) throws WorldEditException { public void set(FawePlayer player, LocalSession session, EditSession editSession, @Selection Region selection, Pattern to, CommandContext context) throws WorldEditException {
@ -329,12 +328,9 @@ public class RegionCommands {
} }
@Command( @Command(
aliases = {"/lay"}, name = "/lay",
usage = "<pattern>", desc = "Set the top block in the region"
desc = "Set the top block in the region", )
min = 1,
max = 1
)
@CommandPermissions("worldedit.region.overlay") @CommandPermissions("worldedit.region.overlay")
@Logging(REGION) @Logging(REGION)
public void lay(FawePlayer player, EditSession editSession, @Selection Region region, Pattern pattern, CommandContext context) throws WorldEditException { public void lay(FawePlayer player, EditSession editSession, @Selection Region region, Pattern pattern, CommandContext context) throws WorldEditException {
@ -437,9 +433,10 @@ public class RegionCommands {
} }
@Command( @Command(
aliases = {"/wea", "wea", "worldeditanywhere", "/worldeditanywhere", "/weanywhere"}, name = "/wea",
aliases = {"wea", "worldeditanywhere", "/worldeditanywhere", "/weanywhere"},
desc = "Bypass region restrictions", desc = "Bypass region restrictions",
help = "Bypass region restrictions" descFooter = "Bypass region restrictions"
) )
@CommandPermissions("fawe.admin") @CommandPermissions("fawe.admin")
public void wea(Player player) throws WorldEditException { public void wea(Player player) throws WorldEditException {
@ -451,9 +448,10 @@ public class RegionCommands {
} }
@Command( @Command(
aliases = {"/wer", "wer", "worldeditregion", "/worldeditregion", "select", "/select"}, name = "/wer",
aliases = {"wer", "worldeditregion", "/worldeditregion", "select", "/select"},
desc = "Select your current allowed region", desc = "Select your current allowed region",
help = "Select your current allowed region" descFooter = "Select your current allowed region"
) )
@CommandPermissions("fawe.worldeditregion") @CommandPermissions("fawe.worldeditregion")
public void wer(FawePlayer fp) throws WorldEditException { public void wer(FawePlayer fp) throws WorldEditException {
@ -468,19 +466,16 @@ public class RegionCommands {
@Command( @Command(
aliases = { "/move" }, name = "/move",
usage = "[count] [direction] [leave-id]",
flags = "saeb",
desc = "Move the contents of the selection", desc = "Move the contents of the selection",
help = descFooter =
"Moves the contents of the selection.\n" + "Moves the contents of the selection.\n" +
"The -s flag shifts the selection to the target location.\n" + "The -s flag shifts the selection to the target location.\n" +
"The -b also copies biomes\n" + "The -b also copies biomes\n" +
"The -e ignores entities\n" + "The -e ignores entities\n" +
"The -a ignores air blocks.\n" + "The -a ignores air blocks.\n" +
"Optionally fills the old location with <leave-id>.", "Optionally fills the old location with <leave-id>."
max = 3 )
)
@CommandPermissions("worldedit.region.move") @CommandPermissions("worldedit.region.move")
@Logging(ORIENTATION_REGION) @Logging(ORIENTATION_REGION)
public void move(FawePlayer player, LocalSession session, EditSession editSession, public void move(FawePlayer player, LocalSession session, EditSession editSession,
@ -520,14 +515,11 @@ public class RegionCommands {
} }
@Command( @Command(
aliases = { "/fall" }, name = "/fall",
usage = "[replace]",
flags = "m",
desc = "Have the blocks in the selection fall", desc = "Have the blocks in the selection fall",
help = "Make the blocks in the selection fall\n" + descFooter = "Make the blocks in the selection fall\n" +
"The -m flag will only fall within the vertical selection.", "The -m flag will only fall within the vertical selection."
max = 2 )
)
@CommandPermissions("worldedit.region.fall") @CommandPermissions("worldedit.region.fall")
@Logging(ORIENTATION_REGION) @Logging(ORIENTATION_REGION)
public void fall(FawePlayer player, EditSession editSession, LocalSession session, public void fall(FawePlayer player, EditSession editSession, LocalSession session,
@ -584,17 +576,14 @@ public class RegionCommands {
} }
@Command( @Command(
aliases = { "/deform" }, name = "/deform",
usage = "<expression>",
desc = "Deforms a selected region with an expression", desc = "Deforms a selected region with an expression",
help = descFooter =
"Deforms a selected region with an expression\n" + "Deforms a selected region with an expression\n" +
"The expression is executed for each block and is expected\n" + "The expression is executed for each block and is expected\n" +
"to modify the variables x, y and z to point to a new block\n" + "to modify the variables x, y and z to point to a new block\n" +
"to fetch. See also tinyurl.com/wesyntax.", "to fetch. See also tinyurl.com/wesyntax."
flags = "ro", )
min = 1
)
@CommandPermissions("worldedit.region.deform") @CommandPermissions("worldedit.region.deform")
@Logging(ALL) @Logging(ALL)
public void deform(FawePlayer fp, Player player, LocalSession session, EditSession editSession, public void deform(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
@ -639,15 +628,13 @@ public class RegionCommands {
} }
@Command( @Command(
aliases = { "/regen" }, name = "/regen",
usage = "[biome] [seed]",
desc = "Regenerates the contents of the selection", desc = "Regenerates the contents of the selection",
help = descFooter =
"Regenerates the contents of the current selection.\n" + "Regenerates the contents of the current selection.\n" +
"This command might affect things outside the selection,\n" + "This command might affect things outside the selection,\n" +
"if they are within the same chunk.", "if they are within the same chunk."
max = 2 )
)
@CommandPermissions("worldedit.regen") @CommandPermissions("worldedit.regen")
@Logging(REGION) @Logging(REGION)
public void regenerateChunk(FawePlayer player, LocalSession session, EditSession editSession, @Selection Region region, CommandContext context) throws WorldEditException { public void regenerateChunk(FawePlayer player, LocalSession session, EditSession editSession, @Selection Region region, CommandContext context) throws WorldEditException {
@ -682,13 +669,11 @@ public class RegionCommands {
} }
@Command( @Command(
aliases = { "/hollow" }, name = "/hollow",
usage = "[<thickness>[ <pattern>]]",
desc = "Hollows out the object contained in this selection", desc = "Hollows out the object contained in this selection",
help = "Hollows out the object contained in this selection.\n" + descFooter = "Hollows out the object contained in this selection.\n" +
"Optionally fills the hollowed out part with the given block.\n" + "Optionally fills the hollowed out part with the given block.\n" +
"Thickness is measured in manhattan distance.", "Thickness is measured in manhattan distance."
max = 2
) )
@CommandPermissions("worldedit.region.hollow") @CommandPermissions("worldedit.region.hollow")
@Logging(REGION) @Logging(REGION)

View File

@ -551,11 +551,9 @@ public class SchematicCommands {
/* /*
@Command( @Command(
aliases = {"show"}, name = "show",
desc = "Show a schematic", desc = "Show a schematic",
usage = "[global|mine|<filter>]", descFooter = "List all schematics in the schematics directory\n" +
flags = "dnp",
help = "List all schematics in the schematics directory\n" +
" -f <format> restricts by format\n" " -f <format> restricts by format\n"
) )
@CommandPermissions("worldedit.schematic.show") @CommandPermissions("worldedit.schematic.show")

View File

@ -41,10 +41,9 @@ public class SuperPickaxeCommands {
} }
@Command( @Command(
aliases = {"single"}, name = "single",
desc = "Enable the single block super pickaxe mode", desc = "Enable the single block super pickaxe mode"
max = 0 )
)
@CommandPermissions("worldedit.superpickaxe") @CommandPermissions("worldedit.superpickaxe")
public void single(Player player, LocalSession session) throws WorldEditException { public void single(Player player, LocalSession session) throws WorldEditException {
session.setSuperPickaxe(new SinglePickaxe()); session.setSuperPickaxe(new SinglePickaxe());
@ -53,12 +52,9 @@ public class SuperPickaxeCommands {
} }
@Command( @Command(
aliases = {"area"}, name = "area",
usage = "<radius>", desc = "Enable the area super pickaxe pickaxe mode"
desc = "Enable the area super pickaxe pickaxe mode", )
min = 1,
max = 1
)
@CommandPermissions("worldedit.superpickaxe.area") @CommandPermissions("worldedit.superpickaxe.area")
public void area(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void area(Player player, LocalSession session, CommandContext args) throws WorldEditException {
@ -76,12 +72,10 @@ public class SuperPickaxeCommands {
} }
@Command( @Command(
aliases = {"recur", "recursive"}, name = "recur",
usage = "<radius>", aliases = {"recursive"},
desc = "Enable the recursive super pickaxe pickaxe mode", desc = "Enable the recursive super pickaxe pickaxe mode"
min = 1, )
max = 1
)
@CommandPermissions("worldedit.superpickaxe.recursive") @CommandPermissions("worldedit.superpickaxe.recursive")
public void recursive(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void recursive(Player player, LocalSession session, CommandContext args) throws WorldEditException {

View File

@ -23,7 +23,7 @@ import java.util.Set;
@Command(aliases = {"transforms"}, @Command(aliases = {"transforms"},
desc = "Help for the various transforms. [More Info](https://git.io/v9KHO)", desc = "Help for the various transforms. [More Info](https://git.io/v9KHO)",
help = "Transforms modify how a block is placed\n" + descFooter = "Transforms modify how a block is placed\n" +
" - Use [brackets] for arguments\n" + " - Use [brackets] for arguments\n" +
" - Use , to OR multiple\n" + " - Use , to OR multiple\n" +
" - Use & to AND multiple\n" + " - Use & to AND multiple\n" +
@ -35,12 +35,10 @@ public class TransformCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#linear", "#l"}, name = "#linear",
desc = "Sequentially pick from a list of transform", aliases = {"#l"},
usage = "<transform>", desc = "Sequentially pick from a list of transform"
min = 1, )
max = 2
)
public ResettableExtent linear(Actor actor, LocalSession session, @Optional("#null") ResettableExtent other) { public ResettableExtent linear(Actor actor, LocalSession session, @Optional("#null") ResettableExtent other) {
if (other instanceof RandomTransform) { if (other instanceof RandomTransform) {
Set<ResettableExtent> extents = ((RandomTransform) other).getExtents(); Set<ResettableExtent> extents = ((RandomTransform) other).getExtents();
@ -50,12 +48,10 @@ public class TransformCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#linear3d", "#l3d"}, name = "#linear3d",
desc = "Use the x,y,z coordinate to pick a transform from the list", aliases = {"#l3d"},
usage = "<transform>", desc = "Use the x,y,z coordinate to pick a transform from the list"
min = 1, )
max = 2
)
public ResettableExtent linear3d(Actor actor, LocalSession session, @Optional("#null") ResettableExtent other) { public ResettableExtent linear3d(Actor actor, LocalSession session, @Optional("#null") ResettableExtent other) {
if (other instanceof RandomTransform) { if (other instanceof RandomTransform) {
Set<ResettableExtent> extents = ((RandomTransform) other).getExtents(); Set<ResettableExtent> extents = ((RandomTransform) other).getExtents();
@ -65,56 +61,42 @@ public class TransformCommands extends MethodCommands {
} }
@Command( @Command(
aliases = {"#pattern"}, name = "#pattern",
desc = "Always use a specific pattern", desc = "Always use a specific pattern"
usage = "<pattern> [transform]", )
min = 1,
max = 2
)
public ResettableExtent pattern(Actor actor, LocalSession session, Pattern pattern, @Optional("#null") ResettableExtent other) { public ResettableExtent pattern(Actor actor, LocalSession session, Pattern pattern, @Optional("#null") ResettableExtent other) {
return new PatternTransform(other, pattern); return new PatternTransform(other, pattern);
} }
@Command( @Command(
aliases = {"#offset"}, name = "#offset",
desc = "Offset transform", desc = "Offset transform"
usage = "<dx> <dy> <dz> [transform]", )
min = 3,
max = 4
)
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, @Optional("#null") ResettableExtent other) {
return new OffsetExtent(other, (int) x, (int) y, (int) z); return new OffsetExtent(other, (int) x, (int) y, (int) z);
} }
@Command( @Command(
aliases = {"#spread", "#randomoffset"}, name = "#spread",
desc = "Random offset transform", aliases = {"#randomoffset"},
usage = "<dx> <dy> <dz> [transform]", desc = "Random offset transform"
min = 3, )
max = 4
)
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, @Optional("#null") ResettableExtent other) {
return new RandomOffsetTransform(other, (int) x, (int) y, (int) z); return new RandomOffsetTransform(other, (int) x, (int) y, (int) z);
} }
@Command( @Command(
aliases = {"#scale"}, name = "#scale",
desc = "All changes will be scaled", desc = "All changes will be scaled"
usage = "<dx> <dy> <dz> [transform]", )
min = 3,
max = 4
)
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, @Optional("#null") ResettableExtent other) {
return new ScaleTransform(other, x, y, z); return new ScaleTransform(other, x, y, z);
} }
@Command( @Command(
aliases = {"#rotate"}, name = "#rotate",
desc = "All changes will be rotate around the initial position", desc = "All changes will be rotate around the initial position"
usage = "<rotateX> <rotateY> <rotateZ> [transform]", )
min = 3,
max = 4
)
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, @Optional("#null") ResettableExtent other) {
ExtentTraverser traverser = new ExtentTraverser(other).find(TransformExtent.class); ExtentTraverser traverser = new ExtentTraverser(other).find(TransformExtent.class);
BlockTransformExtent affine = (TransformExtent) (traverser != null ? traverser.get() : null); BlockTransformExtent affine = (TransformExtent) (traverser != null ? traverser.get() : null);

View File

@ -207,7 +207,7 @@ public class UtilityCommands {
@Command( @Command(
name = "patterns", name = "patterns",
desc = "View help about patterns", desc = "View help about patterns",
help = "Patterns determine what blocks are placed\n" + descFooter = "Patterns determine what blocks are placed\n" +
" - Use [brackets] for arguments\n" + " - Use [brackets] for arguments\n" +
" - Use , to OR multiple\n" + " - Use , to OR multiple\n" +
"e.g. #surfacespread[10][#existing],andesite\n" + "e.g. #surfacespread[10][#existing],andesite\n" +
@ -221,9 +221,8 @@ public class UtilityCommands {
@Command( @Command(
name = "masks", name = "masks",
usage = "[page=1|search|mask]",
desc = "View help about masks", desc = "View help about masks",
help = "Masks determine if a block can be placed\n" + descFooter = "Masks determine if a block can be placed\n" +
" - Use [brackets] for arguments\n" + " - Use [brackets] for arguments\n" +
" - Use , to OR multiple\n" + " - Use , to OR multiple\n" +
" - Use & to AND multiple\n" + " - Use & to AND multiple\n" +
@ -239,7 +238,7 @@ public class UtilityCommands {
@Command( @Command(
name = "transforms", name = "transforms",
desc = "View help about transforms", desc = "View help about transforms",
help = "Transforms modify how a block is placed\n" + descFooter = "Transforms modify how a block is placed\n" +
" - Use [brackets] for arguments\n" + " - Use [brackets] for arguments\n" +
" - Use , to OR multiple\n" + " - Use , to OR multiple\n" +
" - Use & to AND multiple\n" + " - Use & to AND multiple\n" +