mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-08-28 11:24:34 +00:00
Added -s flag to //move and //stack to move the selection along with the blocks.
This commit is contained in:
parent
520d7ac764
commit
f97c765623
@ -29,6 +29,7 @@ import com.sk89q.worldedit.filtering.GaussianKernel;
|
|||||||
import com.sk89q.worldedit.filtering.HeightMapFilter;
|
import com.sk89q.worldedit.filtering.HeightMapFilter;
|
||||||
import com.sk89q.worldedit.patterns.*;
|
import com.sk89q.worldedit.patterns.*;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
import com.sk89q.worldedit.regions.RegionOperationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Region related commands.
|
* Region related commands.
|
||||||
@ -182,6 +183,7 @@ public class RegionCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
aliases = {"/move"},
|
aliases = {"/move"},
|
||||||
usage = "[count] [direction] [leave-id]",
|
usage = "[count] [direction] [leave-id]",
|
||||||
|
flags = "s",
|
||||||
desc = "Move the contents of the selection",
|
desc = "Move the contents of the selection",
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 3
|
max = 3
|
||||||
@ -205,6 +207,20 @@ public class RegionCommands {
|
|||||||
|
|
||||||
int affected = editSession.moveCuboidRegion(session.getSelection(player.getWorld()),
|
int affected = editSession.moveCuboidRegion(session.getSelection(player.getWorld()),
|
||||||
dir, count, true, replace);
|
dir, count, true, replace);
|
||||||
|
|
||||||
|
if (args.hasFlag('s')) {
|
||||||
|
try {
|
||||||
|
Region region = session.getSelection(player.getWorld());
|
||||||
|
region.expand(dir.multiply(count));
|
||||||
|
region.contract(dir.multiply(count));
|
||||||
|
|
||||||
|
session.getRegionSelector().learnChanges();
|
||||||
|
session.getRegionSelector().explainRegionAdjust(player, session);
|
||||||
|
} catch (RegionOperationException e) {
|
||||||
|
player.printError(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
player.print(affected + " blocks moved.");
|
player.print(affected + " blocks moved.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +228,7 @@ public class RegionCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
aliases = {"/stack"},
|
aliases = {"/stack"},
|
||||||
usage = "[count] [direction]",
|
usage = "[count] [direction]",
|
||||||
flags = "a",
|
flags = "sa",
|
||||||
desc = "Repeat the contents of the selection",
|
desc = "Repeat the contents of the selection",
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 2
|
max = 2
|
||||||
@ -228,6 +244,20 @@ public class RegionCommands {
|
|||||||
|
|
||||||
int affected = editSession.stackCuboidRegion(session.getSelection(player.getWorld()),
|
int affected = editSession.stackCuboidRegion(session.getSelection(player.getWorld()),
|
||||||
dir, count, !args.hasFlag('a'));
|
dir, count, !args.hasFlag('a'));
|
||||||
|
|
||||||
|
if (args.hasFlag('s')) {
|
||||||
|
try {
|
||||||
|
Region region = session.getSelection(player.getWorld());
|
||||||
|
region.expand(dir.multiply(count));
|
||||||
|
region.contract(dir.multiply(count));
|
||||||
|
|
||||||
|
session.getRegionSelector().learnChanges();
|
||||||
|
session.getRegionSelector().explainRegionAdjust(player, session);
|
||||||
|
} catch (RegionOperationException e) {
|
||||||
|
player.printError(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
player.print(affected + " blocks changed. Undo with //undo");
|
player.print(affected + " blocks changed. Undo with //undo");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user