Search in sources :

Example 1 with ReadOnlyClipboard

use of com.fastasyncworldedit.core.extent.clipboard.ReadOnlyClipboard in project FastAsyncWorldEdit by IntellectualSites.

the class ClipboardCommands method lazyCopy.

// FAWE start
@Command(name = "/lazycopy", desc = "Lazily copy the selection to the clipboard")
@CommandPermissions("worldedit.clipboard.lazycopy")
public void lazyCopy(Actor actor, LocalSession session, EditSession editSession, @Selection Region region, @Switch(name = 'e', desc = "Skip copy entities") boolean skipEntities, @Switch(name = 'b', desc = "Also copy biomes") boolean copyBiomes) throws WorldEditException {
    BlockVector3 min = region.getMinimumPoint();
    BlockVector3 max = region.getMaximumPoint();
    long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
    FaweLimit limit = actor.getLimit();
    if (volume >= limit.MAX_CHECKS) {
        throw FaweCache.MAX_CHECKS;
    }
    session.setClipboard(null);
    ReadOnlyClipboard lazyClipboard = ReadOnlyClipboard.of(region, !skipEntities, copyBiomes);
    lazyClipboard.setOrigin(session.getPlacementPosition(actor));
    session.setClipboard(new ClipboardHolder(lazyClipboard));
    actor.print(Caption.of("fawe.worldedit.copy.command.copy", region.getVolume()));
}
Also used : FaweLimit(com.fastasyncworldedit.core.limit.FaweLimit) MultiClipboardHolder(com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder) URIClipboardHolder(com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder) ClipboardHolder(com.sk89q.worldedit.session.ClipboardHolder) ReadOnlyClipboard(com.fastasyncworldedit.core.extent.clipboard.ReadOnlyClipboard) BlockVector3(com.sk89q.worldedit.math.BlockVector3) Command(org.enginehub.piston.annotation.Command) CommandPermissions(com.sk89q.worldedit.command.util.CommandPermissions)

Aggregations

MultiClipboardHolder (com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder)1 ReadOnlyClipboard (com.fastasyncworldedit.core.extent.clipboard.ReadOnlyClipboard)1 URIClipboardHolder (com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder)1 FaweLimit (com.fastasyncworldedit.core.limit.FaweLimit)1 CommandPermissions (com.sk89q.worldedit.command.util.CommandPermissions)1 BlockVector3 (com.sk89q.worldedit.math.BlockVector3)1 ClipboardHolder (com.sk89q.worldedit.session.ClipboardHolder)1 Command (org.enginehub.piston.annotation.Command)1