com.sk89q.worldedit.EditSession Java Examples

The following examples show how to use com.sk89q.worldedit.EditSession. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FawePrimitiveBinding.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
@BindingMatch(
        type = {Extent.class},
        behavior = BindingBehavior.PROVIDES
)
public Extent getExtent(ArgumentStack context) throws ParameterException {
    Extent extent = context.getContext().getLocals().get(EditSession.class);
    if (extent != null) return extent;
    extent = Request.request().getExtent();
    if (extent != null) return extent;
    Actor actor = context.getContext().getLocals().get(Actor.class);
    if (actor == null) throw new ParameterException("No player to get a session for");
    if (!(actor instanceof Player)) throw new ParameterException("Caller is not a player");
    LocalSession session = WorldEdit.getInstance().getSessionManager().get(actor);
    EditSession editSession = session.createEditSession((Player) actor);
    editSession.enableQueue();
    context.getContext().getLocals().put(EditSession.class, editSession);
    session.tellVersion(actor);
    return editSession;
}
 
Example #2
Source File: OptionsCommands.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
@Command(
        aliases = {"/gmask", "gmask", "globalmask", "/globalmask"},
        usage = "[mask]",
        help = "The global destination mask applies to all edits you do and masks based on the destination blocks (i.e. the blocks in the world).",
        desc = "Set the global mask",
        min = 0,
        max = -1
)
@CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"})
public void gmask(Player player, LocalSession session, EditSession editSession, @Optional CommandContext context) throws WorldEditException {
    if (context == null || context.argsLength() == 0) {
        session.setMask((Mask) null);
        BBC.MASK_DISABLED.send(player);
    } else {
        ParserContext parserContext = new ParserContext();
        parserContext.setActor(player);
        parserContext.setWorld(player.getWorld());
        parserContext.setSession(session);
        parserContext.setExtent(editSession);
        Mask mask = worldEdit.getMaskFactory().parseFromInput(context.getJoinedStrings(0), parserContext);
        session.setMask(mask);
        BBC.MASK.send(player);
    }
}
 
Example #3
Source File: FaweChunkManager.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean regenerateRegion(final Location pos1, final Location pos2, boolean ignore, final Runnable whenDone) {
    TaskManager.IMP.async(new Runnable() {
        @Override
        public void run() {
            synchronized (FaweChunkManager.class) {
                EditSession editSession = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
                World world = editSession.getWorld();
                CuboidRegion region = new CuboidRegion(new Vector(pos1.getX(), pos1.getY(), pos1.getZ()), new Vector(pos2.getX(), pos2.getY(), pos2.getZ()));
                world.regenerate(region, editSession);
                editSession.flushQueue();
                TaskManager.IMP.task(whenDone);
            }
        }
    });
    return true;
}
 
Example #4
Source File: FaweChunkManager.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean copyRegion(final Location pos1, final Location pos2, final Location pos3, final Runnable whenDone) {
    TaskManager.IMP.async(new Runnable() {
        @Override
        public void run() {
            synchronized (FaweChunkManager.class) {
                EditSession from = new EditSessionBuilder(pos1.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
                EditSession to = new EditSessionBuilder(pos3.getWorld()).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
                CuboidRegion region = new CuboidRegion(new Vector(pos1.getX(), pos1.getY(), pos1.getZ()), new Vector(pos2.getX(), pos2.getY(), pos2.getZ()));
                ForwardExtentCopy copy = new ForwardExtentCopy(from, region, to, new Vector(pos3.getX(), pos3.getY(), pos3.getZ()));
                try {
                    Operations.completeLegacy(copy);
                    to.flushQueue();
                } catch (MaxChangedBlocksException e) {
                    e.printStackTrace();
                }
            }
            TaskManager.IMP.task(whenDone);
        }
    });
    return true;
}
 
Example #5
Source File: SinglePickaxe.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
    World world = (World) clicked.getExtent();
    final int blockType = world.getBlockType(clicked.toVector());
    if (blockType == BlockID.BEDROCK
            && !player.canDestroyBedrock()) {
        return true;
    }

    EditSession editSession = session.createEditSession(player);
    editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop);

    try {
        if (editSession.setBlock(clicked.getBlockX(), clicked.getBlockY(), clicked.getBlockZ(), EditSession.nullBlock)) {
            world.playEffect(clicked.toVector(), 2001, blockType);
        }
    } finally {
        editSession.flushQueue();
        session.remember(editSession);
    }

    return true;
}
 
