mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Added pattern support to /replacenear, //walls, and //faces
This commit is contained in:
@ -159,8 +159,13 @@ public class RegionCommands {
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
BaseBlock block = we.getBlock(player, args.getString(0));
|
||||
int affected = editSession.makeCuboidWalls(session.getSelection(player.getWorld()), block);
|
||||
Pattern pattern = we.getBlockPattern(player, args.getString(0));
|
||||
int affected;
|
||||
if (pattern instanceof SingleBlockPattern) {
|
||||
affected = editSession.makeCuboidWalls(session.getSelection(player.getWorld()), ((SingleBlockPattern) pattern).getBlock());
|
||||
} else {
|
||||
affected = editSession.makeCuboidWalls(session.getSelection(player.getWorld()), pattern);
|
||||
}
|
||||
|
||||
player.print(affected + " block(s) have been changed.");
|
||||
}
|
||||
@ -177,9 +182,15 @@ public class RegionCommands {
|
||||
public static void faces(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
Pattern pattern = we.getBlockPattern(player, args.getString(0));
|
||||
int affected;
|
||||
if (pattern instanceof SingleBlockPattern) {
|
||||
affected = editSession.makeCuboidFaces(session.getSelection(player.getWorld()), ((SingleBlockPattern) pattern).getBlock());
|
||||
} else {
|
||||
affected = editSession.makeCuboidFaces(session.getSelection(player.getWorld()), pattern);
|
||||
}
|
||||
|
||||
BaseBlock block = we.getBlock(player, args.getString(0));
|
||||
int affected = editSession.makeCuboidFaces(session.getSelection(player.getWorld()), block);
|
||||
player.print(affected + " block(s) have been changed.");
|
||||
}
|
||||
|
||||
|
@ -238,14 +238,15 @@ public class UtilityCommands {
|
||||
throws WorldEditException {
|
||||
|
||||
int size = Math.max(1, args.getInteger(0));
|
||||
int affected;
|
||||
Set<Integer> from;
|
||||
BaseBlock to;
|
||||
Pattern to;
|
||||
if (args.argsLength() == 2) {
|
||||
from = null;
|
||||
to = we.getBlock(player, args.getString(1));
|
||||
to = we.getBlockPattern(player, args.getString(1));
|
||||
} else {
|
||||
from = we.getBlockIDs(player, args.getString(1), true);
|
||||
to = we.getBlock(player, args.getString(2));
|
||||
to = we.getBlockPattern(player, args.getString(2));
|
||||
}
|
||||
|
||||
Vector base = session.getPlacementPosition(player);
|
||||
@ -253,7 +254,11 @@ public class UtilityCommands {
|
||||
Vector max = base.add(size, size, size);
|
||||
Region region = new CuboidRegion(min, max);
|
||||
|
||||
int affected = editSession.replaceBlocks(region, from, to);
|
||||
if (to instanceof SingleBlockPattern) {
|
||||
affected = editSession.replaceBlocks(region, from, ((SingleBlockPattern) to).getBlock());
|
||||
} else {
|
||||
affected = editSession.replaceBlocks(region, from, to);
|
||||
}
|
||||
player.print(affected + " block(s) have been replaced.");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user