mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
freebuild region restrictions
This commit is contained in:
commit
82ede1d42b
@ -43,6 +43,7 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@ -50,6 +51,7 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@ -72,6 +74,8 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
return this.vault;
|
||||
}
|
||||
|
||||
private List<org.bukkit.util.Vector> locations = Arrays.asList(new Vector(0, 5, 0));
|
||||
|
||||
public FaweBukkit(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
try {
|
||||
@ -551,6 +555,14 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
MainUtil.handleError(e);
|
||||
}
|
||||
}
|
||||
if (Settings.IMP.EXPERIMENTAL.FREEBUILD) {
|
||||
try {
|
||||
managers.add(new FreeBuildRegion());
|
||||
Fawe.debug("Plugin '<internal.freebuild>' found. Using it now.");
|
||||
} catch (final Throwable e) {
|
||||
MainUtil.handleError(e);
|
||||
}
|
||||
}
|
||||
|
||||
return managers;
|
||||
}
|
||||
|
@ -0,0 +1,105 @@
|
||||
package com.boydti.fawe.bukkit.regions;
|
||||
|
||||
import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
|
||||
import com.boydti.fawe.bukkit.wrapper.AsyncWorld;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.queue.NullFaweQueue;
|
||||
import com.boydti.fawe.regions.FaweMask;
|
||||
import com.boydti.fawe.regions.FaweMaskManager;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventException;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.RegisteredListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class FreeBuildRegion extends BukkitMaskManager {
|
||||
private final ArrayList<RegisteredListener> listeners;
|
||||
|
||||
public FreeBuildRegion() {
|
||||
super("freebuild");
|
||||
this.listeners = new ArrayList<>();
|
||||
RegisteredListener[] listeners = BlockPlaceEvent.getHandlerList().getRegisteredListeners();
|
||||
for (RegisteredListener listener : listeners) {
|
||||
if (listener.getPriority() == EventPriority.MONITOR) continue;
|
||||
if (!listener.isIgnoringCancelled()) continue;
|
||||
this.listeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExclusive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaweMask getMask(FawePlayer<Player> player, MaskType type) {
|
||||
if (type != MaskType.MEMBER) return null;
|
||||
ArrayList<RegisteredListener> currRegList = new ArrayList<>();
|
||||
for (RegisteredListener listener : this.listeners) {
|
||||
String name = listener.getPlugin().getName();
|
||||
if (!player.hasPermission("fawe.freebuild." + name.toLowerCase())) continue;
|
||||
currRegList.add(listener);
|
||||
}
|
||||
if (currRegList.isEmpty()) return null;
|
||||
RegisteredListener[] listeners = currRegList.toArray(new RegisteredListener[currRegList.size()]);
|
||||
|
||||
World world = player.parent.getWorld();
|
||||
AsyncWorld asyncWorld = AsyncWorld.wrap(world);
|
||||
|
||||
Vector vec1 = asyncWorld.getMinimumPoint();
|
||||
Vector vec2 = asyncWorld.getMaximumPoint();
|
||||
Location pos1 = BukkitAdapter.adapt(world, vec1);
|
||||
Location pos2 = BukkitAdapter.adapt(world, vec2);
|
||||
|
||||
AsyncBlock block = new AsyncBlock(asyncWorld, new NullFaweQueue(asyncWorld.getWorldName()), 0, 0, 0);
|
||||
BlockBreakEvent event = new BlockBreakEvent(block, player.parent);
|
||||
|
||||
|
||||
return new BukkitMask(pos1, pos2) {
|
||||
@Override
|
||||
public Region getRegion() {
|
||||
return new CuboidRegion(vec1, vec2) {
|
||||
@Override
|
||||
public boolean contains(int x, int y, int z) {
|
||||
return contains(x, z);
|
||||
}
|
||||
|
||||
private int lastX = Integer.MIN_VALUE, lastZ = Integer.MIN_VALUE;
|
||||
private boolean lastResult;
|
||||
|
||||
@Override
|
||||
public boolean contains(int x, int z) {
|
||||
if (x == lastX && z == lastZ) return lastResult;
|
||||
lastX = x;
|
||||
lastZ = z;
|
||||
int y = 128;
|
||||
event.setCancelled(false);
|
||||
block.setPosition(x, y, z);
|
||||
try {
|
||||
for (RegisteredListener listener : listeners) {
|
||||
listener.callEvent(event);
|
||||
}
|
||||
} catch (EventException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return lastResult = !event.isCancelled();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -23,9 +23,9 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class AsyncBlock implements Block {
|
||||
|
||||
public final int z;
|
||||
public final int y;
|
||||
public final int x;
|
||||
public int z;
|
||||
public int y;
|
||||
public int x;
|
||||
public final FaweQueue queue;
|
||||
public final AsyncWorld world;
|
||||
|
||||
@ -37,6 +37,12 @@ public class AsyncBlock implements Block {
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public void setPosition(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public byte getData() {
|
||||
|
@ -68,7 +68,7 @@ public class AsyncChunk implements Chunk {
|
||||
|
||||
@Override
|
||||
public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain) {
|
||||
if (Thread.currentThread() == Fawe.get().getMainThread()) {
|
||||
if (Fawe.isMainThread()) {
|
||||
return world.getChunkAt(x, z).getChunkSnapshot(includeMaxblocky, includeBiome, includeBiomeTempRain);
|
||||
}
|
||||
return whenLoaded(new RunnableVal<ChunkSnapshot>() {
|
||||
@ -80,7 +80,7 @@ public class AsyncChunk implements Chunk {
|
||||
}
|
||||
|
||||
private <T> T whenLoaded(RunnableVal<T> task) {
|
||||
if (Thread.currentThread() == Fawe.get().getMainThread()) {
|
||||
if (Fawe.isMainThread()) {
|
||||
task.run();
|
||||
return task.value;
|
||||
}
|
||||
|
@ -25,22 +25,6 @@ public abstract class FaweParser<T> extends InputParser<T> {
|
||||
|
||||
public abstract Dispatcher getDispatcher();
|
||||
|
||||
// public List<String> suggestRemaining(String input, String... expected) throws InputParseException {
|
||||
// List<String> remainder = StringMan.split(input, ':');
|
||||
// int len = remainder.size();
|
||||
// if (len != expected.length - 1) {
|
||||
// if (len <= expected.length - 1 && len != 0) {
|
||||
// if (remainder.get(len - 1).endsWith(":")) {
|
||||
// throw new SuggestInputParseException(null, StringMan.join(expected, ":"));
|
||||
// }
|
||||
// throw new SuggestInputParseException(null, expected[0] + ":" + input + ":" + StringMan.join(Arrays.copyOfRange(expected, len + 1, 3), ":"));
|
||||
// } else {
|
||||
// throw new SuggestInputParseException(null, StringMan.join(expected, ":"));
|
||||
// }
|
||||
// }
|
||||
// return remainder;
|
||||
// }
|
||||
|
||||
protected static class ParseEntry {
|
||||
public boolean and;
|
||||
public String input;
|
||||
@ -79,7 +63,7 @@ public abstract class FaweParser<T> extends InputParser<T> {
|
||||
last = i + 1;
|
||||
continue outer;
|
||||
default:
|
||||
if (StringMan.getMatchingBracket(c) != c) {
|
||||
if (c == '[' && StringMan.getMatchingBracket(c) != c) {
|
||||
int next = StringMan.findMatchingBracket(toParse, i);
|
||||
if (next != -1) {
|
||||
i = next;
|
||||
|
@ -399,7 +399,7 @@ public abstract class MappedFaweQueue<WORLD, CHUNK, CHUNKSECTIONS, SECTION> impl
|
||||
if (chunk != null) {
|
||||
return chunk;
|
||||
}
|
||||
boolean sync = Thread.currentThread() == Fawe.get().getMainThread();
|
||||
boolean sync = Fawe.isMainThread();
|
||||
if (sync) {
|
||||
return loadChunk(getWorld(), cx, cz, true);
|
||||
} else if (getSettings().HISTORY.CHUNK_WAIT_MS > 0) {
|
||||
|
@ -9,6 +9,8 @@ import com.boydti.fawe.util.SetQueue;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -179,12 +181,12 @@ public class NullFaweQueue implements FaweQueue {
|
||||
|
||||
@Override
|
||||
public int getCombinedId4Data(int x, int y, int z) throws FaweException.FaweChunkLoadException {
|
||||
return 0;
|
||||
return BlockTypes.AIR.getInternalId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCachedCombinedId4Data(int x, int y, int z) throws FaweException.FaweChunkLoadException {
|
||||
return 0;
|
||||
return BlockTypes.AIR.getInternalId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,4 +56,8 @@ public abstract class FaweMaskManager<T> {
|
||||
private boolean hasMemberPermission(FawePlayer fp) {
|
||||
return fp.hasPermission("fawe." + getKey() + ".member");
|
||||
}
|
||||
|
||||
public boolean isExclusive() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -586,7 +586,7 @@ public class MainUtil {
|
||||
long ratio = total / compressedSize;
|
||||
long saved = total - compressedSize;
|
||||
|
||||
if (ratio > 3 && Thread.currentThread() != Fawe.get().getMainThread() && actor != null) {
|
||||
if (ratio > 3 && !Fawe.isMainThread() && actor != null) {
|
||||
BBC.COMPRESSED.send(actor, saved, ratio);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -188,7 +188,7 @@ public abstract class TaskManager {
|
||||
if (r == null) {
|
||||
return;
|
||||
}
|
||||
if (Thread.currentThread() == Fawe.get().getMainThread()) {
|
||||
if (Fawe.isMainThread()) {
|
||||
r.run();
|
||||
} else {
|
||||
task(r);
|
||||
@ -336,7 +336,7 @@ public abstract class TaskManager {
|
||||
* @return
|
||||
*/
|
||||
public <T> T syncWhenFree(final RunnableVal<T> function, int timeout) {
|
||||
if (Fawe.get().getMainThread() == Thread.currentThread()) {
|
||||
if (Fawe.isMainThread()) {
|
||||
function.run();
|
||||
return function.value;
|
||||
}
|
||||
@ -389,7 +389,7 @@ public abstract class TaskManager {
|
||||
}
|
||||
|
||||
public <T> T sync(final Supplier<T> function, int timeout) {
|
||||
if (Fawe.get().getMainThread() == Thread.currentThread()) {
|
||||
if (Fawe.isMainThread()) {
|
||||
return function.get();
|
||||
}
|
||||
final AtomicBoolean running = new AtomicBoolean(true);
|
||||
|
@ -125,16 +125,19 @@ public class WEManager {
|
||||
}
|
||||
}
|
||||
if (!removed) return regions.toArray(new Region[regions.size()]);
|
||||
masks.clear();
|
||||
}
|
||||
}
|
||||
Set<FaweMask> tmpMasks = new HashSet<>();
|
||||
for (final FaweMaskManager manager : managers) {
|
||||
if (player.hasPermission("fawe." + manager.getKey())) {
|
||||
try {
|
||||
if (manager.isExclusive() && !masks.isEmpty()) continue;
|
||||
final FaweMask mask = manager.getMask(player, FaweMaskManager.MaskType.getDefaultMaskType());
|
||||
if (mask != null) {
|
||||
regions.add(mask.getRegion());
|
||||
masks.add(mask);
|
||||
if (manager.isExclusive()) break;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
|
@ -1690,7 +1690,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public int makeCuboidFaces(final Region region, final BaseBlock block) {
|
||||
public int makeCuboidFaces(final Region region, final BlockStateHolder block) {
|
||||
return this.makeCuboidFaces(region, (Pattern) (block));
|
||||
}
|
||||
|
||||
@ -1744,7 +1744,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public int makeCuboidWalls(final Region region, final BaseBlock block) {
|
||||
public int makeCuboidWalls(final Region region, final BlockStateHolder block) {
|
||||
return this.makeCuboidWalls(region, (Pattern) (block));
|
||||
}
|
||||
|
||||
@ -1811,8 +1811,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
* @return number of blocks affected
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public int overlayCuboidBlocks(final Region region, final BaseBlock block) {
|
||||
public int overlayCuboidBlocks(Region region, BlockStateHolder block) throws MaxChangedBlocksException {
|
||||
checkNotNull(block);
|
||||
return this.overlayCuboidBlocks(region, (Pattern) (block));
|
||||
}
|
||||
@ -1906,11 +1905,11 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
* @return number of blocks moved
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||
*/
|
||||
public int moveRegion(final Region region, final Vector dir, final int distance, final boolean copyAir, final BaseBlock replacement) {
|
||||
public int moveRegion(final Region region, final Vector dir, final int distance, final boolean copyAir, final BlockStateHolder replacement) {
|
||||
return moveRegion(region, dir, distance, copyAir, true, false, replacement);
|
||||
}
|
||||
|
||||
public int moveRegion(final Region region, final Vector dir, final int distance, final boolean copyAir, final boolean copyEntities, final boolean copyBiomes, BaseBlock replacement) {
|
||||
public int moveRegion(final Region region, final Vector dir, final int distance, final boolean copyAir, final boolean copyEntities, final boolean copyBiomes, BlockStateHolder replacement) {
|
||||
return moveRegion(region, dir, distance, copyAir, copyEntities, copyBiomes, (Pattern) replacement);
|
||||
}
|
||||
|
||||
@ -1963,7 +1962,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
* @return number of blocks moved
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||
*/
|
||||
public int moveCuboidRegion(final Region region, final Vector dir, final int distance, final boolean copyAir, final BaseBlock replacement) {
|
||||
public int moveCuboidRegion(final Region region, final Vector dir, final int distance, final boolean copyAir, final BlockStateHolder replacement) {
|
||||
return this.moveRegion(region, dir, distance, copyAir, replacement);
|
||||
}
|
||||
|
||||
|
@ -21,11 +21,6 @@ package com.sk89q.worldedit;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.Constant;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.RValue;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.platform.BlockInteractEvent;
|
||||
@ -40,6 +35,9 @@ import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.Constant;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.RValue;
|
||||
import com.sk89q.worldedit.scripting.CraftScriptContext;
|
||||
import com.sk89q.worldedit.scripting.CraftScriptEngine;
|
||||
import com.sk89q.worldedit.scripting.RhinoCraftScriptEngine;
|
||||
@ -52,13 +50,18 @@ import com.sk89q.worldedit.util.io.file.FilenameException;
|
||||
import com.sk89q.worldedit.util.io.file.FilenameResolutionException;
|
||||
import com.sk89q.worldedit.util.io.file.InvalidFilenameException;
|
||||
import com.sk89q.worldedit.util.logging.WorldEditPrefixHandler;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.registry.BundledBlockData;
|
||||
import com.sk89q.worldedit.world.registry.BundledItemData;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
|
||||
import javax.script.ScriptException;
|
||||
import java.io.*;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -143,7 +146,7 @@ public class WorldEdit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the block factory from which new {@link BaseBlock}s can be
|
||||
* Get the block factory from which new {@link BlockStateHolder}s can be
|
||||
* constructed.
|
||||
*
|
||||
* @return the block factory
|
||||
|
@ -583,7 +583,7 @@ public class ClipboardCommands extends MethodCommands {
|
||||
|
||||
@Deprecated // See SchematicCommands#clear
|
||||
@Command(
|
||||
aliases = {"clearclipboard"},
|
||||
aliases = {"clearclipboard", "/clearclipboard"},
|
||||
usage = "",
|
||||
desc = "Clear your clipboard",
|
||||
min = 0,
|
||||
|
@ -222,6 +222,7 @@ public class SchematicCommands extends MethodCommands {
|
||||
ReadableByteChannel rbc = Channels.newChannel(url.openStream());
|
||||
in = Channels.newInputStream(rbc);
|
||||
uri = url.toURI();
|
||||
if (format == null) format = ClipboardFormat.SCHEMATIC;
|
||||
} else {
|
||||
if (!player.hasPermission("worldedit.schematic.load") && !player.hasPermission("worldedit.clipboard.load")) {
|
||||
BBC.NO_PERM.send(player, "worldedit.clipboard.load");
|
||||
|
@ -23,15 +23,14 @@ import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.util.command.composition.SimpleCommand;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.NoMatchException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.util.command.argument.CommandArgs;
|
||||
import com.sk89q.worldedit.util.command.composition.SimpleCommand;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
public class PatternParser extends SimpleCommand<Pattern> {
|
||||
|
@ -7,29 +7,29 @@ import com.boydti.fawe.util.StringMan;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.minecraft.util.commands.CommandLocals;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.util.command.*;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.command.MaskCommands;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.NoMatchException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.*;
|
||||
import com.sk89q.worldedit.function.mask.BlockMaskBuilder;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.MaskIntersection;
|
||||
import com.sk89q.worldedit.function.mask.MaskUnion;
|
||||
import com.sk89q.worldedit.internal.command.ActorAuthorizer;
|
||||
import com.sk89q.worldedit.internal.command.WorldEditBinding;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.command.Dispatcher;
|
||||
import com.sk89q.worldedit.util.command.SimpleDispatcher;
|
||||
import com.sk89q.worldedit.util.command.parametric.ParametricBuilder;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A mask that tests whether a block matches a given {@link BlockCategory}, or tag.
|
||||
*/
|
||||
public class BlockCategoryMask extends AbstractExtentMask {
|
||||
|
||||
private BlockCategory category;
|
||||
|
||||
public BlockCategoryMask(Extent extent, BlockCategory category) {
|
||||
super(extent);
|
||||
checkNotNull(category);
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Vector vector) {
|
||||
return category.contains(getExtent().getBlock(vector));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Mask2D toMask2D() {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -4,29 +4,25 @@ import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.command.FaweParser;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.RunnableVal2;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.io.CharStreams;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.BrushProcessor;
|
||||
import com.sk89q.worldedit.extension.factory.DefaultMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.HashTagPatternParser;
|
||||
import com.sk89q.worldedit.extension.platform.CommandManager;
|
||||
import com.sk89q.worldedit.util.command.CallableProcessor;
|
||||
import com.sk89q.worldedit.util.command.ProcessedCallable;
|
||||
import com.sk89q.worldedit.util.command.parametric.FunctionParametricCallable;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public class CommandScriptLoader {
|
||||
private final NashornCraftScriptEngine engine;
|
||||
|
Loading…
Reference in New Issue
Block a user