Example #6
Source File: SimpleClipboardFloor.java    From HeavySpleef with GNU General Public License v3.0 6 votes vote down vote up
@Override
@Deprecated
public void generate(EditSession session) {
	Region region = floorClipboard.getRegion();
	World world = region.getWorld();
	WorldData data = world.getWorldData();
	
	ClipboardHolder holder = new ClipboardHolder(floorClipboard, data);
	
	Operation pasteOperation = holder.createPaste(session, data)
			.to(region.getMinimumPoint())
			.ignoreAirBlocks(true)
			.build();
	
	try {
		Operations.complete(pasteOperation);
	} catch (WorldEditException e) {
		throw new RuntimeException(e);
	}
}
 
Example #7
Source File: BrushOptionsCommands.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
@Command(
        aliases = {"mat", "material"},
        usage = "[pattern]",
        desc = "Set the brush material",
        min = 1,
        max = 1
)
@CommandPermissions("worldedit.brush.options.material")
public void material(Player player, EditSession editSession, LocalSession session, Pattern pattern, @Switch('h') boolean offHand, CommandContext context) throws WorldEditException {
    BrushTool tool = session.getBrushTool(player, false);
    if (tool == null) {
        player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f());
        return;
    }
    if (context.argsLength() == 0) {
        BBC.BRUSH_TRANSFORM_DISABLED.send(player);
        tool.setFill(null);
        return;
    }
    BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
    settings.setFill(pattern);
    settings.addSetting(BrushSettings.SettingType.FILL, context.getString(context.argsLength() - 1));
    tool.update();
    BBC.BRUSH_MATERIAL.send(player);
}
 
Example #8
Source File: Masks.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Wrap an old-style mask and convert it to a new mask.
 * <p>
 * <p>Note, however, that this is strongly not recommended because
 * {@link com.sk89q.worldedit.masks.Mask#prepare(LocalSession, LocalPlayer, Vector)}
 * is not called.</p>
 *
 * @param mask        the old-style mask
 * @param editSession the edit session to bind to
 * @return a new-style mask
 * @deprecated Please avoid if possible
 */
@Deprecated
@SuppressWarnings("deprecation")
public static Mask wrap(final com.sk89q.worldedit.masks.Mask mask, final EditSession editSession) {
    checkNotNull(mask);
    return new AbstractMask() {
        @Override
        public boolean test(Vector vector) {
            return mask.matches(editSession, vector);
        }

        @Nullable
        @Override
        public Mask2D toMask2D() {
            return null;
        }
    };
}
 
Example #9
Source File: BrushOptionsCommands.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
@Command(
        aliases = {"scroll"},
        usage = "[none|clipboard|mask|pattern|range|size|visual|target|targetoffset]",
        desc = "Toggle between different target modes",
        min = 1,
        max = -1
)
public void scroll(Player player, EditSession editSession, LocalSession session, @Optional @Switch('h') boolean offHand, CommandContext args) throws WorldEditException {
    BrushTool bt = session.getBrushTool(player, false);
    if (bt == null) {
        BBC.BRUSH_NONE.send(player);
        return;
    }
    BrushSettings settings = offHand ? bt.getOffHand() : bt.getContext();
    ScrollAction action = ScrollAction.fromArguments(bt, player, session, args.getJoinedStrings(0), true);
    settings.setScrollAction(action);
    if (args.getString(0).equalsIgnoreCase("none")) {
        BBC.BRUSH_SCROLL_ACTION_UNSET.send(player);
    } else if (action != null) {
        String full = args.getJoinedStrings(0);
        settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, full);
        BBC.BRUSH_SCROLL_ACTION_SET.send(player, full);
    }
    bt.update();
}
 
Example #10
Source File: ToolCommands.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
@Command(
        aliases = {"floodfill", "flood"},
        usage = "<pattern> <range>",
        desc = "Flood fill tool",
        min = 2,
        max = 2
)
@CommandPermissions("worldedit.tool.flood-fill")
public void floodFill(Player player, EditSession editSession, LocalSession session, Pattern pattern, double range) throws WorldEditException {
    LocalConfiguration config = we.getConfiguration();
    if (range > config.maxSuperPickaxeSize) {
        BBC.TOOL_RANGE_ERROR.send(player, config.maxSuperPickaxeSize);
        return;
    }
    session.setTool(new FloodFillTool((int) range, pattern), player);
    BBC.TOOL_FLOOD_FILL.send(player, ItemType.toHeldName(player.getItemInHand()));
}
 
