This commit is contained in:
Jesse Boyd 2019-07-17 16:11:55 +10:00
parent cedb261313
commit 3113d8dd69
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
13 changed files with 73 additions and 72 deletions

View File

@ -147,7 +147,7 @@ public class AnvilCommands {
descFooter = "The -d flag disabled wildcard data matching\n" descFooter = "The -d flag disabled wildcard data matching\n"
) )
@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, @Arg(name = "from", desc = "String", def = "") String from, String to, @Switch('d') boolean useData) throws WorldEditException {
// final FaweBlockMatcher matchFrom; // final FaweBlockMatcher matchFrom;
// if (from == null) { // if (from == null) {
// matchFrom = FaweBlockMatcher.NOT_AIR; // matchFrom = FaweBlockMatcher.NOT_AIR;
@ -191,7 +191,7 @@ public class AnvilCommands {
"The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`" "The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
) )
@CommandPermissions("worldedit.anvil.deleteallunvisited") @CommandPermissions("worldedit.anvil.deleteallunvisited")
public void deleteAllUnvisited(Player player, String folder, int inhabitedTicks, @Optional("60000") int fileDurationMillis) throws WorldEditException { public void deleteAllUnvisited(Player player, String folder, int inhabitedTicks, @Arg(name = "filedurationmillis", desc = "int", def = "60000") int fileDurationMillis) throws WorldEditException {
DeleteUninhabitedFilter filter = new DeleteUninhabitedFilter(fileDurationMillis, inhabitedTicks, fileDurationMillis); DeleteUninhabitedFilter filter = new DeleteUninhabitedFilter(fileDurationMillis, inhabitedTicks, fileDurationMillis);
DeleteUninhabitedFilter result = runWithWorld(player, folder, filter, true); DeleteUninhabitedFilter result = runWithWorld(player, folder, filter, true);
if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal())); if (result != null) player.print(BBC.VISITOR_BLOCK.format(result.getTotal()));
@ -208,7 +208,7 @@ public class AnvilCommands {
"The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`" "The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
) )
@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, @Arg(name = "filedurationmillis", desc = "int", def = "60000") int fileDurationMillis, @Switch('d') boolean debug) throws WorldEditException {
String folder = player.getWorld().getName(); String folder = player.getWorld().getName();
DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis); DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis);
if (debug) filter.enableDebug(); if (debug) filter.enableDebug();
@ -227,7 +227,7 @@ public class AnvilCommands {
"The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`" "The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
) )
@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, @Arg(name = "filedurationmillis", desc = "int", def = "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);
if (debug) filter.enableDebug(); if (debug) filter.enableDebug();
DeleteUnclaimedFilter result = runWithSelection(player, editSession, selection, filter); DeleteUnclaimedFilter result = runWithSelection(player, editSession, selection, filter);
@ -308,7 +308,7 @@ public class AnvilCommands {
desc = "Replace all blocks in the selection with another" desc = "Replace all blocks in the selection with another"
) )
@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, @Arg(name = "from", desc = "String", def = "") String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap) throws WorldEditException {
// MCAFilterCounter filter; // MCAFilterCounter filter;
// if (useMap) { // if (useMap) {
// if (to instanceof RandomPattern) { // if (to instanceof RandomPattern) {
@ -507,7 +507,7 @@ public class AnvilCommands {
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")
public void replace(Player player, EditSession editSession, @Selection Region selection, @Optional String from, String to, @Switch('d') boolean useData) throws WorldEditException { public void replace(Player player, EditSession editSession, @Selection Region selection, @Arg(name = "from", desc = "String", def = "") String from, String to, @Switch('d') boolean useData) throws WorldEditException {
// final FaweBlockMatcher matchFrom; // final FaweBlockMatcher matchFrom;
// if (from == null) { // if (from == null) {
// matchFrom = FaweBlockMatcher.NOT_AIR; // matchFrom = FaweBlockMatcher.NOT_AIR;
@ -528,8 +528,8 @@ public class AnvilCommands {
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")
// Player player, String folder, @Optional String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap // Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap
public void replacePattern(Player player, EditSession editSession, @Selection Region selection, @Optional String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap) throws WorldEditException { public void replacePattern(Player player, EditSession editSession, @Selection Region selection, @Arg(name = "from", desc = "String", def = "") String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap) throws WorldEditException {
// MCAFilterCounter filter; // MCAFilterCounter filter;
// if (useMap) { // if (useMap) {
// if (to instanceof RandomPattern) { // if (to instanceof RandomPattern) {
@ -559,7 +559,7 @@ public class AnvilCommands {
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")
// Player player, String folder, @Optional String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap // Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, final Pattern to, @Switch('d') boolean useData, @Switch('m') boolean useMap
public void set(Player player, EditSession editSession, @Selection Region selection, final Pattern to) throws WorldEditException { public void set(Player player, EditSession editSession, @Selection Region selection, final Pattern to) throws WorldEditException {
MCAFilterCounter filter = new SetPatternFilter(to); MCAFilterCounter filter = new SetPatternFilter(to);
MCAFilterCounter result = runWithSelection(player, editSession, selection, filter); MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);

View File

@ -105,7 +105,7 @@ public class CFICommands extends MethodCommands {
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")
public void heightmap(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional("1") double yscale) throws ParameterException { public void heightmap(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Arg(name = "yscale", desc = "double", def = "1") double yscale) throws ParameterException {
if (yscale != 0) { if (yscale != 0) {
int[] raw = ((DataBufferInt) image.load().getRaster().getDataBuffer()).getData(); int[] raw = ((DataBufferInt) image.load().getRaster().getDataBuffer()).getData();
int[] table = IntStream.range(0, 256).map(i -> Math.min(255, (int) (i * yscale))) int[] table = IntStream.range(0, 256).map(i -> Math.min(255, (int) (i * yscale)))
@ -241,7 +241,7 @@ public class CFICommands extends MethodCommands {
desc = "Set the floor and main block" desc = "Set the floor and main block"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void column(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ public void column(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
if (image != null) gen.setColumn(load(image), pattern, !disableWhiteOnly); if (image != null) gen.setColumn(load(image), pattern, !disableWhiteOnly);
else if (mask != null) gen.setColumn(mask, pattern); else if (mask != null) gen.setColumn(mask, pattern);
@ -256,14 +256,14 @@ public class CFICommands extends MethodCommands {
desc = "Set the floor (default: grass)" desc = "Set the floor (default: grass)"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void floorCmd(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ public void floorCmd(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{
floor(fp, pattern, image, mask, disableWhiteOnly); floor(fp, pattern, image, mask, disableWhiteOnly);
fp.sendMessage("Set floor!"); fp.sendMessage("Set floor!");
assertSettings(fp).resetComponent(); assertSettings(fp).resetComponent();
component(fp); component(fp);
} }
private void floor(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException { private void floor(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException {
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
if (image != null) gen.setFloor(load(image), pattern, !disableWhiteOnly); if (image != null) gen.setFloor(load(image), pattern, !disableWhiteOnly);
else if (mask != null) gen.setFloor(mask, pattern); else if (mask != null) gen.setFloor(mask, pattern);
@ -275,14 +275,14 @@ public class CFICommands extends MethodCommands {
desc = "Set the main block (default: stone)" desc = "Set the main block (default: stone)"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void mainCmd(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ public void mainCmd(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{
main(fp, pattern, image, mask, disableWhiteOnly); main(fp, pattern, image, mask, disableWhiteOnly);
fp.sendMessage("Set main!"); fp.sendMessage("Set main!");
assertSettings(fp).resetComponent(); assertSettings(fp).resetComponent();
component(fp); component(fp);
} }
public void main(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ public void main(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
if (image != null) gen.setMain(load(image), pattern, !disableWhiteOnly); if (image != null) gen.setMain(load(image), pattern, !disableWhiteOnly);
else if (mask != null) gen.setMain(mask, pattern); else if (mask != null) gen.setMain(mask, pattern);
@ -298,7 +298,7 @@ public class CFICommands extends MethodCommands {
"e.g. Tallgrass" "e.g. Tallgrass"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void overlay(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ public void overlay(FawePlayer fp, Pattern pattern, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
if (image != null) gen.setOverlay(load(image), pattern, !disableWhiteOnly); if (image != null) gen.setOverlay(load(image), pattern, !disableWhiteOnly);
else if (mask != null) gen.setOverlay(mask, pattern); else if (mask != null) gen.setOverlay(mask, pattern);
@ -316,13 +316,13 @@ public class CFICommands extends MethodCommands {
" - A good value for radius and iterations would be 1 8." " - A good value for radius and iterations would be 1 8."
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void smoothCmd(FawePlayer fp, int radius, int iterations, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ public void smoothCmd(FawePlayer fp, int radius, int iterations, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{
smooth(fp, radius, iterations, image, mask, disableWhiteOnly); smooth(fp, radius, iterations, image, mask, disableWhiteOnly);
assertSettings(fp).resetComponent(); assertSettings(fp).resetComponent();
component(fp); component(fp);
} }
private void smooth(FawePlayer fp, int radius, int iterations, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ private void smooth(FawePlayer fp, int radius, int iterations, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
if (image != null) gen.smooth(load(image), !disableWhiteOnly, radius, iterations); if (image != null) gen.smooth(load(image), !disableWhiteOnly, radius, iterations);
else gen.smooth(mask, radius, iterations); else gen.smooth(mask, radius, iterations);
@ -333,7 +333,7 @@ public class CFICommands extends MethodCommands {
desc = "Create some snow" desc = "Create some snow"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void snow(FawePlayer fp, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ public void snow(FawePlayer fp, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
floor(fp, BlockTypes.SNOW.getDefaultState().with(PropertyKey.LAYERS, 7), image, mask, disableWhiteOnly); floor(fp, BlockTypes.SNOW.getDefaultState().with(PropertyKey.LAYERS, 7), image, mask, disableWhiteOnly);
main(fp, BlockTypes.SNOW_BLOCK, image, mask, disableWhiteOnly); main(fp, BlockTypes.SNOW_BLOCK, image, mask, disableWhiteOnly);
@ -365,7 +365,7 @@ public class CFICommands extends MethodCommands {
"`#clipboard` will only use the blocks present in your clipboard." "`#clipboard` will only use the blocks present in your clipboard."
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void paletteblocks(FawePlayer fp, Player player, LocalSession session, @Optional String arg) throws ParameterException, EmptyClipboardException, InputParseException, FileNotFoundException { public void paletteblocks(FawePlayer fp, Player player, LocalSession session, @Arg(name = "arg", desc = "String", def = "") String arg) throws ParameterException, EmptyClipboardException, InputParseException, FileNotFoundException {
if (arg == null) { if (arg == null) {
msg("What blocks do you want to color with?").newline() msg("What blocks do you want to color with?").newline()
.text("[All]").cmdTip(alias() + " PaletteBlocks *").text(" - All available blocks") .text("[All]").cmdTip(alias() + " PaletteBlocks *").text(" - All available blocks")
@ -498,7 +498,7 @@ public class CFICommands extends MethodCommands {
" - If a mask is used, the biome will be set anywhere the mask applies" " - If a mask is used, the biome will be set anywhere the mask applies"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void biome(FawePlayer fp, BiomeType biome, @Optional FawePrimitiveBinding.ImageUri image, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{ public void biome(FawePlayer fp, BiomeType biome, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException{
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
if (image != null) gen.setBiome(load(image), biome, !disableWhiteOnly); if (image != null) gen.setBiome(load(image), biome, !disableWhiteOnly);
else if (mask != null) gen.setBiome(mask, biome); else if (mask != null) gen.setBiome(mask, biome);
@ -661,7 +661,7 @@ public class CFICommands extends MethodCommands {
) )
// ![79,174,212,5:3,5:4,18,161,20] // ![79,174,212,5:3,5:4,18,161,20]
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void glass(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException { public void glass(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException {
CFISettings settings = assertSettings(fp); CFISettings settings = assertSettings(fp);
settings.getGenerator().setColorWithGlass(load(image)); settings.getGenerator().setColorWithGlass(load(image));
msg("Set color with glass!").send(fp); msg("Set color with glass!").send(fp);
@ -678,7 +678,7 @@ public class CFICommands extends MethodCommands {
"The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance" "The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void color(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException { public void color(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException {
CFISettings settings = assertSettings(fp); CFISettings settings = assertSettings(fp);
HeightMapMCAGenerator gen = settings.getGenerator(); HeightMapMCAGenerator gen = settings.getGenerator();
if (imageMask != null) gen.setColor(load(image), load(imageMask), !disableWhiteOnly); if (imageMask != null) gen.setColor(load(image), load(imageMask), !disableWhiteOnly);
@ -698,7 +698,7 @@ public class CFICommands extends MethodCommands {
"The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance" "The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void blockbiome(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException { public void blockbiome(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException {
CFISettings settings = assertSettings(fp); CFISettings settings = assertSettings(fp);
settings.getGenerator().setBlockAndBiomeColor(load(image), mask, load(imageMask), !disableWhiteOnly); settings.getGenerator().setBlockAndBiomeColor(load(image), mask, load(imageMask), !disableWhiteOnly);
msg("Set color with blocks and biomes!").send(fp); msg("Set color with blocks and biomes!").send(fp);
@ -714,7 +714,7 @@ public class CFICommands extends MethodCommands {
" - If you changed the block to something other than grass you will not see anything." " - If you changed the block to something other than grass you will not see anything."
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void biomecolor(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException { public void biomecolor(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly) throws ParameterException, WorldEditException {
CFISettings settings = assertSettings(fp); CFISettings settings = assertSettings(fp);
settings.getGenerator().setBiomeColor(load(image)); settings.getGenerator().setBiomeColor(load(image));
msg("Set color with biomes!").send(fp); msg("Set color with biomes!").send(fp);
@ -806,7 +806,7 @@ public class CFICommands extends MethodCommands {
desc = "Select a mask" desc = "Select a mask"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void mask(FawePlayer fp, @Optional FawePrimitiveBinding.ImageUri imageMask, @Optional Mask mask, @Switch('w') boolean disableWhiteOnly, CommandContext context) throws ParameterException{ public void mask(FawePlayer fp, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('w') boolean disableWhiteOnly, CommandContext context) throws ParameterException{
CFISettings settings = assertSettings(fp); CFISettings settings = assertSettings(fp);
String[] split = getArguments(context).split(" "); String[] split = getArguments(context).split(" ");
int index = 2; int index = 2;
@ -831,7 +831,7 @@ public class CFICommands extends MethodCommands {
desc = "Select a pattern" desc = "Select a pattern"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void pattern(FawePlayer fp, @Optional Pattern pattern, CommandContext context) throws ParameterException, CommandException { public void pattern(FawePlayer fp, @Arg(name = "pattern", desc = "Pattern", def = "") Pattern pattern, CommandContext context) throws ParameterException, CommandException {
CFISettings settings = assertSettings(fp); CFISettings settings = assertSettings(fp);
String[] split = getArguments(context).split(" "); String[] split = getArguments(context).split(" ");
int index = 2; int index = 2;

View File

@ -448,7 +448,7 @@ public class BrushCommands {
"Set [copies] to a value > 0 if you want to have your selection pasted a limited amount of times equally spaced on the curve" "Set [copies] to a value > 0 if you want to have your selection pasted a limited amount of times equally spaced on the curve"
) )
@CommandPermissions("worldedit.brush.sweep") @CommandPermissions("worldedit.brush.sweep")
public BrushSettings sweepBrush(Player player, LocalSession session, EditSession editSession, @Optional("-1") int copies, CommandContext context) throws WorldEditException { public BrushSettings sweepBrush(Player player, LocalSession session, EditSession editSession, @Arg(name = "copies", desc = "int", def = "-1") int copies, CommandContext context) throws WorldEditException {
player.print(BBC.BRUSH_SPLINE.s()); player.print(BBC.BRUSH_SPLINE.s());
Brush brush = new SweepBrush(copies); Brush brush = new SweepBrush(copies);
CommandLocals locals = context.getLocals(); CommandLocals locals = context.getLocals();
@ -537,7 +537,7 @@ public class BrushCommands {
@CommandPermissions("worldedit.brush.surfacespline") // 0, 0, 0, 10, 0, @CommandPermissions("worldedit.brush.surfacespline") // 0, 0, 0, 10, 0,
public BrushSettings surfaceSpline(Player player, EditSession editSession, LocalSession session, Pattern fill, public BrushSettings surfaceSpline(Player player, EditSession editSession, LocalSession session, Pattern fill,
@Arg(desc = "The radius to sample for blending", def = "0") @Arg(desc = "The radius to sample for blending", def = "0")
double radius, @Optional("0") double tension, @Optional("0") double bias, @Optional("0") double continuity, @Optional("10") double quality, CommandContext context) throws WorldEditException { double radius, @Arg(name = "tension", desc = "double", def = "0") double tension, @Arg(name = "bias", desc = "double", def = "0") double bias, @Arg(name = "continuity", desc = "double", def = "0") double continuity, @Arg(name = "quality", desc = "double", def = "10") double quality, CommandContext context) throws WorldEditException {
player.print(BBC.BRUSH_SPLINE.f(radius)); player.print(BBC.BRUSH_SPLINE.f(radius));
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
Brush brush = new SurfaceSpline(tension, bias, continuity, quality); Brush brush = new SurfaceSpline(tension, bias, continuity, quality);
@ -577,7 +577,7 @@ public class BrushCommands {
desc = "Creates a distorted sphere" desc = "Creates a distorted sphere"
) )
@CommandPermissions("worldedit.brush.rock") @CommandPermissions("worldedit.brush.rock")
public BrushSettings blobBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Optional("10") Vector3 radius, @Optional("100") double sphericity, @Optional("30") double frequency, @Optional("50") double amplitude, CommandContext context) throws WorldEditException { public BrushSettings blobBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Vector3", def = "10") Vector3 radius, @Arg(name = "sphericity", desc = "double", def = "100") double sphericity, @Arg(name = "frequency", desc = "double", def = "30") double frequency, @Arg(name = "amplitude", desc = "double", def = "50") double amplitude, CommandContext context) throws WorldEditException {
double max = MathMan.max(radius.getX(), radius.getY(), radius.getZ()); double max = MathMan.max(radius.getX(), radius.getY(), radius.getZ());
worldEdit.checkMaxBrushRadius(max); worldEdit.checkMaxBrushRadius(max);
Brush brush = new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100); Brush brush = new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100);
@ -728,7 +728,7 @@ public class BrushCommands {
"The -r flag will apply random rotation" "The -r flag will apply random rotation"
) )
@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, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Arg(name = "yscale", desc = "double", def = "1") final double yscale, @Switch('w') boolean onlyWhite, @Switch('r') boolean randomRotate, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
InputStream stream = getHeightmapStream(image); InputStream stream = getHeightmapStream(image);
HeightBrush brush; HeightBrush brush;
@ -779,7 +779,7 @@ public class BrushCommands {
"The -f blends the image with the existing terrain" "The -f blends the image with the existing terrain"
) )
@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, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, FawePrimitiveBinding.ImageUri imageUri, @Optional("1") @Range(min=Double.MIN_NORMAL) final double yscale, @Switch('a') boolean alpha, @Switch('f') boolean fadeOut, CommandContext context) throws WorldEditException, IOException, ParameterException {
BufferedImage image = imageUri.load(); BufferedImage image = imageUri.load();
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
if (yscale != 1) { if (yscale != 1) {
@ -830,7 +830,7 @@ public class BrushCommands {
"The -r flag will apply random rotation" "The -r flag will apply random rotation"
) )
@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, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, CommandContext context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
Brush brush = new SurfaceSphereBrush(); Brush brush = new SurfaceSphereBrush();
CommandLocals locals = context.getLocals(); CommandLocals locals = context.getLocals();
@ -871,7 +871,7 @@ public class BrushCommands {
"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, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "5") double points, @Arg(name = "distance", desc = "double", def = "1") double distance, @Switch('o') boolean overlay, CommandContext context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
Brush brush; Brush brush;
if (overlay) { if (overlay) {
@ -917,7 +917,7 @@ public class BrushCommands {
"The -r flag will apply random rotation" "The -r flag will apply random rotation"
) )
@CommandPermissions("worldedit.brush.populateschematic") @CommandPermissions("worldedit.brush.populateschematic")
public BrushSettings scatterSchemBrush(Player player, EditSession editSession, LocalSession session, Mask mask, String clipboard, @Optional("30") Expression radius, @Optional("50") double density, @Switch('r') boolean rotate, CommandContext context) throws WorldEditException { public BrushSettings scatterSchemBrush(Player player, EditSession editSession, LocalSession session, Mask mask, String clipboard, @Arg(name = "radius", desc = "Expression", def = "30") Expression radius, @Arg(name = "density", desc = "double", def = "50") double density, @Switch('r') boolean rotate, CommandContext context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
@ -1038,7 +1038,7 @@ public class BrushCommands {
"Note: The seeds define how many splotches there are, recursion defines how large, solid defines whether the pattern is applied per seed, else per block." "Note: The seeds define how many splotches there are, recursion defines how large, solid defines whether the pattern is applied per seed, else per block."
) )
@CommandPermissions("worldedit.brush.splatter") @CommandPermissions("worldedit.brush.splatter")
public BrushSettings splatterBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Optional("5") Expression radius, @Optional("1") double points, @Optional("5") double recursion, @Optional("true") boolean solid, CommandContext context) throws WorldEditException { public BrushSettings splatterBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "1") double points, @Arg(name = "recursion", desc = "double", def = "5") double recursion, @Arg(name = "solid", desc = "boolean", def = "true") boolean solid, CommandContext context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
Brush brush = new SplatterBrush((int) points, (int) recursion, solid); Brush brush = new SplatterBrush((int) points, (int) recursion, solid);
CommandLocals locals = context.getLocals(); CommandLocals locals = context.getLocals();
@ -1415,7 +1415,7 @@ public class BrushCommands {
"Snow Pic: https://i.imgur.com/Hrzn0I4.png" "Snow Pic: https://i.imgur.com/Hrzn0I4.png"
) )
@CommandPermissions("worldedit.brush.height") @CommandPermissions("worldedit.brush.height")
public BrushSettings heightBrush(Player player, LocalSession session, @Optional("5") Expression radius, @Optional() final String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Optional("1") final double yscale, @Switch('r') boolean randomRotate, @Switch('l') boolean layers, @Switch('s') boolean dontSmooth, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException { public BrushSettings heightBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") final String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Arg(name = "yscale", desc = "double", def = "1") final double yscale, @Switch('r') boolean randomRotate, @Switch('l') boolean layers, @Switch('s') boolean dontSmooth, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException {
return terrainBrush(player, session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context); return terrainBrush(player, session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
} }
@ -1429,7 +1429,7 @@ public class BrushCommands {
" - The `-s` flag disables smoothing" " - The `-s` flag disables smoothing"
) )
@CommandPermissions("worldedit.brush.height") @CommandPermissions("worldedit.brush.height")
public BrushSettings cliffBrush(Player player, LocalSession session, @Optional("5") Expression radius, @Optional() final String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Optional("1") final double yscale, @Switch('r') boolean randomRotate, @Switch('l') boolean layers, @Switch('s') boolean dontSmooth, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException { public BrushSettings cliffBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Arg(name = "yscale", desc = "double", def = "1") final double yscale, @Switch('r') boolean randomRotate, @Switch('l') boolean layers, @Switch('s') boolean dontSmooth, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException {
return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context); return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context);
} }
@ -1443,7 +1443,7 @@ public class BrushCommands {
desc = "This brush raises or lowers land towards the clicked point" desc = "This brush raises or lowers land towards the clicked point"
) )
@CommandPermissions("worldedit.brush.height") @CommandPermissions("worldedit.brush.height")
public BrushSettings flattenBrush(Player player, LocalSession session, @Optional("5") Expression radius, @Optional() final String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Optional("1") final double yscale, @Switch('r') boolean randomRotate, @Switch('l') boolean layers, @Switch('s') boolean dontSmooth, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException { public BrushSettings flattenBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") final String image, @Optional("0") @Step(90) @Range(min=0, max=360) final int rotation, @Arg(name = "yscale", desc = "double", def = "1") final double yscale, @Switch('r') boolean randomRotate, @Switch('l') boolean layers, @Switch('s') boolean dontSmooth, CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException {
return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context); return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
} }
@ -1519,7 +1519,7 @@ public class BrushCommands {
"Video: https://www.youtube.com/watch?v=RPZIaTbqoZw" "Video: https://www.youtube.com/watch?v=RPZIaTbqoZw"
) )
@CommandPermissions("worldedit.brush.copy") @CommandPermissions("worldedit.brush.copy")
public BrushSettings copy(Player player, LocalSession session, @Optional("5") Expression radius, @Switch('r') boolean randomRotate, @Switch('a') boolean autoRotate, CommandContext context) throws WorldEditException { public BrushSettings copy(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Switch('r') boolean randomRotate, @Switch('a') boolean autoRotate, CommandContext context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
player.print(BBC.BRUSH_COPY.f(radius)); player.print(BBC.BRUSH_COPY.f(radius));

View File

@ -135,7 +135,7 @@ public class BrushOptionsCommands extends MethodCommands {
" -p <page> prints the requested page\n" " -p <page> prints the requested page\n"
) )
@CommandPermissions("worldedit.brush.list") @CommandPermissions("worldedit.brush.list")
public void list(Actor actor, CommandContext args, @Switch('p') @Optional("1") int page) throws WorldEditException { public void list(Actor actor, CommandContext args, @Switch('p') @Arg(name = "page", desc = "int", def = "1") int page) throws WorldEditException {
String baseCmd = Commands.getAlias(BrushCommands.class, "brush") + " " + Commands.getAlias(BrushOptionsCommands.class, "loadbrush"); String baseCmd = Commands.getAlias(BrushCommands.class, "brush") + " " + Commands.getAlias(BrushOptionsCommands.class, "loadbrush");
File dir = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes"); File dir = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
UtilityCommands.list(dir, actor, args, page, null, true, baseCmd); UtilityCommands.list(dir, actor, args, page, null, true, baseCmd);
@ -251,7 +251,7 @@ public class BrushOptionsCommands extends MethodCommands {
desc = "Toggle between different target modes" desc = "Toggle between different target modes"
) )
@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, @Arg(name = "mode", desc = "int", def = "0") int mode) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false); BrushTool tool = session.getBrushTool(player, false);
if (tool == null) { if (tool == null) {
BBC.BRUSH_NONE.send(player); BBC.BRUSH_NONE.send(player);

View File

@ -280,7 +280,7 @@ public class ClipboardCommands {
) )
@Deprecated @Deprecated
@CommandPermissions({"worldedit.clipboard.download"}) @CommandPermissions({"worldedit.clipboard.download"})
public void download(final Player player, final LocalSession session, @Optional("schem") final String formatName) throws WorldEditException { public void download(final Player player, final LocalSession session, @Arg(name = "format", desc = "String", def = "schem") final String formatName) throws WorldEditException {
final ClipboardFormat format = ClipboardFormats.findByAlias(formatName); final ClipboardFormat format = ClipboardFormats.findByAlias(formatName);
if (format == null) { if (format == null) {
BBC.CLIPBOARD_INVALID_FORMAT.send(player, formatName); BBC.CLIPBOARD_INVALID_FORMAT.send(player, formatName);

View File

@ -130,8 +130,8 @@ public class GenerationCommands {
) )
@CommandPermissions("worldedit.generation.image") @CommandPermissions("worldedit.generation.image")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public void image(Player player, LocalSession session, EditSession editSession, String arg, @Optional("true") boolean randomize, public void image(Player player, LocalSession session, EditSession editSession, String arg, @Arg(name = "randomize", desc = "boolean", def = "true") boolean randomize,
@Arg(desc = "TODO", def = "100") int threshold, @Optional BlockVector2 dimensions) throws WorldEditException, IOException { @Arg(desc = "TODO", def = "100") int threshold, @Arg(name = "dimensions", desc = "BlockVector2", def = "") BlockVector2 dimensions) throws WorldEditException, IOException {
TextureUtil tu = Fawe.get().getCachedTextureUtil(randomize, 0, threshold); TextureUtil tu = Fawe.get().getCachedTextureUtil(randomize, 0, threshold);
URL url = new URL(arg); URL url = new URL(arg);
if (!url.getHost().equalsIgnoreCase("i.imgur.com") && !url.getHost().equalsIgnoreCase("empcraft.com")) { if (!url.getHost().equalsIgnoreCase("i.imgur.com") && !url.getHost().equalsIgnoreCase("empcraft.com")) {
@ -190,7 +190,7 @@ public class GenerationCommands {
BlockVector2 radius, BlockVector2 radius,
@Arg(desc = "The height of the cylinder", def = "1") @Arg(desc = "The height of the cylinder", def = "1")
int height, int height,
@Range(min = 1) @Optional("1") double thickness, CommandContext context) throws WorldEditException { @Range(min = 1) @Arg(name = "thickness", desc = "double", def = "1") double thickness, CommandContext context) throws WorldEditException {
double max = MathMan.max(radius.getBlockX(), radius.getBlockZ()); double max = MathMan.max(radius.getBlockX(), radius.getBlockZ());
worldEdit.checkMaxRadius(max); worldEdit.checkMaxRadius(max);
BlockVector3 pos = session.getPlacementPosition(player); BlockVector3 pos = session.getPlacementPosition(player);

View File

@ -33,6 +33,7 @@ import com.boydti.fawe.object.changeset.DiskStorageHistory;
import com.boydti.fawe.regions.FaweMaskManager; import com.boydti.fawe.regions.FaweMaskManager;
import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.MathMan;
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;
@ -78,7 +79,7 @@ public class HistoryCommands extends MethodCommands {
" - Import from disk: /frb #import" " - Import from disk: /frb #import"
) )
@CommandPermissions("worldedit.history.rollback") @CommandPermissions("worldedit.history.rollback")
public void faweRollback(final Player player, LocalSession session, final String user, @Optional("0") @Range(min = 0) int radius, @Optional("0") String time, @Switch('r') boolean restore) throws WorldEditException { public void faweRollback(final Player player, LocalSession session, final String user, @Optional("0") @Range(min = 0) int radius, @Arg(name = "time", desc = "String", def = "0") String time, @Switch('r') boolean restore) throws WorldEditException {
if (!Settings.IMP.HISTORY.USE_DATABASE) { if (!Settings.IMP.HISTORY.USE_DATABASE) {
BBC.SETTING_DISABLE.send(player, "history.use-database (Import with /frb #import )"); BBC.SETTING_DISABLE.send(player, "history.use-database (Import with /frb #import )");
return; return;
@ -204,7 +205,7 @@ public class HistoryCommands extends MethodCommands {
" - Import from disk: /frb #import" " - Import from disk: /frb #import"
) )
@CommandPermissions("worldedit.history.rollback") @CommandPermissions("worldedit.history.rollback")
public void restore(final Player player, LocalSession session, final String user, @Optional("0") @Range(min = 0) int radius, @Optional("0") String time) throws WorldEditException { public void restore(final Player player, LocalSession session, final String user, @Optional("0") @Range(min = 0) int radius, @Arg(name = "time", desc = "String", def = "0") String time) throws WorldEditException {
faweRollback(player, session, user, radius, time, true); faweRollback(player, session, user, radius, time, true);
} }

View File

@ -257,7 +257,7 @@ public class MaskCommands extends MethodCommands {
"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"
) )
public Mask angle(Extent extent, String min, String max, @Switch('o') boolean overlay, @Optional("1") int distance) throws ExpressionException { public Mask angle(Extent extent, String min, String max, @Switch('o') boolean overlay, @Arg(name = "distance", desc = "int", def = "1") int distance) throws ExpressionException {
double y1, y2; double y1, y2;
boolean override; boolean override;
if (max.endsWith("d")) { if (max.endsWith("d")) {
@ -282,7 +282,7 @@ public class MaskCommands extends MethodCommands {
"Explanation: Restrict near where the angle changes between 0-45 degrees within 5 blocks\n" + "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"
) )
public Mask roc(Extent extent, String min, String max, @Switch('o') boolean overlay, @Optional("4") int distance) throws ExpressionException { public Mask roc(Extent extent, String min, String max, @Switch('o') boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distance) throws ExpressionException {
double y1, y2; double y1, y2;
boolean override; boolean override;
if (max.endsWith("d")) { if (max.endsWith("d")) {
@ -307,7 +307,7 @@ public class MaskCommands extends MethodCommands {
"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"
) )
public Mask extrema(Extent extent, String min, String max, @Switch('o') boolean overlay, @Optional("4") int distance) throws ExpressionException { public Mask extrema(Extent extent, String min, String max, @Switch('o') boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distance) throws ExpressionException {
double y1, y2; double y1, y2;
boolean override; boolean override;
if (max.endsWith("d")) { if (max.endsWith("d")) {
@ -345,7 +345,7 @@ public class MaskCommands extends MethodCommands {
aliases = {"#~", "#adjacent"}, aliases = {"#~", "#adjacent"},
desc = "Adjacent to a specific number of other blocks" desc = "Adjacent to a specific number of other blocks"
) )
public Mask adjacent(Mask mask, @Optional("-1") double min, @Optional("-1") double max) throws ExpressionException { public Mask adjacent(Mask mask, @Arg(name = "min", desc = "double", def = "-1") double min, @Arg(name = "max", desc = "double", def = "-1") double max) throws ExpressionException {
if (min == -1 && max == -1) { if (min == -1 && max == -1) {
min = 1; min = 1;
max = 8; max = 8;

View File

@ -103,7 +103,7 @@ public class OptionsCommands {
max = -1 max = -1
) )
@CommandPermissions("worldedit.global-texture") @CommandPermissions("worldedit.global-texture")
public void gtexture(FawePlayer player, LocalSession session, EditSession editSession, @Optional CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException { public void gtexture(FawePlayer player, LocalSession session, EditSession editSession, @Arg(name = "context", desc = "CommandContext", def = "") CommandContext context) throws WorldEditException, FileNotFoundException, ParameterException {
if (context == null || context.argsLength() == 0) { if (context == null || context.argsLength() == 0) {
session.setTextureUtil(null); session.setTextureUtil(null);
BBC.TEXTURE_DISABLED.send(player); BBC.TEXTURE_DISABLED.send(player);
@ -162,7 +162,7 @@ public class OptionsCommands {
max = -1 max = -1
) )
@CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"}) @CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"})
public void gmask(Player player, LocalSession session, EditSession editSession, @Optional CommandContext context) throws WorldEditException { public void gmask(Player player, LocalSession session, EditSession editSession, @Arg(name = "context", desc = "CommandContext", def = "") CommandContext context) throws WorldEditException {
if (context == null || context.argsLength() == 0) { if (context == null || context.argsLength() == 0) {
session.setMask((Mask) null); session.setMask((Mask) null);
BBC.MASK_DISABLED.send(player); BBC.MASK_DISABLED.send(player);
@ -186,7 +186,7 @@ public class OptionsCommands {
max = -1 max = -1
) )
@CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"}) @CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"})
public void gsmask(Player player, LocalSession session, EditSession editSession, @Optional CommandContext context) throws WorldEditException { public void gsmask(Player player, LocalSession session, EditSession editSession, @Arg(name = "context", desc = "CommandContext", def = "") CommandContext context) throws WorldEditException {
if (context == null || context.argsLength() == 0) { if (context == null || context.argsLength() == 0) {
session.setSourceMask((Mask) null); session.setSourceMask((Mask) null);
BBC.SOURCE_MASK_DISABLED.send(player); BBC.SOURCE_MASK_DISABLED.send(player);
@ -209,7 +209,7 @@ public class OptionsCommands {
max = -1 max = -1
) )
@CommandPermissions({"worldedit.global-transform", "worldedit.transform.global"}) @CommandPermissions({"worldedit.global-transform", "worldedit.transform.global"})
public void gtransform(Player player, EditSession editSession, LocalSession session, @Optional CommandContext context) throws WorldEditException { public void gtransform(Player player, EditSession editSession, LocalSession session, @Arg(name = "context", desc = "CommandContext", def = "") CommandContext context) throws WorldEditException {
if (context == null || context.argsLength() == 0) { if (context == null || context.argsLength() == 0) {
session.setTransform(null); session.setTransform(null);
BBC.TRANSFORM_DISABLED.send(player); BBC.TRANSFORM_DISABLED.send(player);

View File

@ -56,7 +56,7 @@ public class PatternCommands extends MethodCommands {
desc = "Use the block that is already there", desc = "Use the block that is already there",
usage = "[properties]" usage = "[properties]"
) )
public Pattern existing(Extent extent, @Optional String properties) { // TODO FIXME , @Optional String properties public Pattern existing(Extent extent, @Arg(name = "properties", desc = "String", def = "") String properties) { // TODO FIXME , @Arg(name = "properties", desc = "String", def = "") String properties
if (properties == null) return new ExistingPattern(extent); if (properties == null) return new ExistingPattern(extent);
return new PropertyPattern(extent).addRegex(".*[" + properties + "]"); return new PropertyPattern(extent).addRegex(".*[" + properties + "]");
} }
@ -97,7 +97,7 @@ public class PatternCommands extends MethodCommands {
name = "#anglecolor", name = "#anglecolor",
desc = "A darker block based on the existing terrain angle" desc = "A darker block based on the existing terrain angle"
) )
public Pattern anglecolor(Extent extent, LocalSession session, @Optional("true") boolean randomize, @Optional("100") double maxComplexity, @Optional("1") int distance) { public Pattern anglecolor(Extent extent, LocalSession session, @Arg(name = "randomize", desc = "boolean", def = "true") boolean randomize, @Arg(name = "maxcomplexity", desc = "double", def = "100") double maxComplexity, @Arg(name = "distance", desc = "int", def = "1") int distance) {
return new AngleColorPattern(extent, session, distance); return new AngleColorPattern(extent, session, distance);
} }
@ -105,7 +105,7 @@ public class PatternCommands extends MethodCommands {
name = "#angledata", name = "#angledata",
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, @Arg(name = "distance", desc = "int", def = "1") int distance) {
return new DataAnglePattern(extent, distance); return new DataAnglePattern(extent, distance);
} }
@ -131,7 +131,7 @@ public class PatternCommands extends MethodCommands {
name = "#desaturate", name = "#desaturate",
desc = "Desaturated color of the existing block" desc = "Desaturated color of the existing block"
) )
public Pattern desaturate(Extent extent, LocalSession session, @Optional("100") double percent) { public Pattern desaturate(Extent extent, LocalSession session, @Arg(name = "percent", desc = "double", def = "100") double percent) {
return new DesaturatePattern(extent, percent / 100d, session); return new DesaturatePattern(extent, percent / 100d, session);
} }
@ -155,7 +155,7 @@ public class PatternCommands extends MethodCommands {
name = "#fullcopy", name = "#fullcopy",
desc = "Places your full clipboard at each block" desc = "Places your full clipboard at each block"
) )
public Pattern fullcopy(Player player, Extent extent, LocalSession session, @Optional("#copy") String location, @Optional("false") boolean rotate, @Optional("false") boolean flip) throws EmptyClipboardException, InputParseException, IOException { public Pattern fullcopy(Player player, Extent extent, LocalSession session, @Arg(name = "location", desc = "String", def = "#copy") String location, @Arg(name = "rotate", desc = "boolean", def = "false") boolean rotate, @Arg(name = "flip", desc = "boolean", def = "false") boolean flip) throws EmptyClipboardException, InputParseException, IOException {
List<ClipboardHolder> clipboards; List<ClipboardHolder> clipboards;
switch (location.toLowerCase()) { switch (location.toLowerCase()) {
case "#copy": case "#copy":

View File

@ -280,7 +280,7 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.replace") @CommandPermissions("worldedit.region.replace")
@Logging(REGION) @Logging(REGION)
public void replace(FawePlayer player, EditSession editSession, @Selection Region region, @Optional Mask from, Pattern to, CommandContext context) throws WorldEditException { public void replace(FawePlayer player, EditSession editSession, @Selection Region region, @Arg(name = "from", desc = "Mask", def = "") Mask from, Pattern to, CommandContext context) throws WorldEditException {
player.checkConfirmationRegion(() -> { player.checkConfirmationRegion(() -> {
int affected = editSession.replaceBlocks(region, from == null ? new ExistingBlockMask(editSession) : from, to); int affected = editSession.replaceBlocks(region, from == null ? new ExistingBlockMask(editSession) : from, to);
BBC.VISITOR_BLOCK.send(player, affected); BBC.VISITOR_BLOCK.send(player, affected);
@ -412,7 +412,7 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.smooth") @CommandPermissions("worldedit.region.smooth")
@Logging(REGION) @Logging(REGION)
public void smooth(FawePlayer player, EditSession editSession, @Selection Region region, @Optional("1") int iterations, @Optional Mask mask, @Switch('s') boolean snow, CommandContext context) throws WorldEditException { public void smooth(FawePlayer player, EditSession editSession, @Selection Region region, @Arg(name = "iterations", desc = "int", def = "1") int iterations, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch('s') boolean snow, CommandContext context) throws WorldEditException {
BlockVector3 min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
BlockVector3 max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1)); long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
@ -524,7 +524,7 @@ public class RegionCommands {
@Logging(ORIENTATION_REGION) @Logging(ORIENTATION_REGION)
public void fall(FawePlayer player, EditSession editSession, LocalSession session, public void fall(FawePlayer player, EditSession editSession, LocalSession session,
@Selection Region region, @Selection Region region,
@Optional("air") BlockStateHolder replace, @Arg(name = "replace", desc = "BlockStateHolder", def = "air") BlockStateHolder replace,
@Switch('m') boolean notFullHeight, @Switch('m') boolean notFullHeight,
CommandContext context) throws WorldEditException { CommandContext context) throws WorldEditException {
player.checkConfirmationRegion(() -> { player.checkConfirmationRegion(() -> {

View File

@ -39,7 +39,7 @@ public class TransformCommands extends MethodCommands {
aliases = {"#l"}, aliases = {"#l"},
desc = "Sequentially pick from a list of transform" desc = "Sequentially pick from a list of transform"
) )
public ResettableExtent linear(Actor actor, LocalSession session, @Optional("#null") ResettableExtent other) { public ResettableExtent linear(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
if (other instanceof RandomTransform) { if (other instanceof RandomTransform) {
Set<ResettableExtent> extents = ((RandomTransform) other).getExtents(); Set<ResettableExtent> extents = ((RandomTransform) other).getExtents();
return new LinearTransform(extents.toArray(new ResettableExtent[extents.size()])); return new LinearTransform(extents.toArray(new ResettableExtent[extents.size()]));
@ -52,7 +52,7 @@ public class TransformCommands extends MethodCommands {
aliases = {"#l3d"}, aliases = {"#l3d"},
desc = "Use the x,y,z coordinate to pick a transform from the list" desc = "Use the x,y,z coordinate to pick a transform from the list"
) )
public ResettableExtent linear3d(Actor actor, LocalSession session, @Optional("#null") ResettableExtent other) { public ResettableExtent linear3d(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
if (other instanceof RandomTransform) { if (other instanceof RandomTransform) {
Set<ResettableExtent> extents = ((RandomTransform) other).getExtents(); Set<ResettableExtent> extents = ((RandomTransform) other).getExtents();
return new Linear3DTransform(extents.toArray(new ResettableExtent[extents.size()])); return new Linear3DTransform(extents.toArray(new ResettableExtent[extents.size()]));
@ -64,7 +64,7 @@ public class TransformCommands extends MethodCommands {
name = "#pattern", name = "#pattern",
desc = "Always use a specific pattern" desc = "Always use a specific pattern"
) )
public ResettableExtent pattern(Actor actor, LocalSession session, Pattern pattern, @Optional("#null") ResettableExtent other) { public ResettableExtent pattern(Actor actor, LocalSession session, Pattern pattern, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
return new PatternTransform(other, pattern); return new PatternTransform(other, pattern);
} }
@ -72,7 +72,7 @@ public class TransformCommands extends MethodCommands {
name = "#offset", name = "#offset",
desc = "Offset transform" desc = "Offset transform"
) )
public ResettableExtent offset(Actor actor, LocalSession session, double x, double y, double z, @Optional("#null") ResettableExtent other) { public ResettableExtent offset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
return new OffsetExtent(other, (int) x, (int) y, (int) z); return new OffsetExtent(other, (int) x, (int) y, (int) z);
} }
@ -81,7 +81,7 @@ public class TransformCommands extends MethodCommands {
aliases = {"#randomoffset"}, aliases = {"#randomoffset"},
desc = "Random offset transform" desc = "Random offset transform"
) )
public ResettableExtent randomoffset(Actor actor, LocalSession session, double x, double y, double z, @Optional("#null") ResettableExtent other) { public ResettableExtent randomoffset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
return new RandomOffsetTransform(other, (int) x, (int) y, (int) z); return new RandomOffsetTransform(other, (int) x, (int) y, (int) z);
} }
@ -89,7 +89,7 @@ public class TransformCommands extends MethodCommands {
name = "#scale", name = "#scale",
desc = "All changes will be scaled" desc = "All changes will be scaled"
) )
public ResettableExtent scale(Actor actor, LocalSession session, double x, double y, double z, @Optional("#null") ResettableExtent other) { public ResettableExtent scale(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
return new ScaleTransform(other, x, y, z); return new ScaleTransform(other, x, y, z);
} }
@ -97,7 +97,7 @@ public class TransformCommands extends MethodCommands {
name = "#rotate", name = "#rotate",
desc = "All changes will be rotate around the initial position" desc = "All changes will be rotate around the initial position"
) )
public ResettableExtent rotate(Player player, LocalSession session, double x, double y, double z, @Optional("#null") ResettableExtent other) { public ResettableExtent rotate(Player player, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
ExtentTraverser traverser = new ExtentTraverser(other).find(TransformExtent.class); ExtentTraverser traverser = new ExtentTraverser(other).find(TransformExtent.class);
BlockTransformExtent affine = (TransformExtent) (traverser != null ? traverser.get() : null); BlockTransformExtent affine = (TransformExtent) (traverser != null ? traverser.get() : null);
if (affine == null) { if (affine == null) {

View File

@ -114,7 +114,7 @@ public class UtilityCommands {
desc = "Generate the heightmap interface: https://github.com/boy0001/HeightMap" desc = "Generate the heightmap interface: https://github.com/boy0001/HeightMap"
) )
@CommandPermissions("fawe.admin") @CommandPermissions("fawe.admin")
public void heightmapInterface(Player player, @Optional("100") int min, @Optional("200") int max) throws IOException { public void heightmapInterface(Player player, @Arg(name = "min", desc = "int", def = "100") int min, @Arg(name = "max", desc = "int", def = "200") int max) throws IOException {
player.print("Please wait while we generate the minified heightmaps."); player.print("Please wait while we generate the minified heightmaps.");
File srcFolder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HEIGHTMAP); File srcFolder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HEIGHTMAP);