Line thickness support

This commit is contained in:
orthoplex64
2013-08-02 23:11:11 -05:00
committed by TomyLobo
parent 91c6c69551
commit f38b6c484c
2 changed files with 70 additions and 29 deletions

View File

@ -85,32 +85,36 @@ public class RegionCommands {
player.print(affected + " block(s) have been changed.");
}
@Command(
aliases = { "/line" },
usage = "<block>",
desc = "Draw a line segment between selection corners.",
min = 1,
max = 1
)
@CommandPermissions("worldedit.region.line")
@Logging(REGION)
@Command(
aliases = { "/line" },
usage = "<block> [thickness]",
desc = "Draw a line segment between selection corners.",
min = 1,
max = 2
)
@CommandPermissions("worldedit.region.line")
@Logging(REGION)
public void line(CommandContext args, LocalSession session, LocalPlayer player,
EditSession editSession) throws WorldEditException {
Region region = session.getSelection(session.getSelectionWorld());
if (!(region instanceof CuboidRegion)) {
player.printError("Invalid region type");
return;
}
Pattern pattern = we.getBlockPattern(player, args.getString(0));
Vector pos1 = ((CuboidRegion) region).getPos1();
Vector pos2 = ((CuboidRegion) region).getPos2();
int blocksChanged = editSession.drawLine(pattern, pos1, pos2);
player.print(blocksChanged + " block(s) have been changed.");
}
player.printError("Invalid region type");
return;
}
if (args.argsLength() < 2 ? false : args.getInteger(1) < 0) {
player.printError("Invalid thickness. Must be greater than -1");
return;
}
Pattern pattern = we.getBlockPattern(player, args.getString(0));
Vector pos1 = ((CuboidRegion) region).getPos1();
Vector pos2 = ((CuboidRegion) region).getPos2();
int blocksChanged = editSession.drawLine(pattern, pos1, pos2, args.argsLength() < 2 ? 0 : args.getInteger(1));
player.print(blocksChanged + " block(s) have been changed.");
}
@Command(
aliases = { "/replace", "/re", "/rep" },