Example #11
Source File: WorldEditClear.java    From uSkyBlock with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected boolean execute() {
    while (!regions.isEmpty()) {
        final Region region = regions.remove(0);
        final EditSession editSession = WorldEditHandler.createEditSession(
                new BukkitWorld(world), region.getArea() * 255);
        editSession.setReorderMode(EditSession.ReorderMode.MULTI_STAGE);
        editSession.setFastMode(true);
        try {
            editSession.setBlocks(region, BlockTypes.AIR.getDefaultState());
        } catch (MaxChangedBlocksException e) {
            log.log(Level.INFO, "Warning: we got MaxChangedBlocks from WE, please increase it!");
        }
        editSession.flushSession();
        if (!tick()) {
            break;
        }
    }
    return regions.isEmpty();
}
 
Example #12
Source File: LineBrush.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void build(EditSession editSession, Vector position, final Pattern pattern, double size) throws MaxChangedBlocksException {
    boolean visual = (editSession.getExtent() instanceof VisualExtent);
    if (pos1 == null) {
        if (!visual) {
            pos1 = position;
            BBC.BRUSH_LINE_PRIMARY.send(editSession.getPlayer(), position);
        }
        return;
    }
    editSession.drawLine(pattern, pos1, position, size, !shell, flat);
    if (!visual) {
        BBC.BRUSH_LINE_SECONDARY.send(editSession.getPlayer());
        if (!select) {
            pos1 = null;
            return;
        } else {
            pos1 = position;
        }
    }
}
 
Example #13
Source File: OptionsCommands.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
@Command(
        aliases = {"/gsmask", "gsmask", "globalsourcemask", "/globalsourcemask"},
        usage = "[mask]",
        desc = "Set the global source mask",
        help = "The global source mask applies to all edits you do and masks based on the source blocks (e.g. the blocks in your clipboard)",
        min = 0,
        max = -1
)
@CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"})
public void gsmask(Player player, LocalSession session, EditSession editSession, @Optional CommandContext context) throws WorldEditException {
    if (context == null || context.argsLength() == 0) {
        session.setSourceMask((Mask) null);
        BBC.SOURCE_MASK_DISABLED.send(player);
    } else {
        ParserContext parserContext = new ParserContext();
        parserContext.setActor(player);
        parserContext.setWorld(player.getWorld());
        parserContext.setSession(session);
        parserContext.setExtent(editSession);
        Mask mask = worldEdit.getMaskFactory().parseFromInput(context.getJoinedStrings(0), parserContext);
        session.setSourceMask(mask);
        BBC.SOURCE_MASK.send(player);
    }
}
 
Example #14
Source File: SchematicHandler13.java    From UhcCore with GNU General Public License v3.0 5 votes vote down vote up
public static ArrayList<Integer> pasteSchematic(Location loc, String path) throws Exception{
	Bukkit.getLogger().info("[UhcCore] Pasting "+path);
	File schematic = new File(path);
       World world = BukkitAdapter.adapt(loc.getWorld());

       ClipboardFormat format = ClipboardFormats.findByFile(schematic);
       ClipboardReader reader = format.getReader(new FileInputStream(schematic));
       Clipboard clipboard = reader.read();

       EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1);

       enableWatchdog(editSession);

       Operation operation = new ClipboardHolder(clipboard)
               .createPaste(editSession)
               .to(BlockVector3.at(loc.getX(), loc.getY(), loc.getZ()))
               .ignoreAirBlocks(false)
               .build();

       Operations.complete(operation);
       editSession.flushSession();

	ArrayList<Integer> dimensions = new ArrayList<>();
	dimensions.add(clipboard.getDimensions().getY());
	dimensions.add(clipboard.getDimensions().getX());
	dimensions.add(clipboard.getDimensions().getZ());
	
	Bukkit.getLogger().info("[UhcCore] Successfully pasted '"+path+"' at "+loc.getBlockX()+" "+loc.getBlockY()+" "+loc.getBlockZ());
	return dimensions;
}
 
