/** * Checks to see if the specified radius is within bounds. * * @param radius the radius * @throws MaxRadiusException */ public void checkMaxRadius(double radius) throws MaxRadiusException { if (getConfiguration().maxRadius > 0 && radius > getConfiguration().maxRadius) { throw new MaxRadiusException(); } }
/** * Checks to see if the specified brush radius is within bounds. * * @param radius the radius * @throws MaxBrushRadiusException */ public void checkMaxBrushRadius(double radius) throws MaxBrushRadiusException { if (getConfiguration().maxBrushRadius > 0 && radius > getConfiguration().maxBrushRadius) { throw new MaxBrushRadiusException(); } }
@Override public EditSession getEditSession(World world, int maxBlocks, BlockBag blockBag, Player player) { if (WorldEdit.getInstance().getConfiguration().traceUnflushedSessions) { return new TracedEditSession(eventBus, world, maxBlocks, blockBag, new EditSessionEvent(world, player, maxBlocks, null)); } return new EditSession(eventBus, world, maxBlocks, blockBag, new EditSessionEvent(world, player, maxBlocks, null)); }
/** * Get an edit session. Every subsequent call returns a new edit session. * Usually you only need to use one edit session. * * @return an edit session */ public EditSession remember() { EditSession editSession = controller.getEditSessionFactory() .getEditSession(player.getWorld(), session.getBlockChangeLimit(), session.getBlockBag(player), player); editSession.enableStandardMode(); editSessions.add(editSession); return editSession; }
/** * Get WorldEdit. * * @return an instance */ public WorldEdit getWorldEdit() { return WorldEdit.getInstance(); }
@Override public void explainRegionAdjust(Actor player, LocalSession session) { session.describeCUI(player); }
/** * Closing an EditSession {@linkplain #flushSession() flushes its buffers}. */ @Override public void close() { flushSession(); }
@Override public BlockVector3 getPrimaryPosition() throws IncompleteRegionException { if (pos1 == null) { throw new IncompleteRegionException(); } return pos1; }
@Override public EditSession getEditSession(World world, int maxBlocks) { return getEditSession(world, maxBlocks, null, null); }
/** * Turns on specific features for a normal WorldEdit session, such as * {@link #setBatchingChunks(boolean) * chunk batching}. */ public void enableStandardMode() { setBatchingChunks(true); }
/** * Dispatch the initial setup CUI messages. * * @param actor the actor */ public void dispatchCUISetup(Actor actor) { if (selector != null) { dispatchCUISelection(actor); } }
/** * Gets the clipboard. * * @return clipboard * @throws EmptyClipboardException thrown if no clipboard is set */ public ClipboardHolder getClipboard() throws EmptyClipboardException { if (clipboard == null) { throw new EmptyClipboardException(); } return clipboard; }
/** * Get the number of changed blocks. * * @return the number of changes */ public int size() { return getBlockChangeCount(); }
/** * Makes a sphere. * * @param pos Center of the sphere or ellipsoid * @param block The block pattern to use * @param radius The sphere's radius * @param filled If false, only a shell will be generated. * @return number of blocks changed * @throws MaxChangedBlocksException thrown if too many blocks are changed */ public int makeSphere(BlockVector3 pos, Pattern block, double radius, boolean filled) throws MaxChangedBlocksException { return makeSphere(pos, block, radius, radius, radius, filled); }
@Override public LocalSession load(UUID id) throws IOException { return new LocalSession(); }
@Override public void explainRegionAdjust(Actor player, LocalSession session) { session.describeCUI(player); }
@Override public BlockVector3 getPrimaryPosition() throws IncompleteRegionException { if (position1 == null) { throw new IncompleteRegionException(); } return position1; }
@Override public EditSession getEditSession(World world, int maxBlocks, Player player) { return getEditSession(world, maxBlocks, null, player); }
@Override public CuboidRegion getRegion() throws IncompleteRegionException { if (position1 == null || position2 == null) { throw new IncompleteRegionException(); } return region; }
@Override public EditSession getEditSession(World world, int maxBlocks, BlockBag blockBag) { return getEditSession(world, maxBlocks, blockBag, null); }