mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 03:16:41 +00:00
Line thickness support
This commit is contained in:
@ -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" },
|
||||
|
Reference in New Issue
Block a user