Example #15
Source File: WorldEditHandler.java    From uSkyBlock with GNU General Public License v3.0 5 votes vote down vote up
public static void loadIslandSchematic(final File file, final Location origin, PlayerPerk playerPerk) {
    log.finer("Trying to load schematic " + file);
    if (file == null || !file.exists() || !file.canRead()) {
        LogUtil.log(Level.WARNING, "Unable to load schematic " + file);
    }
    boolean noAir = false;
    BlockVector3 to = BlockVector3.at(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
    EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(origin.getWorld()), -1);
    editSession.setFastMode(true);
    ProtectedRegion region = WorldGuardHandler.getIslandRegionAt(origin);
    if (region != null) {
        editSession.setMask(new RegionMask(getRegion(origin.getWorld(), region)));
    }
    try {
        ClipboardFormat clipboardFormat = ClipboardFormats.findByFile(file);
        try (InputStream in = new FileInputStream(file)) {
            Clipboard clipboard = clipboardFormat.getReader(in).read();
            Operation operation = new ClipboardHolder(clipboard)
                    .createPaste(editSession)
                    .to(to)
                    .ignoreAirBlocks(noAir)
                    .build();
            Operations.completeBlindly(operation);
        }
        editSession.flushSession();
    } catch (IOException e) {
        log.log(Level.INFO, "Unable to paste schematic " + file, e);
    }
}
 
Example #16
Source File: DiskOptimizedClipboard.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public BaseBiome getBiome(int index) {
    if (!hasBiomes()) {
        return EditSession.nullBiome;
    }
    int biomeId = mbb.get(HEADER_SIZE + (volume << 1) + index) & 0xFF;
    return FaweCache.CACHE_BIOME[biomeId];
}
 
Example #17
Source File: FaweForge.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String getWorldName(World world) {
    if (world instanceof WorldWrapper) {
        return getWorldName(((WorldWrapper) world).getParent());
    }
    else if (world instanceof EditSession) {
        return getWorldName(((EditSession) world).getWorld());
    }
    return getWorldName(((ForgeWorld) world).getWorld());
}
 
Example #18
Source File: BrushOptionsCommands.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Command(
        aliases = {"smask", "/smask", "/sourcemask", "sourcemask"},
        usage = "[mask]",
        desc = "Set the brush source mask",
        help = "Set the brush source mask",
        min = 0,
        max = -1
)
@CommandPermissions({"worldedit.brush.options.mask", "worldedit.mask.brush"})
public void smask(Player player, LocalSession session, EditSession editSession, @Optional @Switch('h') boolean offHand, CommandContext context) throws WorldEditException {
    BrushTool tool = session.getBrushTool(player, false);
    if (tool == null) {
        player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f());
        return;
    }
    if (context.argsLength() == 0) {
        BBC.BRUSH_SOURCE_MASK_DISABLED.send(player);
        tool.setSourceMask(null);
        return;
    }
    ParserContext parserContext = new ParserContext();
    parserContext.setActor(player);
    parserContext.setWorld(player.getWorld());
    parserContext.setSession(session);
    parserContext.setExtent(editSession);
    Mask mask = worldEdit.getMaskFactory().parseFromInput(context.getJoinedStrings(0), parserContext);
    BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
    settings.addSetting(BrushSettings.SettingType.SOURCE_MASK, context.getString(context.argsLength() - 1));
    settings.setSourceMask(mask);
    tool.update();
    BBC.BRUSH_SOURCE_MASK.send(player);
}
 
Example #19
Source File: WorldWrapper.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
public static World unwrap(World world) {
    if (world instanceof WorldWrapper) {
        return unwrap(((WorldWrapper) world).getParent());
    }
    if (world instanceof LocalWorldAdapter) {
        return unwrap(LocalWorldAdapter.unwrap(world));
    }
    else if (world instanceof EditSession) {
        return unwrap(((EditSession) world).getWorld());
    }
    return world;
}
 
Example #20
Source File: WorldWrapper.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean queueBlockBreakEffect(Platform server, Vector position, int blockId, double priority) {
    try {
        return setBlock(position, EditSession.nullBlock, true);
    } catch (WorldEditException e) {
        e.printStackTrace();
        return false;
    }
}
 
