Search in sources :

Example 6 with RegionOperationException

use of com.sk89q.worldedit.regions.RegionOperationException in project FastAsyncWorldEdit by IntellectualSites.

the class ExpandCommands method expandVert.

private static void expandVert(LocalSession session, Actor actor, World world) throws IncompleteRegionException {
    Region region = session.getSelection(world);
    int height = world.getMaxY() - world.getMinY();
    try {
        long oldSize = region.getVolume();
        region.expand(BlockVector3.at(0, height, 0), BlockVector3.at(0, -height, 0));
        session.getRegionSelector(world).learnChanges();
        long newSize = region.getVolume();
        session.getRegionSelector(world).explainRegionAdjust(actor, session);
        long changeSize = newSize - oldSize;
        actor.print(Caption.of("worldedit.expand.expanded.vert", TextComponent.of(changeSize)));
    } catch (RegionOperationException e) {
        actor.printError(TextComponent.of(e.getMessage()));
    }
}
Also used : RegionOperationException(com.sk89q.worldedit.regions.RegionOperationException) Region(com.sk89q.worldedit.regions.Region)

Aggregations

RegionOperationException (com.sk89q.worldedit.regions.RegionOperationException)6 CommandPermissions (com.sk89q.worldedit.command.util.CommandPermissions)4 Logging (com.sk89q.worldedit.command.util.Logging)4 Region (com.sk89q.worldedit.regions.Region)4 Command (org.enginehub.piston.annotation.Command)4 BlockVector3 (com.sk89q.worldedit.math.BlockVector3)3 MaskTraverser (com.fastasyncworldedit.core.util.MaskTraverser)2 Preload (com.sk89q.worldedit.command.util.annotation.Preload)2 ExistingBlockMask (com.sk89q.worldedit.function.mask.ExistingBlockMask)2 Mask (com.sk89q.worldedit.function.mask.Mask)2 MaskIntersection (com.sk89q.worldedit.function.mask.MaskIntersection)2 SolidBlockMask (com.sk89q.worldedit.function.mask.SolidBlockMask)2 BukkitWorld (com.sk89q.worldedit.bukkit.BukkitWorld)1 Confirm (com.sk89q.worldedit.command.util.annotation.Confirm)1 Clipboard (com.sk89q.worldedit.extent.clipboard.Clipboard)1 Operation (com.sk89q.worldedit.function.operation.Operation)1 ClipboardHolder (com.sk89q.worldedit.session.ClipboardHolder)1 World (com.sk89q.worldedit.world.World)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1