Upstream changes, prefix changes, formatting changes, variable name changes

I think that draining waterlogged items also works now?
This commit is contained in:
MattBDev
2019-06-12 17:12:12 -04:00
parent e6a433ec93
commit 1f14d4652e
40 changed files with 587 additions and 684 deletions

View File

@ -208,7 +208,7 @@ public class BrushCommands extends BrushProcessor {
@CommandPermissions("worldedit.brush.spline")
public BrushSettings splineBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Optional("25") Expression radius, CommandContext context) throws WorldEditException {
getWorldEdit().checkMaxBrushRadius(radius);
player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE.f(radius));
player.print(BBC.BRUSH_SPLINE.f(radius));
return set(session, context,
new SplineBrush(player, session))
.setSize(radius)
@ -227,7 +227,7 @@ public class BrushCommands extends BrushProcessor {
)
@CommandPermissions("worldedit.brush.sweep")
public BrushSettings sweepBrush(Player player, LocalSession session, EditSession editSession, @Optional("-1") int copies, CommandContext context) throws WorldEditException {
player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE.s());
player.print(BBC.BRUSH_SPLINE.s());
return set(session, context, new SweepBrush(copies));
}
@ -263,7 +263,7 @@ public class BrushCommands extends BrushProcessor {
)
@CommandPermissions("worldedit.brush.surfacespline") // 0, 0, 0, 10, 0,
public BrushSettings surfaceSpline(Player player, EditSession editSession, LocalSession session, Pattern fill, @Optional("0") Expression radius, @Optional("0") double tension, @Optional("0") double bias, @Optional("0") double continuity, @Optional("10") double quality, CommandContext context) throws WorldEditException {
player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE.f(radius));
player.print(BBC.BRUSH_SPLINE.f(radius));
getWorldEdit().checkMaxBrushRadius(radius);
return set(session, context,
new SurfaceSpline(tension, bias, continuity, quality))
@ -794,7 +794,7 @@ public class BrushCommands extends BrushProcessor {
@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 {
getWorldEdit().checkMaxBrushRadius(radius);
player.print(BBC.getPrefix() + BBC.BRUSH_COPY.f(radius));
player.print(BBC.BRUSH_COPY.f(radius));
return set(session, context,
new CopyPastaBrush(player, session, randomRotate, autoRotate))

View File

@ -355,7 +355,7 @@ public class BrushOptionsCommands extends MethodCommands {
public void mask(Player player, LocalSession session, EditSession editSession, @Optional @Switch('h') boolean offHand, CommandContext context) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false);
if (tool == null) {
player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f());
player.print(BBC.BRUSH_NONE.f());
return;
}
if (context.argsLength() == 0) {
@ -388,7 +388,7 @@ public class BrushOptionsCommands extends MethodCommands {
public void smask(Player player, LocalSession session, EditSession editSession, @Optional @Switch('h') boolean offHand, CommandContext context) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false);
if (tool == null) {
player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f());
player.print(BBC.BRUSH_NONE.f());
return;
}
if (context.argsLength() == 0) {
@ -420,7 +420,7 @@ public class BrushOptionsCommands extends MethodCommands {
public void transform(Player player, LocalSession session, EditSession editSession, @Optional @Switch('h') boolean offHand, CommandContext context) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false);
if (tool == null) {
player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f());
player.print(BBC.BRUSH_NONE.f());
return;
}
if (context.argsLength() == 0) {
@ -452,7 +452,7 @@ public class BrushOptionsCommands extends MethodCommands {
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);
if (tool == null) {
player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f());
player.print(BBC.BRUSH_NONE.f());
return;
}
if (context.argsLength() == 0) {
@ -479,7 +479,7 @@ public class BrushOptionsCommands extends MethodCommands {
int range = Math.max(0, Math.min(256, args.getInteger(0)));
BrushTool tool = session.getBrushTool(player, false);
if (tool == null) {
player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f());
player.print(BBC.BRUSH_NONE.f());
return;
}
tool.setRange(range);
@ -499,7 +499,7 @@ public class BrushOptionsCommands extends MethodCommands {
worldEdit.checkMaxBrushRadius(radius);
BrushTool tool = session.getBrushTool(player, false);
if (tool == null) {
player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f());
player.print(BBC.BRUSH_NONE.f());
return;
}
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
@ -509,4 +509,4 @@ public class BrushOptionsCommands extends MethodCommands {
}
}
}

View File