Example #21
Source File: GravityBrush.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void build(EditSession editSession, Vector position, Pattern pattern, double sizeDouble) throws MaxChangedBlocksException {
    Mask mask = editSession.getMask();
    if (mask == Masks.alwaysTrue() || mask == Masks.alwaysTrue2D()) {
        mask = null;
    }
    int size = (int) sizeDouble;
    int endY = position.getBlockY() + size;
    int startPerformY = Math.max(0, position.getBlockY() - size);
    int startCheckY = fullHeight ? 0 : startPerformY;
    Vector mutablePos = new Vector(0, 0, 0);
    for (int x = position.getBlockX() + size; x > position.getBlockX() - size; --x) {
        for (int z = position.getBlockZ() + size; z > position.getBlockZ() - size; --z) {
            int freeSpot = startCheckY;
            for (int y = startCheckY; y <= endY; y++) {
                BaseBlock block = editSession.getLazyBlock(x, y, z);
                if (block.getId() != 0) {
                    if (y != freeSpot) {
                        editSession.setBlock(x, y, z, EditSession.nullBlock);
                        editSession.setBlock(x, freeSpot, z, block);
                    }
                    freeSpot = y + 1;
                }
            }
        }
    }
}
 
Example #22
Source File: FlagRegen.java    From HeavySpleef with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void run() {
	EditSession session = game.newEditSession();
	FloorRegeneratorFactory regeneratorFactory = game.getFloorRegeneratorFactory();
	FloorRegenerator regenerator = regeneratorFactory.retrieveRegeneratorInstance();

	for (Floor floor : game.getFloors()) {
		regenerator.regenerate(floor, session, RegenerationCause.OTHER);
	}
	
	game.broadcast(getI18N().getString(Messages.Broadcast.FLOORS_REGENERATED));
}
 
Example #23
Source File: FaweForge.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String getWorldName(World world) {
    if (world instanceof WorldWrapper) {
        return getWorldName(((WorldWrapper) world).getParent());
    }
    else if (world instanceof EditSession) {
        return getWorldName(((EditSession) world).getWorld());
    }
    return getWorldName(((ForgeWorld) world).getWorld());
}
 
Example #24
Source File: WorldWrapper.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean generateTallRedwoodTree(final EditSession editSession, final Vector pt) throws MaxChangedBlocksException {
    return TaskManager.IMP.sync(new RunnableVal<Boolean>() {
        @Override
        public void run(Boolean ignore) {
            try {
                this.value = parent.generateTallRedwoodTree(editSession, pt);
            } catch (MaxChangedBlocksException e) {
                MainUtil.handleError(e);
            }
        }
    });
}
 
Example #25
Source File: MemoryOptimizedClipboard.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public BaseBiome getBiome(int index) {
    if (!hasBiomes()) {
        return EditSession.nullBiome;
    }
    return FaweCache.CACHE_BIOME[biomes[index] & 0xFF];
}
 
Example #26
Source File: FaweRegionExtent.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public BaseBlock getLazyBlock(Vector position) {
    if (!contains(position)) {
        if (!limit.MAX_FAILS()) {
            WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
        }
        return EditSession.nullBlock;
    }
    return super.getLazyBlock(position);
}
 
Example #27
Source File: FaweRegionExtent.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public BaseBlock getBlock(Vector position) {
    if (!contains(position)) {
        if (!limit.MAX_FAILS()) {
            WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
        }
        return EditSession.nullBlock;
    }
    return super.getBlock(position);
}
 
Example #28
Source File: FaweRegionExtent.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public BaseBiome getBiome(Vector2D position) {
    if (!contains(position)) {
        if (!limit.MAX_FAILS()) {
            WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
        }
        return EditSession.nullBiome;
    }
    return super.getBiome(position);
}
 
Example #29
Source File: WorldWrapper.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean generateTree(final EditSession editSession, final Vector pt) throws MaxChangedBlocksException {
    return TaskManager.IMP.sync(new RunnableVal<Boolean>() {
        @Override
        public void run(Boolean ignore) {
            try {
                this.value = parent.generateTree(editSession, pt);
            } catch (MaxChangedBlocksException e) {
                MainUtil.handleError(e);
            }
        }
    });
}
 
Example #30
Source File: FaweChangeSet.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
public EditSession toEditSession(FawePlayer player, Region[] regions) {
    EditSessionBuilder builder = new EditSessionBuilder(getWorld()).player(player).autoQueue(false).fastmode(false).checkMemory(false).changeSet(this).limitUnlimited();
    if (regions != null) {
        builder.allowedRegions(regions);
    } else {
        builder.allowedRegionsEverywhere();
    }
    EditSession editSession = builder.build();
    editSession.setSize(1);
    return editSession;
}