Add //line command and EditSession method

The EditSession method comes with javadoc.
This commit is contained in:
orthoplex64
2013-07-26 00:45:17 -05:00
committed by TomyLobo
parent 9930fb7338
commit 91c6c69551
2 changed files with 93 additions and 0 deletions

View File

@ -86,6 +86,32 @@ 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)
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.");
}
@Command(
aliases = { "/replace", "/re", "/rep" },
usage = "[from-block] <to-block>",