@ -31,7 +31,6 @@ import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.minecraft.util.commands.Logging;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@ -44,17 +43,16 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.visitor.RegionVisitor;
import com.sk89q.worldedit.internal.annotation.Selection;
import com.sk89q.worldedit.internal.expression.ExpressionException;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.util.command.binding.Range;
import com.sk89q.worldedit.util.command.binding.Switch;
import com.sk89q.worldedit.util.command.binding.Text;
import com.sk89q.worldedit.util.command.parametric.Optional;
import com.sk89q.worldedit.util.command.parametric.ParameterException;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockType;
@ -63,7 +61,9 @@ import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.*;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.ALL;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION;
/**
@ -89,7 +89,7 @@ public class GenerationCommands extends MethodCommands {
)
@CommandPermissions("worldedit.generation.caves")
@Logging(PLACEMENT)
public void caves(FawePlayer fp, LocalSession session, EditSession editSession, @Selection Region region, @Optional("8") int size, @Optional("40") int frequency, @Optional("7") int rarity, @Optional("8") int minY, @Optional("127") int maxY, @Optional("1") int systemFrequency, @Optional("25") int individualRarity, @Optional("0") int pocketChance, @Optional("0") int pocketMin, @Optional("3") int pocketMax, CommandContext context) throws WorldEditException, ParameterException {
public void caves(FawePlayer fp, LocalSession session, EditSession editSession, @Selection Region region, @Optional("8") int size, @Optional("40") int frequency, @Optional("7") int rarity, @Optional("8") int minY, @Optional("127") int maxY, @Optional("1") int systemFrequency, @Optional("25") int individualRarity, @Optional("0") int pocketChance, @Optional("0") int pocketMin, @Optional("3") int pocketMax, CommandContext context) throws WorldEditException {
fp.checkConfirmationRegion(() -> {
CavesGen gen = new CavesGen(size, frequency, rarity, minY, maxY, systemFrequency, individualRarity, pocketChance, pocketMin, pocketMax);
editSession.generate(region, gen);
@ -108,7 +108,7 @@ public class GenerationCommands extends MethodCommands {
)
@CommandPermissions("worldedit.generation.ore")
@Logging(PLACEMENT)
public void ores(FawePlayer player, LocalSession session, EditSession editSession, @Selection Region region, Mask mask, CommandContext context) throws WorldEditException, ParameterException {
public void ores(FawePlayer player, LocalSession session, EditSession editSession, @Selection Region region, Mask mask, CommandContext context) throws WorldEditException {
player.checkConfirmationRegion(() -> {
editSession.addOres(region, mask);
BBC.VISITOR_BLOCK.send(player, editSession.getBlockChangeCount());
@ -124,7 +124,7 @@ public class GenerationCommands extends MethodCommands {
)
@CommandPermissions("worldedit.generation.image")
@Logging(PLACEMENT)
public void image(Player player, LocalSession session, EditSession editSession, String arg, @Optional("true") boolean randomize, @Optional("100") int threshold, @Optional BlockVector2 dimensions) throws WorldEditException, ParameterException, IOException {
public void image(Player player, LocalSession session, EditSession editSession, String arg, @Optional("true") boolean randomize, @Optional("100") int threshold, @Optional BlockVector2 dimensions) throws WorldEditException, IOException {
TextureUtil tu = Fawe.get().getCachedTextureUtil(randomize, 0, threshold);
URL url = new URL(arg);
if (!url.getHost().equalsIgnoreCase("i.imgur.com") && !url.getHost().equalsIgnoreCase("empcraft.com")) {
@ -174,7 +174,7 @@ public class GenerationCommands extends MethodCommands {
)
@CommandPermissions("worldedit.generation.ore")
@Logging(PLACEMENT)
public void ore(FawePlayer player, LocalSession session, EditSession editSession, @Selection Region region, Mask mask, Pattern material, @Range(min = 0) int size, int freq, @Range(min = 0, max = 100) int rarity, @Range(min = 0, max = 255) int minY, @Range(min = 0, max = 255) int maxY, CommandContext context) throws WorldEditException, ParameterException {
public void ore(FawePlayer player, LocalSession session, EditSession editSession, @Selection Region region, Mask mask, Pattern material, @Range(min = 0) int size, int freq, @Range(min = 0, max = 100) int rarity, @Range(min = 0, max = 255) int minY, @Range(min = 0, max = 255) int maxY, CommandContext context) throws WorldEditException {
player.checkConfirmationRegion(() -> {
editSession.addOre(region, mask, material, size, freq, rarity, minY, maxY);
BBC.VISITOR_BLOCK.send(player, editSession.getBlockChangeCount());
@ -182,20 +182,20 @@ public class GenerationCommands extends MethodCommands {
}
@Command(
aliases = {"/hcyl"},
usage = "<pattern> <radius>[,<radius>] [height]",
desc = "Generates a hollow cylinder.",
help =
"Generates a hollow cylinder.\n" +
"By specifying 2 radii, separated by a comma,\n" +
"you can generate elliptical cylinders.\n" +
"The 1st radius is north/south, the 2nd radius is east/west.",
min = 2,
max = 4
aliases = { "/hcyl" },
usage = "<pattern> <radius>[,<radius>] [height]",
desc = "Generates a hollow cylinder.",
help =
"Generates a hollow cylinder.\n" +
"By specifying 2 radii, separated by a comma,\n" +
"you can generate elliptical cylinders.\n" +
"The 1st radius is north/south, the 2nd radius is east/west.",
min = 2,
max = 4
)
@CommandPermissions("worldedit.generation.cylinder")
@Logging(PLACEMENT)
public void hcyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector2 radius, @Optional("1") int height, @Range(min = 1) @Optional("1") double thickness, CommandContext context) throws WorldEditException, ParameterException {
public void hcyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector2 radius, @Optional("1") int height, @Range(min = 1) @Optional("1") double thickness, CommandContext context) throws WorldEditException {
double max = MathMan.max(radius.getBlockX(), radius.getBlockZ());
worldEdit.checkMaxRadius(max);
BlockVector3 pos = session.getPlacementPosition(player);
@ -206,22 +206,22 @@ public class GenerationCommands extends MethodCommands {
}
@Command(
aliases = {"/cyl"},
usage = "<pattern> <radius>[,<radius>] [height]",
flags = "h",
desc = "Generates a cylinder.",
help =
"Generates a cylinder.\n" +
"By specifying 2 radii, separated by a comma,\n" +
"you can generate elliptical cylinders.\n" +
"The 1st radius is north/south, the 2nd radius is east/west.",
min = 2,
max = 3
aliases = { "/cyl" },
usage = "<pattern> <radius>[,<radius>] [height]",
flags = "h",
desc = "Generates a cylinder.",
help =
"Generates a cylinder.\n" +
"By specifying 2 radii, separated by a comma,\n" +
"you can generate elliptical cylinders.\n" +
"The 1st radius is north/south, the 2nd radius is east/west.",
min = 2,
max = 3
)
@CommandPermissions("worldedit.generation.cylinder")
@Logging(PLACEMENT)
public void cyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector2 radius, @Optional("1") int height, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException {
double max = MathMan.max(radius.getBlockX(), radius.getBlockZ());
public void cyl(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector2 radius, @Optional("1") int height, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException {
double max = Math.max(radius.getBlockX(), radius.getBlockZ());
worldEdit.checkMaxRadius(max);
BlockVector3 pos = session.getPlacementPosition(player);
fp.checkConfirmationRadius(() -> {
@ -231,39 +231,39 @@ public class GenerationCommands extends MethodCommands {
}
@Command(
aliases = {"/hsphere"},
usage = "<pattern> <radius>[,<radius>,<radius>] [raised?]",
desc = "Generates a hollow sphere.",
help =
"Generates a hollow sphere.\n" +
"By specifying 3 radii, separated by commas,\n" +
"you can generate an ellipsoid. The order of the ellipsoid radii\n" +
"is north/south, up/down, east/west.",
min = 2,
max = 3
aliases = { "/hsphere" },
usage = "<pattern> <radius>[,<radius>,<radius>] [raised?]",
desc = "Generates a hollow sphere.",
help =
"Generates a hollow sphere.\n" +
"By specifying 3 radii, separated by commas,\n" +
"you can generate an ellipsoid. The order of the ellipsoid radii\n" +
"is north/south, up/down, east/west.",
min = 2,
max = 3
)
@CommandPermissions("worldedit.generation.sphere")
@Logging(PLACEMENT)
public void hsphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector3 radius, @Optional("false") boolean raised, CommandContext context) throws WorldEditException, ParameterException {
public void hsphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector3 radius, @Optional("false") boolean raised, CommandContext context) throws WorldEditException {
sphere(fp, player, session, editSession, pattern, radius, raised, true, context);
}
@Command(
aliases = {"/sphere"},
usage = "<pattern> <radius>[,<radius>,<radius>] [raised?]",
flags = "h",
desc = "Generates a filled sphere.",
help =
"Generates a filled sphere.\n" +
"By specifying 3 radii, separated by commas,\n" +
"you can generate an ellipsoid. The order of the ellipsoid radii\n" +
"is north/south, up/down, east/west.",
min = 2,
max = 3
aliases = { "/sphere" },
usage = "<pattern> <radius>[,<radius>,<radius>] [raised?]",
flags = "h",
desc = "Generates a filled sphere.",
help =
"Generates a filled sphere.\n" +
"By specifying 3 radii, separated by commas,\n" +
"you can generate an ellipsoid. The order of the ellipsoid radii\n" +
"is north/south, up/down, east/west.",
min = 2,
max = 3
)
@CommandPermissions("worldedit.generation.sphere")
@Logging(PLACEMENT)
public void sphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector3 radius, @Optional("false") boolean raised, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException {
public void sphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, BlockVector3 radius, @Optional("false") boolean raised, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException {
double max = MathMan.max(radius.getBlockX(), radius.getBlockY(), radius.getBlockZ());
worldEdit.checkMaxRadius(max);
BlockVector3 pos = session.getPlacementPosition(player);
@ -276,36 +276,37 @@ public class GenerationCommands extends MethodCommands {
}
@Command(
aliases = {"forestgen"},
usage = "[size] [tree-type] [density]",
desc = "Generate a forest",
min = 0,
max = 3
aliases = { "forestgen" },
usage = "[size] [type] [density]",
desc = "Generate a forest",
min = 0,
max = 3
)
@CommandPermissions("worldedit.generation.forest")
@Logging(POSITION)
@SuppressWarnings("deprecation")
public void forestGen(Player player, LocalSession session, EditSession editSession, @Optional("10") int size, @Optional("tree") TreeType type, @Optional("5") @Range(min = 0, max = 100) double density) throws WorldEditException, ParameterException {
public void forestGen(Player player, LocalSession session, EditSession editSession, @Optional("10") int size,
@Optional("tree") TreeType type, @Optional("5") @Range(min = 0, max = 100) double density) throws WorldEditException {
density = density / 100;
int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, type);
player.print(BBC.getPrefix() + affected + " trees created.");
player.print(affected + " trees created.");
}
@Command(
aliases = {"pumpkins"},
usage = "[size=10]",
desc = "Generate pumpkin patches",
max = 2
aliases = { "pumpkins" },
usage = "[size]",
desc = "Generate pumpkin patches",
min = 0,
max = 2
)
@CommandPermissions("worldedit.generation.pumpkins")
@Logging(POSITION)
public void pumpkins(Player player, LocalSession session, EditSession editSession, @Optional("10") int apothem) throws WorldEditException, ParameterException {
public void pumpkins(Player player, LocalSession session, EditSession editSession, @Optional("10") int apothem) throws WorldEditException {
int affected = editSession.makePumpkinPatches(session.getPlacementPosition(player), apothem);
BBC.COMMAND_PUMPKIN.send(player, affected);
}
@Command(
aliases = {"/hpyramid"},
aliases = { "/hpyramid" },
usage = "<pattern> <size>",
desc = "Generate a hollow pyramid",
min = 2,
@ -313,21 +314,21 @@ public class GenerationCommands extends MethodCommands {
)
@CommandPermissions("worldedit.generation.pyramid")
@Logging(PLACEMENT)
public void hollowPyramid(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, CommandContext context) throws WorldEditException, ParameterException {
public void hollowPyramid(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, CommandContext context) throws WorldEditException {
pyramid(fp, player, session, editSession, pattern, size, true, context);
}
@Command(
aliases = {"/pyramid"},
usage = "<pattern> <size>",
flags = "h",
desc = "Generate a filled pyramid",
min = 2,
max = 2
aliases = { "/pyramid" },
usage = "<pattern> <size>",
flags = "h",
desc = "Generate a filled pyramid",
min = 2,
max = 2
)
@CommandPermissions("worldedit.generation.pyramid")
@Logging(PLACEMENT)
public void pyramid(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException, ParameterException {
public void pyramid(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, @Range(min = 1) int size, @Switch('h') boolean hollow, CommandContext context) throws WorldEditException {
BlockVector3 pos = session.getPlacementPosition(player);
worldEdit.checkMaxRadius(size);
fp.checkConfirmationRadius(() -> {
@ -336,26 +337,26 @@ public class GenerationCommands extends MethodCommands {
BBC.VISITOR_BLOCK.send(fp, affected);
}, getArguments(context), size, context);
}
@Command(
aliases = {"/generate", "/gen", "/g"},
usage = "<pattern> <expression>",
desc = "Generates a shape according to a formula.",
help =
"Generates a shape according to a formula that is expected to\n" +
"return positive numbers (true) if the point is inside the shape\n" +
"Optionally set type/data to the desired block.\n" +
"Flags:\n" +
" -h to generate a hollow shape\n" +
" -r to use raw minecraft coordinates\n" +
" -o is like -r, except offset from placement.\n" +
" -c is like -r, except offset selection center.\n" +
"If neither -r nor -o is given, the selection is mapped to -1..1\n" +
"See also tinyurl.com/wesyntax.",
flags = "hroc",
min = 2,
max = -1
aliases = { "/generate", "/gen", "/g" },
usage = "<pattern> <expression>",
desc = "Generates a shape according to a formula.",
help =
"Generates a shape according to a formula that is expected to\n" +
"return positive numbers (true) if the point is inside the shape\n" +
"Optionally set type/data to the desired block.\n" +
"Flags:\n" +
" -h to generate a hollow shape\n" +
" -r to use raw minecraft coordinates\n" +
" -o is like -r, except offset from placement.\n" +
" -c is like -r, except offset selection center.\n" +
"If neither -r nor -o is given, the selection is mapped to -1..1\n" +
"See also tinyurl.com/wesyntax.",
flags = "hroc",
min = 2,
max = -1
)
@CommandPermissions("worldedit.generation.shape")
@Logging(ALL)
@ -394,7 +395,7 @@ public class GenerationCommands extends MethodCommands {
if (unit.getY() == 0) unit = unit.withY(1.0);
if (unit.getZ() == 0) unit = unit.withZ(1.0);
}
final Vector3 unit1 = unit;
fp.checkConfirmationRegion(() -> {
@ -403,29 +404,29 @@ public class GenerationCommands extends MethodCommands {
player.findFreePosition();
BBC.VISITOR_BLOCK.send(fp, affected);
} catch (ExpressionException e) {
fp.sendMessage(BBC.getPrefix() + e.getMessage());
fp.sendMessage(e.getMessage());
}
}, getArguments(context), region, context);
}
@Command(
aliases = {"/generatebiome", "/genbiome", "/gb"},
usage = "<biome> <expression>",
desc = "Sets biome according to a formula.",
help =
"Generates a shape according to a formula that is expected to\n" +
"return positive numbers (true) if the point is inside the shape\n" +
"Sets the biome of blocks in that shape.\n" +
"Flags:\n" +
" -h to generate a hollow shape\n" +
" -r to use raw minecraft coordinates\n" +
" -o is like -r, except offset from placement.\n" +
" -c is like -r, except offset selection center.\n" +
"If neither -r nor -o is given, the selection is mapped to -1..1\n" +
"See also tinyurl.com/wesyntax.",
flags = "hroc",
min = 2,
max = -1
aliases = { "/generatebiome", "/genbiome", "/gb" },
usage = "<biome> <expression>",
desc = "Sets biome according to a formula.",
help =
"Generates a shape according to a formula that is expected to\n" +
"return positive numbers (true) if the point is inside the shape\n" +
"Sets the biome of blocks in that shape.\n" +
"Flags:\n" +
" -h to generate a hollow shape\n" +
" -r to use raw minecraft coordinates\n" +
" -o is like -r, except offset from placement.\n" +
" -c is like -r, except offset selection center.\n" +
"If neither -r nor -o is given, the selection is mapped to -1..1\n" +
"See also tinyurl.com/wesyntax.",
flags = "hroc",
min = 2,
max = -1
)
@CommandPermissions("worldedit.generation.shape.biome")
@Logging(ALL)
@ -464,17 +465,18 @@ public class GenerationCommands extends MethodCommands {
if (unit.getY() == 0) unit = unit.withY(1.0);
if (unit.getZ() == 0) unit = unit.withZ(1.0);
}
final Vector3 unit1 = unit;
fp.checkConfirmationRegion(() -> {
try {
final int affected = editSession.makeBiomeShape(region, zero, unit1, target, expression, hollow);
player.findFreePosition();
BBC.VISITOR_FLAT.send(fp, affected);
} catch (ExpressionException e) {
fp.sendMessage(BBC.getPrefix() + e.getMessage());
fp.toWorldEditPlayer().printError(e.getMessage());
}
}, getArguments(context), region, context);
}
}

View File

@ -117,7 +117,7 @@ public class HistoryCommands extends MethodCommands {
rollback.setTime(historyFile.lastModified());
RollbackDatabase db = DBHandler.IMP.getDatabase(world);
db.logEdit(rollback);
player.print(BBC.getPrefix() + "Logging: " + historyFile);
player.print("Logging: " + historyFile);
}
}
} catch (IllegalArgumentException e) {
@ -127,7 +127,7 @@ public class HistoryCommands extends MethodCommands {
}
}
}
player.print(BBC.getPrefix() + "Done import!");
player.print("Done import!");
return;
}
String toParse = user.substring(1);
@ -311,4 +311,4 @@ public class HistoryCommands extends MethodCommands {
}
}
}

View File

@ -42,7 +42,6 @@ import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.function.GroundFunction;
import com.sk89q.worldedit.function.generator.FloraGenerator;
import com.sk89q.worldedit.function.generator.ForestGenerator;
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.NoiseFilter2D;
@ -136,7 +135,7 @@ public class RegionCommands extends MethodCommands {
FawePlayer fp = FawePlayer.wrap(player);
final Location loc = player.getLocation();
FaweQueue queue = fp.getFaweQueue(false);
fp.sendMessage(BBC.getPrefix() + "Light: " + queue.getEmmittedLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()) + " | " + queue.getSkyLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
fp.sendMessage("Light: " + queue.getEmmittedLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()) + " | " + queue.getSkyLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
}
@Command(
@ -220,14 +219,14 @@ public class RegionCommands extends MethodCommands {
}
@Command(
aliases = {"/line"},
aliases = { "/line" },
usage = "<pattern> [thickness]",
desc = "Draws a line segment between cuboid selection corners",
help =
"Draws a line segment between cuboid selection corners.\n" +
"Can only be used with cuboid selections.\n" +
"Flags:\n" +
" -h generates only a shell",
"Draws a line segment between cuboid selection corners.\n" +
"Can only be used with cuboid selections.\n" +
"Flags:\n" +
" -h generates only a shell",
flags = "h",
min = 1,
max = 2
@ -241,7 +240,7 @@ public class RegionCommands extends MethodCommands {
@Switch('h') boolean shell) throws WorldEditException {
if (!(region instanceof CuboidRegion)) {
player.printError(BBC.getPrefix() + "//line only works with cuboid selections");
player.printError("//line only works with cuboid selections");
return;
}
@ -258,10 +257,10 @@ public class RegionCommands extends MethodCommands {
usage = "<pattern> [thickness]",
desc = "Draws a spline through selected points",
help =
"Draws a spline through selected points.\n" +
"Can only be used with convex polyhedral selections.\n" +
"Flags:\n" +
" -h generates only a shell",
"Draws a spline through selected points.\n" +
"Can only be used with convex polyhedral selections.\n" +
"Flags:\n" +
" -h generates only a shell",
flags = "h",
min = 1,
max = 2
@ -275,7 +274,7 @@ public class RegionCommands extends MethodCommands {
@Switch('h') boolean shell,
CommandContext context) throws WorldEditException {
if (!(region instanceof ConvexPolyhedralRegion)) {
player.sendMessage(BBC.getPrefix() + "//curve only works with convex polyhedral selections");
player.sendMessage("//curve only works with convex polyhedral selections");
return;
}
worldEdit.checkMaxRadius(thickness);
@ -293,10 +292,10 @@ public class RegionCommands extends MethodCommands {
@Command(
aliases = { "/replace", "/re", "/rep" },
usage = "[from-mask] <to-pattern>",
desc = "Replace all blocks in the selection with another",
flags = "f",
min = 1,
max = 2
desc = "Replace all blocks in the selection with another",
flags = "f",
min = 1,
max = 2
)
@CommandPermissions("worldedit.region.replace")
@Logging(REGION)
@ -316,7 +315,7 @@ public class RegionCommands extends MethodCommands {
}
@Command(
aliases = {"/set", "/s"},
aliases = { "/set", "/s" },
usage = "[pattern]",
desc = "Set all blocks within selection",
min = 1,
@ -336,11 +335,11 @@ public class RegionCommands extends MethodCommands {
}
@Command(
aliases = {"/overlay"},
usage = "<pattern>",
desc = "Set a block on top of blocks in the region",
min = 1,
max = 1
aliases = { "/overlay" },
usage = "<pattern>",
desc = "Set a block on top of blocks in the region",
min = 1,
max = 1
)
@CommandPermissions("worldedit.region.overlay")
@Logging(REGION)
@ -386,11 +385,11 @@ public class RegionCommands extends MethodCommands {
}
@Command(
aliases = {"/center", "/middle"},
usage = "<pattern>",
desc = "Set the center block(s)",
min = 1,
max = 1
aliases = { "/center", "/middle" },
usage = "<pattern>",
desc = "Set the center block(s)",
min = 1,
max = 1
)
@Logging(REGION)
@CommandPermissions("worldedit.region.center")
@ -400,11 +399,11 @@ public class RegionCommands extends MethodCommands {
}
@Command(
aliases = {"/naturalize"},
usage = "",
desc = "3 layers of dirt on top then rock below",
min = 0,
max = 0
aliases = { "/naturalize" },
usage = "",
desc = "3 layers of dirt on top then rock below",
min = 0,
max = 0
)
@CommandPermissions("worldedit.region.naturalize")
@Logging(REGION)
@ -416,11 +415,11 @@ public class RegionCommands extends MethodCommands {
}
@Command(
aliases = {"/walls"},
usage = "<pattern>",
desc = "Build the four sides of the selection",
min = 1,
max = 1
aliases = { "/walls" },
usage = "<pattern>",
desc = "Build the four sides of the selection",
min = 1,
max = 1
)
@CommandPermissions("worldedit.region.walls")
@Logging(REGION)
@ -432,11 +431,11 @@ public class RegionCommands extends MethodCommands {
}
@Command(
aliases = {"/faces", "/outline"},
usage = "<pattern>",
desc = "Build the walls, ceiling, and floor of a selection",
min = 1,
max = 1
aliases = { "/faces", "/outline" },
usage = "<pattern>",
desc = "Build the walls, ceiling, and floor of a selection",
min = 1,
max = 1
)
@CommandPermissions("worldedit.region.faces")
@Logging(REGION)
@ -458,7 +457,7 @@ public class RegionCommands extends MethodCommands {
min = 0,
max = 2
)
@CommandPermissions("worldedit.region.smoothsnow")
@CommandPermissions("worldedit.region.smooth")
@Logging(REGION)
public void smooth(FawePlayer player, EditSession editSession, @Selection Region region, @Optional("1") int iterations, @Optional Mask mask, @Switch('s') boolean snow, CommandContext context) throws WorldEditException {
BlockVector3 min = region.getMinimumPoint();
@ -514,16 +513,16 @@ public class RegionCommands extends MethodCommands {
@Command(
aliases = {"/move"},
aliases = { "/move" },
usage = "[count] [direction] [leave-id]",
flags = "sbea",
flags = "saeb",
desc = "Move the contents of the selection",
help =
"Moves the contents of the selection.\n" +
"The -s flag shifts the selection to the target location.\n" +
" -b also copies biomes\n" +
" -e ignores entities\n" +
" -a ignores air\n" +
"The -b also copies biomes\n" +
"The -e ignores entities\n" +
"The -a ignores air blocks.\n" +
"Optionally fills the old location with <leave-id>.",
min = 0,
max = 3
@ -550,7 +549,7 @@ public class RegionCommands extends MethodCommands {
session.getRegionSelector(player.getWorld()).learnChanges();
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player.getPlayer(), session);
} catch (RegionOperationException e) {
player.sendMessage(BBC.getPrefix() + e.getMessage());
player.sendMessage(e.getMessage());
}
}
@ -559,7 +558,7 @@ public class RegionCommands extends MethodCommands {
}
@Command(
aliases = {"/fall"},
aliases = { "/fall" },
usage = "[replace]",
flags = "m",
desc = "Have the blocks in the selection fall",
@ -583,21 +582,21 @@ public class RegionCommands extends MethodCommands {
}
@Command(
aliases = {"/stack"},
usage = "[count] [direction]",
flags = "sam",
desc = "Repeat the contents of the selection",
help =
"Repeats the contents of the selection.\n" +
"Flags:\n" +
" -s shifts the selection to the last stacked copy\n" +
" -a skips air blocks",
min = 0,
max = 2
aliases = { "/stack" },
usage = "[count] [direction]",
flags = "sam",
desc = "Repeat the contents of the selection",
help =
"Repeats the contents of the selection.\n" +
"Flags:\n" +
" -s shifts the selection to the last stacked copy\n" +
" -a skips air blocks",
min = 0,
max = 2
)
@CommandPermissions("worldedit.region.stack")
@Logging(ORIENTATION_REGION)
public void stack(FawePlayer player, LocalSession session, EditSession editSession,
public void stack(FawePlayer player, EditSession editSession, LocalSession session,
@Selection Region region,
@Optional("1") @Range(min = 1) int count,
@Optional(Direction.AIM) @Direction(includeDiagonals = true) BlockVector3 direction,
@ -620,7 +619,7 @@ public class RegionCommands extends MethodCommands {
session.getRegionSelector(player.getWorld()).learnChanges();
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player.getPlayer(), session);
} catch (RegionOperationException e) {
player.sendMessage(BBC.getPrefix() + e.getMessage());
player.sendMessage(e.getMessage());
}
}
@ -629,14 +628,14 @@ public class RegionCommands extends MethodCommands {
}
@Command(
aliases = {"/deform"},
aliases = { "/deform" },
usage = "<expression>",
desc = "Deforms a selected region with an expression",
help =
"Deforms a selected region with an expression\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 fetch. See also tinyurl.com/wesyntax.",
"Deforms a selected region with an expression\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 fetch. See also tinyurl.com/wesyntax.",
flags = "ro",
min = 1,
max = -1
@ -651,6 +650,7 @@ public class RegionCommands extends MethodCommands {
CommandContext context) throws WorldEditException {
final Vector3 zero;
Vector3 unit;
if (useRawCoords) {
zero = Vector3.ZERO;
unit = Vector3.ONE;
@ -676,13 +676,13 @@ public class RegionCommands extends MethodCommands {
player.findFreePosition();
BBC.VISITOR_BLOCK.send(fp, affected);
} catch (ExpressionException e) {
fp.sendMessage(BBC.getPrefix() + e.getMessage());
fp.sendMessage(e.getMessage());
}
}, getArguments(context), region, context);
}
@Command(
aliases = {"/regen"},
aliases = { "/regen" },
usage = "[biome] [seed]",
desc = "Regenerates the contents of the selection",
help =
@ -727,15 +727,15 @@ public class RegionCommands extends MethodCommands {
}
@Command(
aliases = {"/hollow"},
usage = "[<thickness>[ <pattern>]]",
desc = "Hollows out the object contained in this selection",
help =
"Hollows out the object contained in this selection.\n" +
"Optionally fills the hollowed out part with the given block.\n" +
"Thickness is measured in manhattan distance.",
min = 0,
max = 2
aliases = { "/hollow" },
usage = "[<thickness>[ <pattern>]]",
desc = "Hollows out the object contained in this selection",
help =
"Hollows out the object contained in this selection.\n" +
"Optionally fills the hollowed out part with the given block.\n" +
"Thickness is measured in manhattan distance.",
min = 0,
max = 2
)
@CommandPermissions("worldedit.region.hollow")
@Logging(REGION)
@ -751,7 +751,7 @@ public class RegionCommands extends MethodCommands {
}
@Command(
aliases = {"/forest"},
aliases = { "/forest" },
usage = "[type] [density]",
desc = "Make a forest within the region",
min = 0,
@ -766,7 +766,7 @@ public class RegionCommands extends MethodCommands {
}
@Command(
aliases = {"/flora"},
aliases = { "/flora" },
usage = "[density]",
desc = "Make flora within the region",
min = 0,
@ -786,5 +786,4 @@ public class RegionCommands extends MethodCommands {
}, getArguments(context), region, context);
}
}

View File

@ -183,7 +183,7 @@ public class SchematicCommands extends MethodCommands {
for (Clipboard clip : session.getClipboard().getClipboards()) {
remapper.apply(clip);
}
player.print(BBC.getPrefix() + "Remapped schematic");
player.print("Remapped schematic");
}
@Command(
@ -227,7 +227,7 @@ public class SchematicCommands extends MethodCommands {
}
f = player.openFileOpenDialog(extensions);
if (f == null || !f.exists()) {
player.printError(BBC.getPrefix() + "Schematic " + filename + " does not exist! (" + f + ")");
player.printError("Schematic " + filename + " does not exist! (" + f + ")");
return;
}
} else {
@ -248,7 +248,7 @@ public class SchematicCommands extends MethodCommands {
}
}
if (f == null || !f.exists() || !MainUtil.isInSubDirectory(working, f)) {
player.printError(BBC.getPrefix() + "Schematic " + filename + " does not exist! (" + ((f != null) && f.exists()) + "|" + f + "|" + (f != null && !MainUtil.isInSubDirectory(working, f)) + ")");
player.printError("Schematic " + filename + " does not exist! (" + ((f != null) && f.exists()) + "|" + f + "|" + (f != null && !MainUtil.isInSubDirectory(working, f)) + ")");
return;
}
if (format == null) {
@ -264,9 +264,9 @@ public class SchematicCommands extends MethodCommands {
format.hold(player, uri, in);
BBC.SCHEMATIC_LOADED.send(player, filename);
} catch (IllegalArgumentException e) {
player.printError(BBC.getPrefix() + "Unknown filename: " + filename);
player.printError("Unknown filename: " + filename);
} catch (URISyntaxException | IOException e) {
player.printError(BBC.getPrefix() + "File could not be read or it does not exist: " + e.getMessage());
player.printError("File could not be read or it does not exist: " + e.getMessage());
log.warn("Failed to load a saved clipboard", e);
} finally {
if (in != null) {
@ -290,7 +290,7 @@ public class SchematicCommands extends MethodCommands {
LocalConfiguration config = worldEdit.getConfiguration();
ClipboardFormat format = ClipboardFormats.findByAlias(formatName);
if (format == null) {
player.printError(BBC.getPrefix() + "Unknown schematic format: " + formatName);
player.printError("Unknown schematic format: " + formatName);
return;
}
File working = worldEdit.getWorkingDirectoryFile(config.saveDir);
@ -322,7 +322,7 @@ public class SchematicCommands extends MethodCommands {
Files.createDirectories(parent.toPath());
} catch (IOException e) {
e.printStackTrace();
log.info(BBC.getPrefix() + "Could not create folder for schematics!");
log.info("Could not create folder for schematics!");
return;
}
}
@ -367,11 +367,11 @@ public class SchematicCommands extends MethodCommands {
}
} catch (IllegalArgumentException e) {
e.printStackTrace();
player.printError(BBC.getPrefix() + "Unknown filename: " + filename);
player.printError("Unknown filename: " + filename);
} catch (IOException e) {
e.printStackTrace();
player.printError(BBC.getPrefix() + "Schematic could not written: " + e.getMessage());
log.warn(BBC.getPrefix() + "Failed to write a saved clipboard", e);
player.printError("Schematic could not written: " + e.getMessage());
log.warn("Failed to write a saved clipboard", e);
}
}
@ -390,7 +390,7 @@ public class SchematicCommands extends MethodCommands {
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, player.getUniqueId().toString()) : working;
File destDir = new File(dir, directory);
if (!MainUtil.isInSubDirectory(working, destDir)) {
player.printError(BBC.getPrefix() + "Directory " + destDir + " does not exist!");
player.printError("Directory " + destDir + " does not exist!");
return;
}
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !player.hasPermission("worldedit.schematic.move.other")) {
@ -404,7 +404,7 @@ public class SchematicCommands extends MethodCommands {
return;
}
if (!destDir.exists() && !destDir.mkdirs()) {
player.printError(BBC.getPrefix() + "Creation of " + destDir + " failed! (check file permissions)");
player.printError("Creation of " + destDir + " failed! (check file permissions)");
return;
}
for (File source : sources) {
@ -457,7 +457,7 @@ public class SchematicCommands extends MethodCommands {
}
for (File f : files) {
if (!MainUtil.isInSubDirectory(working, f) || !f.exists()) {
player.printError(BBC.getPrefix() + "Schematic " + filename + " does not exist! (" + f.exists() + "|" + f + "|" + (!MainUtil.isInSubDirectory(working, f)) + ")");
player.printError("Schematic " + filename + " does not exist! (" + f.exists() + "|" + f + "|" + (!MainUtil.isInSubDirectory(working, f)) + ")");
continue;
}
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, f) && !player.hasPermission("worldedit.schematic.delete.other")) {
@ -465,7 +465,7 @@ public class SchematicCommands extends MethodCommands {
continue;
}
if (!delete(f)) {
player.printError(BBC.getPrefix() + "Deletion of " + filename + " failed! Maybe it is read-only.");
player.printError("Deletion of " + filename + " failed! Maybe it is read-only.");
continue;
}
BBC.FILE_DELETED.send(player, filename);

View File

@ -87,7 +87,7 @@ public class ScriptingCommands {
String ext = filename.substring(index + 1, filename.length());
if (!ext.equalsIgnoreCase("js")) {
actor.printError(BBC.getPrefix() + "Only .js scripts are currently supported");
actor.printError("Only .js scripts are currently supported");
return null;
}
@ -100,7 +100,7 @@ public class ScriptingCommands {
file = WorldEdit.class.getResourceAsStream("craftscripts/" + filename);
if (file == null) {
actor.printError(BBC.getPrefix() + "Script does not exist: " + filename);
actor.printError("Script does not exist: " + filename);
return null;
}
} else {
@ -113,7 +113,7 @@ public class ScriptingCommands {
in.close();
script = new String(data, 0, data.length, "utf-8");
} catch (IOException e) {
actor.printError(BBC.getPrefix() + "Script read error: " + e.getMessage());
actor.printError("Script read error: " + e.getMessage());
return null;
}
@ -154,14 +154,14 @@ public class ScriptingCommands {
result = engine.evaluate(script, filename, vars);
} catch (ScriptException e) {
e.printStackTrace();
actor.printError(BBC.getPrefix() + "Failed to execute:");
actor.printError("Failed to execute:");
actor.printRaw(e.getMessage());
} catch (NumberFormatException e) {
throw e;
} catch (WorldEditException e) {
throw e;
} catch (Throwable e) {
actor.printError(BBC.getPrefix() + "Failed to execute (see console):");
actor.printError("Failed to execute (see console):");
actor.printRaw(e.getClass().getCanonicalName());
e.printStackTrace();
}
@ -203,7 +203,7 @@ public class ScriptingCommands {
@CommandPermissions("worldedit.scripting.execute")
@Logging(ALL)
public void executeLast(Player player, LocalSession session, CommandContext args) throws WorldEditException {
String lastScript = session.getLastScript();
if (!player.hasPermission("worldedit.scripting.execute." + lastScript)) {

View File

@ -81,7 +81,7 @@ public class SnapshotCommands {
BBC.SNAPSHOT_LIST_HEADER.send(player, player.getWorld().getName());
for (byte i = 0; i < Math.min(num, snapshots.size()); i++) {
player.print(BBC.getPrefix() + (i + 1) + ". " + snapshots.get(i).getName());
player.print((i + 1) + ". " + snapshots.get(i).getName());
}
BBC.SNAPSHOT_LIST_FOOTER.send(player);
@ -92,10 +92,9 @@ public class SnapshotCommands {
File dir = config.snapshotRepo.getDirectory();
try {
WorldEdit.logger.info(BBC.getPrefix() + "WorldEdit found no snapshots: looked in: "
+ dir.getCanonicalPath());
WorldEdit.logger.info("WorldEdit found no snapshots: looked in: " + dir.getCanonicalPath());
} catch (IOException e) {
WorldEdit.logger.info(BBC.getPrefix() + "WorldEdit found no snapshots: looked in "
WorldEdit.logger.info("WorldEdit found no snapshots: looked in "
+ "(NON-RESOLVABLE PATH - does it exist?): "
+ dir.getPath());
}
@ -168,7 +167,7 @@ public class SnapshotCommands {
try {
index = Integer.parseInt(args.getString(0));
} catch (NumberFormatException e) {
player.printError(BBC.getPrefix() + "Invalid index, " + args.getString(0) + " is not a valid integer.");
player.printError("Invalid index, " + args.getString(0) + " is not a valid integer.");
return;
}
@ -180,7 +179,7 @@ public class SnapshotCommands {
try {
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, player.getWorld().getName());
if (snapshots.size() < index) {
player.printError(BBC.getPrefix() + "Invalid index, must be between 1 and " + snapshots.size() + ".");
player.printError("Invalid index, must be between 1 and " + snapshots.size() + ".");
return;
}
Snapshot snapshot = snapshots.get(index - 1);
@ -222,7 +221,7 @@ public class SnapshotCommands {
if (snapshot == null) {
dateFormat.setTimeZone(session.getTimeZone());
player.printError(BBC.getPrefix() + "Couldn't find a snapshot before "
player.printError("Couldn't find a snapshot before "
+ dateFormat.format(date.getTime()) + ".");
} else {
session.setSnapshot(snapshot);
@ -260,7 +259,7 @@ public class SnapshotCommands {
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, player.getWorld().getName());
if (snapshot == null) {
dateFormat.setTimeZone(session.getTimeZone());
player.printError(BBC.getPrefix() + "Couldn't find a snapshot after "
player.printError("Couldn't find a snapshot after "
+ dateFormat.format(date.getTime()) + ".");
} else {
session.setSnapshot(snapshot);

View File

@ -56,7 +56,7 @@ public class ToolUtilCommands {
String newState = args.getString(0, null);
if (session.hasSuperPickAxe()) {
if ("on".equals(newState)) {
player.printError(BBC.getPrefix() + "Super pick axe already enabled.");
player.printError("Super pick axe already enabled.");
return;
}
@ -64,7 +64,7 @@ public class ToolUtilCommands {
player.print("Super pick axe disabled.");
} else {
if ("off".equals(newState)) {
player.printError(BBC.getPrefix() + "Super pick axe already disabled.");
player.printError("Super pick axe already disabled.");
return;
}
session.enableSuperPickAxe();

View File

@ -102,6 +102,7 @@ import java.util.function.Consumer;
*/
@Command(aliases = {}, desc = "Various utility commands: [More Info](http://wiki.sk89q.com/wiki/WorldEdit/Utilities)")
public class UtilityCommands extends MethodCommands {
private final WorldEdit we;
public UtilityCommands(WorldEdit we) {
@ -173,7 +174,7 @@ public class UtilityCommands extends MethodCommands {
}
}.send(player);
} else {
UtilityCommands.help(args, worldEdit, player, getCommand().aliases()[0] + " ", parser.getDispatcher());
UtilityCommands.help(args, player, getCommand().aliases()[0] + " ", parser.getDispatcher());
}
}
}
@ -248,163 +249,175 @@ public class UtilityCommands extends MethodCommands {
}
@Command(
aliases = {"/fill"},
usage = "<pattern> <radius> [depth] [direction]",
desc = "Fill a hole",
min = 2,
max = 4
aliases = { "/fill" },
usage = "<pattern> <radius> [depth] [direction]",
desc = "Fill a hole",
min = 2,
max = 4
)
@CommandPermissions("worldedit.fill")
@Logging(PLACEMENT)
public void fill(Player player, LocalSession session, EditSession editSession, Pattern pattern, double radius, @Optional("1") double depth, @Optional("down") @Direction BlockVector3 direction) throws WorldEditException {
worldEdit.checkMaxRadius(radius);
we.checkMaxRadius(radius);
BlockVector3 pos = session.getPlacementPosition(player);
int affected;
affected = editSession.fillDirection(pos, pattern, radius, (int) depth, direction);
player.print(BBC.getPrefix() + affected + " block(s) have been created.");
int affected = editSession.fillDirection(pos, pattern, radius, (int) depth, direction);
player.print(affected + " block(s) have been created.");
}
@Command(
aliases = {"/fillr"},
usage = "<pattern> <radius> [depth]",
desc = "Fill a hole recursively",
min = 2,
max = 3
aliases = { "/fillr" },
usage = "<pattern> <radius> [depth]",
desc = "Fill a hole recursively",
min = 2,
max = 3
)
@CommandPermissions("worldedit.fill.recursive")
@Logging(PLACEMENT)
public void fillr(Player player, LocalSession session, EditSession editSession, Pattern pattern, double radius, @Optional("-1") double depth) throws WorldEditException {
worldEdit.checkMaxRadius(radius);
we.checkMaxRadius(radius);
BlockVector3 pos = session.getPlacementPosition(player);
if (depth == -1) depth = Integer.MAX_VALUE;
int affected = editSession.fillXZ(pos, pattern, radius, (int) depth, true);
player.print(BBC.getPrefix() + affected + " block(s) have been created.");
player.print(affected + " block(s) have been created.");
}
@Command(
aliases = {"/drain"},
usage = "<radius>",
desc = "Drain a pool",
min = 1,
max = 1
aliases = { "/drain" },
usage = "<radius>",
flags = "w",
desc = "Drain a pool",
help = "Removes all connected water sources.\n" +
" If -w is specified, also makes waterlogged blocks non-waterlogged.",
min = 1,
max = 1
)
@CommandPermissions("worldedit.drain")
@Logging(PLACEMENT)
public void drain(Player player, LocalSession session, EditSession editSession, double radius) throws WorldEditException {
worldEdit.checkMaxRadius(radius);
public void drain(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
double radius = Math.max(0, args.getDouble(0));
boolean waterlogged = args.hasFlag('w');
we.checkMaxRadius(radius);
int affected = editSession.drainArea(
session.getPlacementPosition(player), radius);
player.print(BBC.getPrefix() + affected + " block(s) have been changed.");
session.getPlacementPosition(player), radius, waterlogged);
player.print(affected + " block(s) have been changed.");
}
@Command(
aliases = {"/fixlava", "fixlava"},
usage = "<radius>",
desc = "Fix lava to be stationary",
min = 1,
max = 1
aliases = { "/fixlava", "fixlava" },
usage = "<radius>",
desc = "Fix lava to be stationary",
min = 1,
max = 1
)
@CommandPermissions("worldedit.fixlava")
@Logging(PLACEMENT)
public void fixLava(Player player, LocalSession session, EditSession editSession, @Range(min = 0) double radius) throws WorldEditException {
worldEdit.checkMaxRadius(radius);
int affected = editSession.fixLiquid(
session.getPlacementPosition(player), radius, BlockTypes.LAVA);
player.print(BBC.getPrefix() + affected + " block(s) have been changed.");
public void fixLava(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
double radius = Math.max(0, args.getDouble(0));
we.checkMaxRadius(radius);
int affected = editSession.fixLiquid(session.getPlacementPosition(player), radius, BlockTypes.LAVA);
player.print(affected + " block(s) have been changed.");
}
@Command(
aliases = {"/fixwater", "fixwater"},
usage = "<radius>",
desc = "Fix water to be stationary",
min = 1,
max = 1
aliases = { "/fixwater", "fixwater" },
usage = "<radius>",
desc = "Fix water to be stationary",
min = 1,
max = 1
)
@CommandPermissions("worldedit.fixwater")
@Logging(PLACEMENT)
public void fixWater(Player player, LocalSession session, EditSession editSession, @Range(min = 0) double radius) throws WorldEditException {
worldEdit.checkMaxRadius(radius);
int affected = editSession.fixLiquid(
session.getPlacementPosition(player), radius, BlockTypes.WATER);
public void fixWater(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
double radius = Math.max(0, args.getDouble(0));
we.checkMaxRadius(radius);
int affected = editSession.fixLiquid(session.getPlacementPosition(player), radius, BlockTypes.WATER);
BBC.VISITOR_BLOCK.send(player, affected);
}
@Command(
aliases = {"/removeabove", "removeabove"},
usage = "[size] [height]",
desc = "Remove blocks above your head.",
min = 0,
max = 2
aliases = { "/removeabove", "removeabove" },
usage = "[size] [height]",
desc = "Remove blocks above your head.",
min = 0,
max = 2
)
@CommandPermissions("worldedit.removeabove")
@Logging(PLACEMENT)
public void removeAbove(Player player, LocalSession session, EditSession editSession, @Optional("1") double size, @Optional("256") double height) throws WorldEditException {
worldEdit.checkMaxRadius(size);
we.checkMaxRadius(size);
int affected = editSession.removeAbove(session.getPlacementPosition(player), (int) size, (int) height);
BBC.VISITOR_BLOCK.send(player, affected);
}
@Command(
aliases = {"/removebelow", "removebelow"},
usage = "[size] [height]",
desc = "Remove blocks below you.",
min = 0,
max = 2
aliases = { "/removebelow", "removebelow" },
usage = "[size] [height]",
desc = "Remove blocks below you.",
min = 0,
max = 2
)
@CommandPermissions("worldedit.removebelow")
@Logging(PLACEMENT)
public void removeBelow(Player player, LocalSession session, EditSession editSession, @Optional("1") double size, @Optional("256") double height) throws WorldEditException {
worldEdit.checkMaxRadius(size);
we.checkMaxRadius(size);
int affected = editSession.removeBelow(session.getPlacementPosition(player), (int) size, (int) height);
BBC.VISITOR_BLOCK.send(player, affected);
}
@Command(
aliases = {"/removenear", "removenear"},
usage = "<mask> [size]",
desc = "Remove blocks near you.",
min = 1,
max = 2
aliases = { "/removenear", "removenear" },
usage = "<mask> [size]",
desc = "Remove blocks near you.",
min = 1,
max = 2
)
@CommandPermissions("worldedit.removenear")
@Logging(PLACEMENT)
public void removeNear(Player player, LocalSession session, EditSession editSession, Mask mask, @Optional("50") double size) throws WorldEditException {
worldEdit.checkMaxRadius(size);
we.checkMaxRadius(size);
size = Math.max(1, size);
int affected = editSession.removeNear(session.getPlacementPosition(player), mask, (int) size);
BBC.VISITOR_BLOCK.send(player, affected);
}
@Command(
aliases = {"/replacenear", "replacenear"},
usage = "<size> <from-id> <to-id>",
desc = "Replace nearby blocks",
flags = "f",
min = 3,
max = 3
aliases = { "/replacenear", "replacenear" },
usage = "<size> <from-id> <to-id>",
desc = "Replace nearby blocks",
flags = "f",
min = 3,
max = 3
)
@CommandPermissions("worldedit.replacenear")
@Logging(PLACEMENT)
public void replaceNear(Player player, LocalSession session, EditSession editSession, double size, @Optional Mask from, Pattern to) throws WorldEditException {
if (from == null) {
from = new ExistingBlockMask(editSession);
}
int affected;
BlockVector3 base = session.getPlacementPosition(player);
BlockVector3 min = base.subtract((int)size, (int)size, (int)size);
BlockVector3 max = base.add((int)size, (int)size, (int)size);
Region region = new CuboidRegion(player.getWorld(), min, max);
int affected = editSession.replaceBlocks(region, from, to);
affected = editSession.replaceBlocks(region, from, to);
BBC.VISITOR_BLOCK.send(player, affected);
}
@Command(
aliases = {"/snow", "snow"},
usage = "[radius]",
desc = "Simulates snow",
min = 0,
max = 1
aliases = { "/snow", "snow" },
usage = "[radius]",
desc = "Simulates snow",
min = 0,
max = 1
)
@CommandPermissions("worldedit.snow")
@Logging(PLACEMENT)
@ -413,15 +426,15 @@ public class UtilityCommands extends MethodCommands {
we.checkMaxRadius(size);
int affected = editSession.simulateSnow(session.getPlacementPosition(player), size);
player.print(BBC.getPrefix() + affected + " surfaces covered. Let it snow~");
player.print(affected + " surfaces covered. Let it snow~");
}
@Command(
aliases = {"/thaw", "thaw"},
usage = "[radius]",
desc = "Thaws the area",
min = 0,
max = 1
aliases = {"/thaw", "thaw"},
usage = "[radius]",
desc = "Thaws the area",
min = 0,
max = 1
)
@CommandPermissions("worldedit.thaw")
@Logging(PLACEMENT)
@ -430,17 +443,17 @@ public class UtilityCommands extends MethodCommands {
we.checkMaxRadius(size);
int affected = editSession.thaw(session.getPlacementPosition(player), size);
player.print(BBC.getPrefix() + affected + " surfaces thawed.");
player.print(affected + " surfaces thawed.");
}
@Command(
aliases = {"/green", "green"},
usage = "[radius]",
desc = "Greens the area",
help = "Converts dirt to grass blocks. -f also converts coarse dirt.",
flags = "f",
min = 0,
max = 1
aliases = { "/green", "green" },
usage = "[radius]",
desc = "Greens the area",
help = "Converts dirt to grass blocks. -f also converts coarse dirt.",
flags = "f",
min = 0,
max = 1
)
@CommandPermissions("worldedit.green")
@Logging(PLACEMENT)
@ -454,51 +467,51 @@ public class UtilityCommands extends MethodCommands {
}
@Command(
aliases = {"/ex", "/ext", "/extinguish", "ex", "ext", "extinguish"},
aliases = { "/ex", "/ext", "/extinguish", "ex", "ext", "extinguish" },
usage = "[radius]",
desc = "Extinguish nearby fire",
min = 0,
max = 1
)
)
@CommandPermissions("worldedit.extinguish")
@Logging(PLACEMENT)
public void extinguish(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
LocalConfiguration config = worldEdit.getConfiguration();
LocalConfiguration config = we.getConfiguration();
int defaultRadius = config.maxRadius != -1 ? Math.min(40, config.maxRadius) : 40;
int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0))
: defaultRadius;
worldEdit.checkMaxRadius(size);
we.checkMaxRadius(size);
int affected = editSession.removeNear(session.getPlacementPosition(player), BlockTypes.FIRE.toMask(editSession), size);
BBC.VISITOR_BLOCK.send(player, affected);
}
@Command(
aliases = {"butcher"},
usage = "[radius]",
flags = "plangbtfr",
desc = "Kill all or nearby mobs",
help =
"Kills nearby mobs, based on radius, if none is given uses default in configuration.\n" +
"Flags:\n" +
" -p also kills pets.\n" +
" -n also kills NPCs.\n" +
" -g also kills Golems.\n" +
" -a also kills animals.\n" +
" -b also kills ambient mobs.\n" +
" -t also kills mobs with name tags.\n" +
" -f compounds all previous flags.\n" +
" -r also destroys armor stands.\n" +
" -l currently does nothing.",
min = 0,
max = 1
aliases = { "butcher" },
usage = "[radius]",
flags = "plangbtfr",
desc = "Kill all or nearby mobs",
help =
"Kills nearby mobs, based on radius, if none is given uses default in configuration.\n" +
"Flags:\n" +
" -p also kills pets.\n" +
" -n also kills NPCs.\n" +
" -g also kills Golems.\n" +
" -a also kills animals.\n" +
" -b also kills ambient mobs.\n" +
" -t also kills mobs with name tags.\n" +
" -f compounds all previous flags.\n" +
" -r also destroys armor stands.\n" +
" -l currently does nothing.",
min = 0,
max = 1
)
@CommandPermissions("worldedit.butcher")
@Logging(PLACEMENT)
public void butcher(Actor actor, CommandContext args) throws WorldEditException {
LocalConfiguration config = worldEdit.getConfiguration();
LocalConfiguration config = we.getConfiguration();
Player player = actor instanceof Player ? (Player) actor : null;
// technically the default can be larger than the max, but that's not my problem
@ -562,11 +575,11 @@ public class UtilityCommands extends MethodCommands {
}
@Command(
aliases = {"remove", "rem", "rement"},
usage = "<type> <radius>",
desc = "Remove all entities of a type",
min = 2,
max = 2
aliases = { "remove", "rem", "rement" },
usage = "<type> <radius>",
desc = "Remove all entities of a type",
min = 2,
max = 2
)
@CommandPermissions("worldedit.remove")
@Logging(PLACEMENT)
@ -588,7 +601,7 @@ public class UtilityCommands extends MethodCommands {
EditSession editSession = null;
if (player != null) {
session = worldEdit.getSessionManager().get(player);
session = we.getSessionManager().get(player);
BlockVector3 center = session.getPlacementPosition(player);
editSession = session.createEditSession(player);
List<? extends Entity> entities;
@ -600,7 +613,7 @@ public class UtilityCommands extends MethodCommands {
}
visitors.add(new EntityVisitor(entities.iterator(), remover.createFunction()));
} else {
Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING);
Platform platform = we.getPlatformManager().queryCapability(Capability.WORLD_EDITING);
for (World world : platform.getWorlds()) {
List<? extends Entity> entities = world.getEntities();
visitors.add(new EntityVisitor(entities.iterator(), remover.createFunction()));
@ -622,9 +635,9 @@ public class UtilityCommands extends MethodCommands {
}
@Command(
aliases = {"/calc", "/calculate", "/eval", "/evaluate", "/solve"},
usage = "<expression>",
desc = "Evaluate a mathematical expression"
aliases = { "/calc", "/calculate", "/eval", "/evaluate", "/solve" },
usage = "<expression>",
desc = "Evaluate a mathematical expression"
)
@CommandPermissions("worldedit.calc")
public void calc(final Actor actor, @Text String input) throws CommandException {
@ -646,7 +659,7 @@ public class UtilityCommands extends MethodCommands {
}
executor.shutdownNow();
actor.print(BBC.getPrefix() + "= " + result);
actor.print("= " + result);
} catch (EvaluationException e) {
actor.printError(String.format(
"'%s' could not be evaluated (error: %s)", input, e.getMessage()));
@ -667,15 +680,16 @@ public class UtilityCommands extends MethodCommands {
}
@Command(
aliases = {"/help"},
usage = "[<command>]",
desc = "Displays help for WorldEdit commands",
min = 0,
max = -1,
queued = false
aliases = { "/help" },
usage = "[<command>]",
desc = "Displays help for WorldEdit commands",
min = 0,
max = -1,
queued = false
)
@CommandPermissions("worldedit.help")
public void help(Actor actor, CommandContext args) throws WorldEditException {
help(args, worldEdit, actor);
help(args, we, actor);
}
protected static CommandMapping detectCommand(Dispatcher dispatcher, String command, boolean isRootLevel) {
@ -720,7 +734,7 @@ public class UtilityCommands extends MethodCommands {
AtomicInteger pageInt = new AtomicInteger(page);
List<File> fileList = new ArrayList<>();
if (perPage == -1) perPage = actor instanceof Player ? 12 : 20; // More pages for console
page = getFiles(dir, actor, args, page, perPage, formatName, playerFolder, file -> fileList.add(file));
page = getFiles(dir, actor, args, page, perPage, formatName, playerFolder, fileList::add);
if (fileList.isEmpty()) {
BBC.SCHEMATIC_NONE.send(actor);
@ -843,16 +857,6 @@ public class UtilityCommands extends MethodCommands {
listMine = true;
}
FileFilter ignoreUUIDs = f -> {
try {
if (f.isDirectory()) {
UUID uuid = UUID.fromString(f.getName());
return false;
}
} catch (IllegalArgumentException ignored) {}
return true;
};
List<File> toFilter = new ArrayList<>();
if (!filters.isEmpty()) {
forEachFile = new DelegateConsumer<File>(forEachFile) {
@ -986,10 +990,10 @@ public class UtilityCommands extends MethodCommands {
}
public static void help(CommandContext args, WorldEdit we, Actor actor) {
help(args, we, actor, "/", we.getPlatformManager().getCommandManager().getDispatcher());
help(args, actor, "/", we.getPlatformManager().getCommandManager().getDispatcher());
}
public static void help(CommandContext args, WorldEdit we, Actor actor, String prefix, CommandCallable callable) {
public static void help(CommandContext args, Actor actor, String prefix, CommandCallable callable) {
final int perPage = actor instanceof Player ? 12 : 20; // More pages for console
HelpBuilder builder = new HelpBuilder(callable, args, perPage) {
@ -1007,7 +1011,6 @@ public class UtilityCommands extends MethodCommands {
public void displayCategories(Map<String, Map<CommandMapping, String>> categories) {
Message msg = new Message();
msg.prefix().text(BBC.HELP_HEADER_CATEGORIES).newline();
boolean first = true;
for (Map.Entry<String, Map<CommandMapping, String>> entry : categories.entrySet()) {
String s1 = Commands.getAlias(UtilityCommands.class, "/help") + " " + entry.getKey();
String s2 = entry.getValue().size() + "";

View File

@ -71,12 +71,12 @@ public class BlockDataCyler implements DoubleActionBlockTool {
BBC.BLOCK_CYCLER_CANNOT_CYCLE.send(player);
} else {
Property<?> currentProperty = selectedProperties.get(player.getUniqueId());
if (currentProperty == null || (forward && block.getState(currentProperty) == null)) {
currentProperty = block.getStates().keySet().stream().findFirst().get();
selectedProperties.put(player.getUniqueId(), currentProperty);
}
if (forward) {
block.getState(currentProperty);
int index = currentProperty.getValues().indexOf(block.getState(currentProperty));
@ -84,12 +84,12 @@ public class BlockDataCyler implements DoubleActionBlockTool {
@SuppressWarnings("unchecked")
Property<Object> objProp = (Property<Object>) currentProperty;
BlockState newBlock = block.with(objProp, currentProperty.getValues().get(index));
try {
EditSession editSession = session.createEditSession(player);
try {
editSession.setBlock(blockPoint, newBlock);
player.print(BBC.getPrefix() + "Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString());
player.print("Value of " + currentProperty.getName() + " is now " + currentProperty.getValues().get(index).toString());
} catch (MaxChangedBlocksException e) {
BBC.BLOCK_CYCLER_LIMIT.send(player);
} finally {
@ -102,7 +102,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
index = (index + 1) % properties.size();
currentProperty = properties.get(index);
selectedProperties.put(player.getUniqueId(), currentProperty);
player.print(BBC.getPrefix() + "Now cycling " + currentProperty.getName());
player.print("Now cycling " + currentProperty.getName());
}
}

View File

@ -80,7 +80,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
if (type != null) {
this.pattern = targetBlock;
player.print(BBC.getPrefix() + "Replacer tool switched to: " + type.getName());
player.print("Replacer tool switched to: " + type.getName());
}
return true;