mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Allow expand to be used by console. (#1264)
* Allow expand to be used by console. Also fix direction converter requiring a player. * Revert exception. (cherry picked from commit b4d2db3dee01d6af4f49d6ee1ea015dbd685839c)
This commit is contained in:
@ -93,29 +93,30 @@ public class ExpandCommands {
|
||||
.action(parameters -> {
|
||||
expandVert(
|
||||
requireIV(Key.of(LocalSession.class), "localSession", parameters),
|
||||
requireIV(Key.of(Player.class), "localSession", parameters)
|
||||
requireIV(Key.of(Actor.class), "actor", parameters),
|
||||
requireIV(Key.of(World.class), "world", parameters)
|
||||
);
|
||||
return 1;
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
||||
private static void expandVert(LocalSession session, Player player) throws IncompleteRegionException {
|
||||
Region region = session.getSelection(player.getWorld());
|
||||
private static void expandVert(LocalSession session, Actor actor, World world) throws IncompleteRegionException {
|
||||
Region region = session.getSelection(world);
|
||||
try {
|
||||
int oldSize = region.getArea();
|
||||
region.expand(
|
||||
BlockVector3.at(0, (player.getWorld().getMaxY() + 1), 0),
|
||||
BlockVector3.at(0, -(player.getWorld().getMaxY() + 1), 0));
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
BlockVector3.at(0, (world.getMaxY() + 1), 0),
|
||||
BlockVector3.at(0, -(world.getMaxY() + 1), 0));
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
int newSize = region.getArea();
|
||||
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
int changeSize = newSize - oldSize;
|
||||
player.printInfo(
|
||||
actor.printInfo(
|
||||
TranslatableComponent.of("worldedit.expand.expanded.vert", TextComponent.of(changeSize))
|
||||
);
|
||||
} catch (RegionOperationException e) {
|
||||
player.printError(TextComponent.of(e.getMessage()));
|
||||
actor.printError(TextComponent.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user