Cleaned commands and extents a bit.

This commit is contained in:
MattBDev 2019-06-23 14:00:22 -04:00
parent cd8bc6f733
commit 753b34ef99
11 changed files with 68 additions and 153 deletions

View File

@ -10,6 +10,7 @@ import com.boydti.fawe.util.StringMan;
import com.boydti.fawe.util.chat.Message; import com.boydti.fawe.util.chat.Message;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.sk89q.worldedit.extension.platform.Actor;
import java.io.File; import java.io.File;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@ -549,6 +550,16 @@ public enum BBC {
player.sendMessage((PREFIX.isEmpty() ? "" : PREFIX.s() + " ") + this.format(args)); player.sendMessage((PREFIX.isEmpty() ? "" : PREFIX.s() + " ") + this.format(args));
} }
} }
public void send(final Actor player, final Object... args) {
if (isEmpty()) {
return;
}
if (player == null) {
Fawe.debug(this.format(args));
} else {
player.print(this.format(args));
}
}
public static char getCode(String name) { public static char getCode(String name) {
switch (name) { switch (name) {

View File

@ -1,81 +0,0 @@
package com.boydti.fawe.object.extent;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
public class EmptyExtent implements Extent {
public EmptyExtent() {
}
public BlockVector3 getMinimumPoint() {
return BlockVector3.ZERO;
}
public BlockVector3 getMaximumPoint() {
return BlockVector3.ZERO;
}
public List<Entity> getEntities(Region region) {
return Collections.emptyList();
}
public List<Entity> getEntities() {
return Collections.emptyList();
}
@Nullable
public Entity createEntity(Location location, BaseEntity entity) {
return null;
}
@Override
public BaseBlock getFullBlock(BlockVector3 position) {
return EditSession.nullBlock.toBaseBlock();
}
@Override
public BlockState getLazyBlock(BlockVector3 position) {
return EditSession.nullBlock;
}
@Nullable
public BiomeType getBiome(BlockVector2 position) {
return null;
}
@Override
public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
return false;
}
@Override
public boolean setBiome(BlockVector2 position, BiomeType biome) {
return false;
}
@Override
public boolean setBiome(int x, int y, int z, BiomeType biome) {
return false;
}
@Nullable
public Operation commit() {
return null;
}
}

View File

@ -3,11 +3,13 @@ package com.boydti.fawe.object.extent;
import com.boydti.fawe.object.FaweQueue; import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.object.HasFaweQueue; import com.boydti.fawe.object.HasFaweQueue;
import com.boydti.fawe.util.ReflectionUtils; import com.boydti.fawe.util.ReflectionUtils;
import com.sk89q.jnbt.*; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.DoubleTag;
import com.sk89q.jnbt.FloatTag;
import com.sk89q.jnbt.ListTag;
import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.AbstractDelegateExtent;
@ -17,23 +19,26 @@ import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.*; import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFaweQueue { public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFaweQueue {
private final World world; private final World world;
private FaweQueue queue; private FaweQueue queue;
private final int maxY;
public FastWorldEditExtent(final World world, FaweQueue queue) { public FastWorldEditExtent(final World world, FaweQueue queue) {
super(queue); super(queue);
this.world = world; this.world = world;
this.queue = queue; this.queue = queue;
this.maxY = world.getMaxY();
} }
public FaweQueue getQueue() { public FaweQueue getQueue() {
@ -129,8 +134,7 @@ public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFa
public BlockState getLazyBlock(int x, int y, int z) { public BlockState getLazyBlock(int x, int y, int z) {
int combinedId4Data = queue.getCombinedId4Data(x, y, z, 0); int combinedId4Data = queue.getCombinedId4Data(x, y, z, 0);
BlockType type = BlockTypes.getFromStateId(combinedId4Data); BlockType type = BlockTypes.getFromStateId(combinedId4Data);
BlockState state = type.withStateId(combinedId4Data); return type.withStateId(combinedId4Data);
return state;
} }
@Override @Override

View File

@ -2,7 +2,6 @@ package com.boydti.fawe.object.extent;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;

View File

@ -42,8 +42,7 @@ public class PositionTransformExtent extends ResettableExtent {
mutable.mutY(((pos.getY() - min.getY()))); mutable.mutY(((pos.getY() - min.getY())));
mutable.mutZ(((pos.getZ() - min.getZ()))); mutable.mutZ(((pos.getZ() - min.getZ())));
MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3())); MutableVector3 tmp = new MutableVector3(transform.apply(mutable.toVector3()));
BlockVector3 result = min.add(tmp.toBlockPoint()); return min.add(tmp.toBlockPoint());
return result;
} }
@Override @Override

View File

@ -5,7 +5,6 @@ import com.boydti.fawe.object.random.SimpleRandom;
import com.boydti.fawe.object.random.TrueRandom; import com.boydti.fawe.object.random.TrueRandom;
import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.pattern.RandomPattern;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Map; import java.util.Map;

View File

@ -16,17 +16,14 @@ public class TransformExtent extends BlockTransformExtent {
private final MutableBlockVector3 mutable = new MutableBlockVector3(); private final MutableBlockVector3 mutable = new MutableBlockVector3();
private BlockVector3 min; private BlockVector3 min;
private int maxy;
public TransformExtent(Extent parent) { public TransformExtent(Extent parent) {
super(parent); super(parent);
this.maxy = parent.getMaximumPoint().getBlockY();
} }
@Override @Override
public ResettableExtent setExtent(Extent extent) { public ResettableExtent setExtent(Extent extent) {
min = null; min = null;
maxy = extent.getMaximumPoint().getBlockY();
return super.setExtent(extent); return super.setExtent(extent);
} }

View File

@ -18,7 +18,6 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
private transient MutableBlockVector3 cur; private transient MutableBlockVector3 cur;
private transient MutableBlockVector3[] buffer; private transient MutableBlockVector3[] buffer;
private transient MutableBlockVector3[] allowed; private transient MutableBlockVector3[] allowed;
private transient MutableBlockVector3 next;
public SurfaceRandomOffsetPattern(Pattern pattern, int distance) { public SurfaceRandomOffsetPattern(Pattern pattern, int distance) {
this.pattern = pattern; this.pattern = pattern;
@ -44,6 +43,7 @@ public class SurfaceRandomOffsetPattern extends AbstractPattern {
cur.setComponents(pos); cur.setComponents(pos);
for (int move = 0; move < moves; move++) { for (int move = 0; move < moves; move++) {
int index = 0; int index = 0;
MutableBlockVector3 next;
for (int i = 0; i < allowed.length; i++) { for (int i = 0; i < allowed.length; i++) {
next = buffer[i]; next = buffer[i];
BlockVector3 dir = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i]; BlockVector3 dir = BreadthFirstSearch.DIAGONAL_DIRECTIONS[i];

View File

@ -21,7 +21,6 @@ package com.sk89q.worldedit.command;
import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.BBC;
import com.boydti.fawe.config.Commands; import com.boydti.fawe.config.Commands;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.visitor.Fast2DIterator; import com.boydti.fawe.object.visitor.Fast2DIterator;
import com.boydti.fawe.util.chat.Message; import com.boydti.fawe.util.chat.Message;
import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.Command;
@ -53,7 +52,6 @@ import com.sk89q.worldedit.util.Countable;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.util.command.binding.Switch;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeData; import com.sk89q.worldedit.world.biome.BiomeData;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.biome.BiomeTypes;
@ -62,9 +60,7 @@ import com.sk89q.worldedit.world.registry.BiomeRegistry;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION;
@ -237,7 +233,7 @@ public class BiomeCommands extends MethodCommands {
Operations.completeLegacy(visitor); Operations.completeLegacy(visitor);
BBC.BIOME_CHANGED.send(player, visitor.getAffected()); BBC.BIOME_CHANGED.send(player, visitor.getAffected());
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) if (!player.hasPermission("fawe.tips"))
BBC.TIP_BIOME_PATTERN.or(BBC.TIP_BIOME_MASK).send(player); BBC.TIP_BIOME_PATTERN.or(BBC.TIP_BIOME_MASK).send(player);
} }
} }

View File

@ -19,7 +19,6 @@
package com.sk89q.worldedit.command; package com.sk89q.worldedit.command;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI; import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.BBC;
import com.boydti.fawe.config.Settings; import com.boydti.fawe.config.Settings;
@ -36,16 +35,13 @@ import com.boydti.fawe.object.schematic.Schematic;
import com.boydti.fawe.util.ImgurUtility; import com.boydti.fawe.util.ImgurUtility;
import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MaskTraverser; import com.boydti.fawe.util.MaskTraverser;
import com.sk89q.minecraft.util.commands.*;
import com.sk89q.worldedit.*;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION;
import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.minecraft.util.commands.Logging; import com.sk89q.minecraft.util.commands.Logging;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
@ -76,6 +72,7 @@ import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.util.command.binding.Switch;
import com.sk89q.worldedit.util.command.parametric.Optional; import com.sk89q.worldedit.util.command.parametric.Optional;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
@ -88,7 +85,6 @@ import java.util.Set;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT; import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION;
@ -109,12 +105,12 @@ public class ClipboardCommands extends MethodCommands {
@Command( @Command(
aliases = {"/lazycopy"}, aliases = { "/lazycopy" },
flags = "em", flags = "em",
desc = "Lazily copy the selection to the clipboard", desc = "Lazily copy the selection to the clipboard",
help = "Lazily copy the selection to the clipboard\n" + help = "Lazily copy the selection to the clipboard\n" +
"Flags:\n" + "Flags:\n" +
" -e skips copying entities\n" + " -e will also copy entities\n" +
" -m sets a source mask so that excluded blocks become air\n" + " -m sets a source mask so that excluded blocks become air\n" +
" -b copies biomes\n" + " -b copies biomes\n" +
"WARNING: Pasting entities cannot yet be undone!", "WARNING: Pasting entities cannot yet be undone!",
@ -122,7 +118,7 @@ public class ClipboardCommands extends MethodCommands {
) )
@CommandPermissions("worldedit.clipboard.lazycopy") @CommandPermissions("worldedit.clipboard.lazycopy")
public void lazyCopy(Player player, LocalSession session, EditSession editSession, public void lazyCopy(Player player, LocalSession session, EditSession editSession,
@Selection final Region region, @Switch('e') boolean skipEntities, @Selection final Region region, @Switch('e') boolean copyEntities,
@Switch('m') Mask mask, @Switch('b') boolean copyBiomes) throws WorldEditException { @Switch('m') Mask mask, @Switch('b') boolean copyBiomes) throws WorldEditException {
BlockVector3 min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
BlockVector3 max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
@ -136,24 +132,24 @@ public class ClipboardCommands extends MethodCommands {
final int mx = origin.getBlockX(); final int mx = origin.getBlockX();
final int my = origin.getBlockY(); final int my = origin.getBlockY();
final int mz = origin.getBlockZ(); final int mz = origin.getBlockZ();
ReadOnlyClipboard lazyClipboard = ReadOnlyClipboard.of(editSession, region, !skipEntities, copyBiomes); ReadOnlyClipboard lazyClipboard = ReadOnlyClipboard.of(editSession, region, copyEntities, copyBiomes);
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, lazyClipboard); BlockArrayClipboard clipboard = new BlockArrayClipboard(region, lazyClipboard);
clipboard.setOrigin(session.getPlacementPosition(player)); clipboard.setOrigin(session.getPlacementPosition(player));
session.setClipboard(new ClipboardHolder(clipboard)); session.setClipboard(new ClipboardHolder(clipboard));
BBC.COMMAND_COPY.send(player, region.getArea()); BBC.COMMAND_COPY.send(player, region.getArea());
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) if (!player.hasPermission("fawe.tips"))
BBC.TIP_PASTE.or(BBC.TIP_LAZYCOPY, BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(player); BBC.TIP_PASTE.or(BBC.TIP_LAZYCOPY, BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(player);
} }
@Command( @Command(
aliases = {"/copy", "/c"}, aliases = { "/copy", "/c" },
flags = "em", flags = "em",
desc = "Copy the selection to the clipboard", desc = "Copy the selection to the clipboard",
help = "Copy the selection to the clipboard\n" + help = "Copy the selection to the clipboard\n" +
"Flags:\n" + "Flags:\n" +
" -e skips copying entities\n" + " -e will also copy entities\n" +
" -m sets a source mask so that excluded blocks become air\n" + " -m sets a source mask so that excluded blocks become air\n" +
" -b copies biomes\n" + " -b copies biomes\n" +
"WARNING: Pasting entities cannot yet be undone!", "WARNING: Pasting entities cannot yet be undone!",
@ -162,7 +158,7 @@ public class ClipboardCommands extends MethodCommands {
) )
@CommandPermissions("worldedit.clipboard.copy") @CommandPermissions("worldedit.clipboard.copy")
public void copy(FawePlayer fp, Player player, LocalSession session, EditSession editSession, public void copy(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
@Selection Region region, @Switch('e') boolean skipEntities, @Selection Region region, @Switch('e') boolean copyEntities,
@Switch('m') Mask mask, CommandContext context, @Switch('b') boolean copyBiomes) throws WorldEditException { @Switch('m') Mask mask, CommandContext context, @Switch('b') boolean copyBiomes) throws WorldEditException {
BlockVector3 min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
BlockVector3 max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
@ -179,7 +175,7 @@ public class ClipboardCommands extends MethodCommands {
clipboard.setOrigin(pos); clipboard.setOrigin(pos);
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint()); ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
copy.setCopyingEntities(!skipEntities); copy.setCopyingEntities(copyEntities);
copy.setCopyBiomes(copyBiomes); copy.setCopyBiomes(copyBiomes);
Mask sourceMask = editSession.getSourceMask(); Mask sourceMask = editSession.getSourceMask();
if (sourceMask != null) { if (sourceMask != null) {
@ -192,7 +188,7 @@ public class ClipboardCommands extends MethodCommands {
} }
Operations.completeLegacy(copy); Operations.completeLegacy(copy);
BBC.COMMAND_COPY.send(player, region.getArea()); BBC.COMMAND_COPY.send(player, region.getArea());
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) { if (!player.hasPermission("fawe.tips")) {
BBC.TIP_PASTE.or(BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(player); BBC.TIP_PASTE.or(BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(player);
} }
}, getArguments(context), region, context); }, getArguments(context), region, context);
@ -243,17 +239,16 @@ public class ClipboardCommands extends MethodCommands {
desc = "Cut the selection to the clipboard", desc = "Cut the selection to the clipboard",
help = "Copy the selection to the clipboard\n" + help = "Copy the selection to the clipboard\n" +
"Flags:\n" + "Flags:\n" +
" -e skips entity copy\n" + " -e will also cut entities\n" +
" -m sets a source mask so that excluded blocks become air\n" + " -m sets a source mask so that excluded blocks become air\n" +
" -b copies biomes\n" + " -b copies biomes\n" +
"WARNING: Cutting and pasting entities cannot yet be undone!", "WARNING: Cutting and pasting entities cannot yet be undone!",
min = 0,
max = 1 max = 1
) )
@CommandPermissions("worldedit.clipboard.cut") @CommandPermissions("worldedit.clipboard.cut")
@Logging(REGION) @Logging(REGION)
public void cut(FawePlayer fp, Player player, LocalSession session, EditSession editSession, public void cut(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
@Selection Region region, @Optional("air") Pattern leavePattern, @Switch('e') boolean skipEntities, @Selection Region region, @Optional("air") Pattern leavePattern, @Switch('e') boolean copyEntities,
@Switch('m') Mask mask, @Switch('b') boolean copyBiomes, CommandContext context) throws WorldEditException { @Switch('m') Mask mask, @Switch('b') boolean copyBiomes, CommandContext context) throws WorldEditException {
BlockVector3 min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
BlockVector3 max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
@ -272,7 +267,8 @@ public class ClipboardCommands extends MethodCommands {
clipboard.setOrigin(pos); clipboard.setOrigin(pos);
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint()); ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
copy.setSourceFunction(new BlockReplace(editSession, leavePattern)); copy.setSourceFunction(new BlockReplace(editSession, leavePattern));
copy.setCopyingEntities(!skipEntities); copy.setCopyingEntities(copyEntities);
copy.setRemovingEntities(true);
copy.setCopyBiomes(copyBiomes); copy.setCopyBiomes(copyBiomes);
Mask sourceMask = editSession.getSourceMask(); Mask sourceMask = editSession.getSourceMask();
if (sourceMask != null) { if (sourceMask != null) {
@ -287,12 +283,15 @@ public class ClipboardCommands extends MethodCommands {
session.setClipboard(new ClipboardHolder(clipboard)); session.setClipboard(new ClipboardHolder(clipboard));
BBC.COMMAND_CUT_SLOW.send(player, region.getArea()); BBC.COMMAND_CUT_SLOW.send(player, region.getArea());
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) BBC.TIP_LAZYCUT.send(player); if (!player.hasPermission("fawe.tips")) BBC.TIP_LAZYCUT.send(player);
}, getArguments(context), region, context); }, getArguments(context), region, context);
} }
@Command(aliases = {"download"}, desc = "Downloads your clipboard through the configured web interface") @Command(
aliases = {"download"},
desc = "Downloads your clipboard through the configured web interface"
)
@Deprecated @Deprecated
@CommandPermissions({"worldedit.clipboard.download"}) @CommandPermissions({"worldedit.clipboard.download"})
public void download(final Player player, final LocalSession session, @Optional("schem") final String formatName) throws CommandException, WorldEditException { public void download(final Player player, final LocalSession session, @Optional("schem") final String formatName) throws CommandException, WorldEditException {
@ -453,7 +452,8 @@ public class ClipboardCommands extends MethodCommands {
@CommandPermissions("worldedit.clipboard.paste") @CommandPermissions("worldedit.clipboard.paste")
@Logging(PLACEMENT) @Logging(PLACEMENT)
public void paste(Player player, LocalSession session, EditSession editSession, public void paste(Player player, LocalSession session, EditSession editSession,
@Switch('a') boolean ignoreAirBlocks, @Switch('b') boolean ignoreBiomes, @Switch('e') boolean ignoreEntities, @Switch('o') boolean atOrigin, @Switch('a') boolean ignoreAirBlocks, @Switch('o') boolean atOrigin,
@Switch('b') boolean ignoreBiomes, @Switch('e') boolean ignoreEntities,
@Switch('s') boolean selectPasted) throws WorldEditException { @Switch('s') boolean selectPasted) throws WorldEditException {
ClipboardHolder holder = session.getClipboard(); ClipboardHolder holder = session.getClipboard();
if (holder.getTransform().isIdentity() && editSession.getSourceMask() == null) { if (holder.getTransform().isIdentity() && editSession.getSourceMask() == null) {
@ -483,7 +483,7 @@ public class ClipboardCommands extends MethodCommands {
selector.explainRegionAdjust(player, session); selector.explainRegionAdjust(player, session);
} }
BBC.COMMAND_PASTE.send(player, to); BBC.COMMAND_PASTE.send(player, to);
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) if (!player.hasPermission("fawe.tips"))
BBC.TIP_COPYPASTE.or(BBC.TIP_SOURCE_MASK, BBC.TIP_REPLACE_MARKER).send(player, to); BBC.TIP_COPYPASTE.or(BBC.TIP_SOURCE_MASK, BBC.TIP_REPLACE_MARKER).send(player, to);
} }
@ -536,9 +536,9 @@ public class ClipboardCommands extends MethodCommands {
selector.explainRegionAdjust(player, session); selector.explainRegionAdjust(player, session);
} }
BBC.COMMAND_PASTE.send(player, to); BBC.COMMAND_PASTE.send(player, to);
FawePlayer<Object> fp = FawePlayer.wrap(player);
if (!fp.hasPermission("fawe.tips")) { if (!player.hasPermission("fawe.tips")) {
BBC.TIP_COPYPASTE.send(fp); BBC.TIP_COPYPASTE.send(player);
} }
} }
@ -557,9 +557,9 @@ public class ClipboardCommands extends MethodCommands {
transform = transform.rotateY(-(yRotate != null ? yRotate : 0)); transform = transform.rotateY(-(yRotate != null ? yRotate : 0));
transform = transform.rotateX(-(xRotate != null ? xRotate : 0)); transform = transform.rotateX(-(xRotate != null ? xRotate : 0));
transform = transform.rotateZ(-(zRotate != null ? zRotate : 0)); transform = transform.rotateZ(-(zRotate != null ? zRotate : 0));
holder.setTransform(transform.combine(holder.getTransform())); holder.setTransform(holder.getTransform().combine(transform));
BBC.COMMAND_ROTATE.send(player); BBC.COMMAND_ROTATE.send(player);
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) if (!player.hasPermission("fawe.tips"))
BBC.TIP_FLIP.or(BBC.TIP_DEFORM, BBC.TIP_TRANSFORM).send(player); BBC.TIP_FLIP.or(BBC.TIP_DEFORM, BBC.TIP_TRANSFORM).send(player);
} }
@ -578,13 +578,12 @@ public class ClipboardCommands extends MethodCommands {
ClipboardHolder holder = session.getClipboard(); ClipboardHolder holder = session.getClipboard();
AffineTransform transform = new AffineTransform(); AffineTransform transform = new AffineTransform();
transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3()); transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3());
holder.setTransform(transform.combine(holder.getTransform())); holder.setTransform(holder.getTransform().combine(transform));
BBC.COMMAND_FLIPPED.send(player); BBC.COMMAND_FLIPPED.send(player);
} }
@Deprecated // See SchematicCommands#clear
@Command( @Command(
aliases = {"clearclipboard", "/clearclipboard"}, aliases = { "clearclipboard" },
usage = "", usage = "",
desc = "Clear your clipboard", desc = "Clear your clipboard",
min = 0, min = 0,

View File

@ -20,7 +20,6 @@
package com.sk89q.worldedit.command; package com.sk89q.worldedit.command;
import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.clipboard.URIClipboardHolder; import com.boydti.fawe.object.clipboard.URIClipboardHolder;
import com.boydti.fawe.object.mask.IdMask; import com.boydti.fawe.object.mask.IdMask;
import com.boydti.fawe.object.regions.selector.FuzzyRegionSelector; import com.boydti.fawe.object.regions.selector.FuzzyRegionSelector;
@ -34,7 +33,6 @@ import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;
@ -42,9 +40,6 @@ import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.block.BlockDistributionCounter;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.visitor.RegionVisitor;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
@ -60,24 +55,21 @@ import com.sk89q.worldedit.regions.selector.RegionSelectorType;
import com.sk89q.worldedit.regions.selector.SphereRegionSelector; import com.sk89q.worldedit.regions.selector.SphereRegionSelector;
import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.util.Countable;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.command.binding.Switch; import com.sk89q.worldedit.util.command.binding.Switch;
import com.sk89q.worldedit.util.formatting.ColorCodeBuilder; import com.sk89q.worldedit.util.formatting.ColorCodeBuilder;
import com.sk89q.worldedit.util.formatting.Style; import com.sk89q.worldedit.util.formatting.Style;
import com.sk89q.worldedit.util.formatting.StyledFragment; import com.sk89q.worldedit.util.formatting.StyledFragment;
import com.sk89q.worldedit.util.formatting.component.CommandListBox; import com.sk89q.worldedit.util.formatting.component.CommandListBox;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.storage.ChunkStore; import com.sk89q.worldedit.world.storage.ChunkStore;
import java.io.File; import java.io.File;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION; import static com.sk89q.minecraft.util.commands.Logging.LogMode.POSITION;
import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION; import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION;
@ -289,7 +281,7 @@ public class SelectionCommands {
public void wand(Player player) throws WorldEditException { public void wand(Player player) throws WorldEditException {
player.giveItem(new BaseItemStack(ItemTypes.parse(we.getConfiguration().wandItem), 1)); player.giveItem(new BaseItemStack(ItemTypes.parse(we.getConfiguration().wandItem), 1));
BBC.SELECTION_WAND.send(player); BBC.SELECTION_WAND.send(player);
if (!FawePlayer.wrap(player).hasPermission("fawe.tips")) if (!player.hasPermission("fawe.tips"))
BBC.TIP_SEL_LIST.or(BBC.TIP_SELECT_CONNECTED, BBC.TIP_SET_POS1, BBC.TIP_FARWAND, BBC.TIP_DISCORD).send(player); BBC.TIP_SEL_LIST.or(BBC.TIP_SELECT_CONNECTED, BBC.TIP_SET_POS1, BBC.TIP_FARWAND, BBC.TIP_DISCORD).send(player);
} }