geforkt von Mirrors/FastAsyncWorldEdit
brush settings
Dieser Commit ist enthalten in:
Ursprung
5242efb4cf
Commit
85ebee7da7
|
@ -36,10 +36,11 @@ import java.util.concurrent.Executors;
|
|||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class FaweCache implements Trimable {
|
||||
public static int CHUNK_LAYERS = 16;
|
||||
public static int WORLD_HEIGHT = CHUNK_LAYERS << 4;
|
||||
public static int WORLD_MAX_Y = WORLD_HEIGHT - 1;
|
||||
public final class FaweCache implements Trimable {
|
||||
public final static int BLOCKS_PER_LAYER = 4096;
|
||||
public final static int CHUNK_LAYERS = 16;
|
||||
public final static int WORLD_HEIGHT = CHUNK_LAYERS << 4;
|
||||
public final static int WORLD_MAX_Y = WORLD_HEIGHT - 1;
|
||||
|
||||
|
||||
public static final char[] EMPTY_CHAR_4096 = new char[4096];
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.boydti.fawe.beta;
|
||||
|
||||
import com.boydti.fawe.jnbt.anvil.generator.GenBase;
|
||||
import com.boydti.fawe.jnbt.anvil.generator.Resource;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.function.generator.GenBase;
|
||||
import com.sk89q.worldedit.function.generator.Resource;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
|
@ -650,11 +650,6 @@ public class DelegateFilterBlock extends FilterBlock {
|
|||
return parent.getBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getBlockType(BlockVector3 position) {
|
||||
return parent.getBlockType(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
return parent.getFullBlock(position);
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
package com.boydti.fawe.beta.implementation.blocks;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
import com.boydti.fawe.object.collection.BitArray4096;
|
||||
import com.boydti.fawe.object.collection.BlockSet;
|
||||
import com.boydti.fawe.object.collection.MemBlockSet;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
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 java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class BitSetBlocks implements IChunkSet {
|
||||
private final MemBlockSet.RowZ row;
|
||||
private final BlockState blockState;
|
||||
|
||||
public BitSetBlocks(BlockState blockState) {
|
||||
this.row = new MemBlockSet.RowZ();
|
||||
this.blockState = blockState;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BlockStateHolder holder) {
|
||||
row.set(null, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return row.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTile(int x, int y, int z, CompoundTag tile) {}
|
||||
|
||||
@Override
|
||||
public void setEntity(CompoundTag tag) {}
|
||||
|
||||
@Override
|
||||
public void removeEntity(UUID uuid) {}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
if (row.get(null, x, y, z)) {
|
||||
return blockState;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] getArray(int layer) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType[] getBiomes() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Short, CompoundTag> getTiles() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<CompoundTag> getEntities() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getEntityRemoves() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSection(int layer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChunkSet reset() {
|
||||
row.reset();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trim(boolean aggressive) {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -57,13 +57,13 @@ public class CharBlocks implements IBlocks {
|
|||
|
||||
public char get(final int x, final int y, final int z) {
|
||||
final int layer = y >> 4;
|
||||
final int index = ((y & 15) << 8) | (z << 4) | (x & 15);
|
||||
final int index = ((y & 15) << 8) | (z << 4) | (x);
|
||||
return sections[layer].get(this, layer, index);
|
||||
}
|
||||
|
||||
public void set(final int x, final int y, final int z, final char value) {
|
||||
final int layer = y >> 4;
|
||||
final int index = ((y & 15) << 8) | (z << 4) | (x & 15);
|
||||
final int index = ((y & 15) << 8) | (z << 4) | (x);
|
||||
set(layer, index, value);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.boydti.fawe.Fawe;
|
|||
import com.boydti.fawe.object.brush.scroll.ScrollAction;
|
||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
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.command.tool.BrushTool;
|
||||
|
@ -20,9 +19,7 @@ import com.sk89q.worldedit.internal.expression.Expression;
|
|||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.Constant;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException;
|
||||
import com.sk89q.worldedit.util.command.CommandCallable;
|
||||
import com.sk89q.worldedit.util.command.Dispatcher;
|
||||
import com.sk89q.worldedit.util.command.ProcessedCallable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
|
@ -62,23 +59,15 @@ public class BrushSettings {
|
|||
}
|
||||
|
||||
public static BrushSettings get(BrushTool tool, Player player, LocalSession session, Map<String, Object> settings) throws CommandException, InputParseException {
|
||||
Dispatcher dispatcher = PlatformCommandManager.getInstance().getCommandManager();
|
||||
Dispatcher brushDispatcher = (Dispatcher) (dispatcher.get("brush").getCallable());
|
||||
if (brushDispatcher == null) {
|
||||
return null;
|
||||
}
|
||||
PlatformCommandManager manager = PlatformCommandManager.getInstance();
|
||||
String constructor = (String) settings.get(SettingType.BRUSH.name());
|
||||
if (constructor == null) {
|
||||
return new BrushSettings();
|
||||
}
|
||||
String[] split = constructor.split(" ");
|
||||
|
||||
CommandCallable sphereCommand = ((ProcessedCallable) brushDispatcher.get(split[0]).getCallable()).getParent();
|
||||
CommandLocals locals = new CommandLocals();
|
||||
locals.put(Actor.class, player);
|
||||
String args = constructor.replaceAll(split[0] + "[ ]?", "");
|
||||
String[] parentArgs = new String[]{"brush", split[0]};
|
||||
BrushSettings bs = (BrushSettings) sphereCommand.call(args, locals, parentArgs);
|
||||
BrushSettings bs = (BrushSettings) manager.parse(Brush.class, args, player);
|
||||
bs.constructor.put(SettingType.BRUSH, constructor);
|
||||
if (settings.containsKey(SettingType.PERMISSIONS.name())) {
|
||||
bs.permissions.addAll((Collection<? extends String>) settings.get(SettingType.PERMISSIONS.name()));
|
||||
|
|
|
@ -21,14 +21,13 @@ import java.util.Set;
|
|||
* - Grouping / iteration is by chunk section, and the y>z>x order
|
||||
*/
|
||||
public final class MemBlockSet extends BlockSet {
|
||||
private final static int BITS_PER_LAYER = 4096;
|
||||
private final static int BITS_PER_WORD = 6;
|
||||
private final static int WORDS = BITS_PER_LAYER >> BITS_PER_WORD;
|
||||
private final static IRow NULL_ROW_X = new NullRowX();
|
||||
private final static IRow NULL_ROW_Z = new NullRowZ();
|
||||
private final static IRow NULL_ROW_Y = new NullRowY();
|
||||
private final IRow[] rows;
|
||||
private final MutableBlockVector3 mutable;
|
||||
public final static int BITS_PER_WORD = 6;
|
||||
public final static int WORDS = FaweCache.BLOCKS_PER_LAYER >> BITS_PER_WORD;
|
||||
public final static IRow NULL_ROW_X = new NullRowX();
|
||||
public final static IRow NULL_ROW_Z = new NullRowZ();
|
||||
public final static IRow NULL_ROW_Y = new NullRowY();
|
||||
public final IRow[] rows;
|
||||
public final MutableBlockVector3 mutable;
|
||||
|
||||
public MemBlockSet() {
|
||||
this(16, 0, 0);
|
||||
|
@ -746,7 +745,7 @@ public final class MemBlockSet extends BlockSet {
|
|||
void apply(int x, int y, int z);
|
||||
}
|
||||
|
||||
private interface IRow {
|
||||
public interface IRow {
|
||||
default boolean get(IRow[] rows, int x, int y, int z) { return false; }
|
||||
void set(IRow[] rows, int x, int y, int z);
|
||||
default boolean add(IRow[] rows, int x, int y, int z) {
|
||||
|
@ -760,7 +759,7 @@ public final class MemBlockSet extends BlockSet {
|
|||
default void clear(IRow[] rows, int x, int y, int z) { return; }
|
||||
}
|
||||
|
||||
private static final class NullRowX implements IRow {
|
||||
public static final class NullRowX implements IRow {
|
||||
@Override
|
||||
public void set(IRow[] parent, int x, int y, int z) {
|
||||
IRow row = new RowX(parent.length);
|
||||
|
@ -769,7 +768,7 @@ public final class MemBlockSet extends BlockSet {
|
|||
}
|
||||
}
|
||||
|
||||
private static final class NullRowZ implements IRow {
|
||||
public static final class NullRowZ implements IRow {
|
||||
@Override
|
||||
public void set(IRow[] parent, int x, int y, int z) {
|
||||
IRow row = new RowZ();
|
||||
|
@ -778,7 +777,7 @@ public final class MemBlockSet extends BlockSet {
|
|||
}
|
||||
}
|
||||
|
||||
private static final class NullRowY implements IRow {
|
||||
public static final class NullRowY implements IRow {
|
||||
@Override
|
||||
public void set(IRow[] parent, int x, int y, int z) {
|
||||
IRow row = new RowY();
|
||||
|
@ -787,7 +786,7 @@ public final class MemBlockSet extends BlockSet {
|
|||
}
|
||||
}
|
||||
|
||||
private static final class RowX implements IRow {
|
||||
public static final class RowX implements IRow {
|
||||
private final IRow[] rows;
|
||||
|
||||
public RowX(int size) {
|
||||
|
@ -821,12 +820,12 @@ public final class MemBlockSet extends BlockSet {
|
|||
}
|
||||
}
|
||||
|
||||
private static final class RowZ implements IRow {
|
||||
public static final class RowZ implements IRow {
|
||||
private final IRow[] rows;
|
||||
|
||||
public RowZ() {
|
||||
this.rows = new IRow[FaweCache.CHUNK_LAYERS];
|
||||
for (int i = 0; i < FaweCache.CHUNK_LAYERS; i++) rows[i] = NULL_ROW_Y;
|
||||
reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -853,9 +852,22 @@ public final class MemBlockSet extends BlockSet {
|
|||
public boolean remove(IRow[] parent, int x, int y, int z) {
|
||||
return this.rows[y >> 4].remove(this.rows, x, y, z);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
for (IRow row :rows) {
|
||||
if (row instanceof RowY) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
for (int i = 0; i < FaweCache.CHUNK_LAYERS; i++) rows[i] = NULL_ROW_Y;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class RowY implements IRow {
|
||||
public static final class RowY implements IRow {
|
||||
private final long[] bits;
|
||||
|
||||
public RowY() {
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
package com.boydti.fawe.object.pattern;
|
||||
|
||||
import com.boydti.fawe.beta.DelegateFilterBlock;
|
||||
import com.boydti.fawe.beta.FilterBlock;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.io.IOException;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
|
||||
public class NoYPattern extends AbstractPattern {
|
||||
|
||||
|
|
|
@ -1,27 +1,52 @@
|
|||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.object.mask.*;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import com.boydti.fawe.object.mask.AdjacentAnyMask;
|
||||
import com.boydti.fawe.object.mask.AdjacentMask;
|
||||
import com.boydti.fawe.object.mask.AngleMask;
|
||||
import com.boydti.fawe.object.mask.BiomeMask;
|
||||
import com.boydti.fawe.object.mask.BlockLightMask;
|
||||
import com.boydti.fawe.object.mask.BrightnessMask;
|
||||
import com.boydti.fawe.object.mask.DataMask;
|
||||
import com.boydti.fawe.object.mask.ExtremaMask;
|
||||
import com.boydti.fawe.object.mask.IdDataMask;
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
import com.boydti.fawe.object.mask.LightMask;
|
||||
import com.boydti.fawe.object.mask.OpacityMask;
|
||||
import com.boydti.fawe.object.mask.ROCAngleMask;
|
||||
import com.boydti.fawe.object.mask.RadiusMask;
|
||||
import com.boydti.fawe.object.mask.RandomMask;
|
||||
import com.boydti.fawe.object.mask.SimplexMask;
|
||||
import com.boydti.fawe.object.mask.SkyLightMask;
|
||||
import com.boydti.fawe.object.mask.SurfaceMask;
|
||||
import com.boydti.fawe.object.mask.WallMask;
|
||||
import com.boydti.fawe.object.mask.XAxisMask;
|
||||
import com.boydti.fawe.object.mask.YAxisMask;
|
||||
import com.boydti.fawe.object.mask.ZAxisMask;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
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.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.mask.ExpressionMask;
|
||||
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.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.mask.OffsetMask;
|
||||
import com.sk89q.worldedit.function.mask.RegionMask;
|
||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
|
||||
import com.sk89q.worldedit.session.request.RequestSelection;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import com.sk89q.worldedit.util.command.parametric.Optional;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
|
||||
@Command(aliases = {"masks"},
|
||||
desc = "Help for the various masks. [More Info](https://git.io/v9r4K)",
|
||||
|
@ -77,7 +102,7 @@ public class MaskCommands extends MethodCommands {
|
|||
@Command(
|
||||
name = "#skylight",
|
||||
desc = "Restrict to specific sky light levels"
|
||||
)
|
||||
)
|
||||
public Mask skylight(Extent extent, double min, double max) {
|
||||
return new SkyLightMask(extent, (int) min, (int) max);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
public final class CommandQueuedConditionGenerator implements CommandConditionGenerator {
|
||||
|
||||
public interface Registration {
|
||||
Registration commandQueuedConditionGenerator(CommandPermissionsConditionGenerator generator);
|
||||
Registration commandQueuedConditionGenerator(CommandQueuedConditionGenerator generator);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
package com.sk89q.worldedit.command.util;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.enginehub.piston.Command;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
import org.enginehub.piston.CommandParseResult;
|
||||
import org.enginehub.piston.converter.ArgumentConverter;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.enginehub.piston.inject.Key;
|
||||
import org.enginehub.piston.suggestion.Suggestion;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class DelegateCommandManager implements CommandManager {
|
||||
@Override
|
||||
public Command.Builder newCommand(String s) {
|
||||
return parent.newCommand(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(Command command) {
|
||||
parent.register(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(String name, Consumer<Command.Builder> registrationProcess) {
|
||||
parent.register(name, registrationProcess);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerManager(CommandManager manager) {
|
||||
parent.registerManager(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<Command> getAllCommands() {
|
||||
return parent.getAllCommands();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsCommand(String name) {
|
||||
return parent.containsCommand(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Command> getCommand(String s) {
|
||||
return parent.getCommand(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<Suggestion> getSuggestions(InjectedValueAccess injectedValueAccess, List<String> list) {
|
||||
return parent.getSuggestions(injectedValueAccess, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandParseResult parse(InjectedValueAccess injectedValueAccess, List<String> list) {
|
||||
return parent.parse(injectedValueAccess, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute(InjectedValueAccess context, List<String> args) {
|
||||
return parent.execute(context, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void registerConverter(Key<T> key, ArgumentConverter<T> argumentConverter) {
|
||||
parent.registerConverter(key, argumentConverter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Optional<ArgumentConverter<T>> getConverter(Key<T> key) {
|
||||
return parent.getConverter(key);
|
||||
}
|
||||
|
||||
private final CommandManager parent;
|
||||
|
||||
public DelegateCommandManager(CommandManager parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
}
|
|
@ -84,6 +84,7 @@ import com.sk89q.worldedit.command.argument.RegionFactoryConverter;
|
|||
import com.sk89q.worldedit.command.argument.RegistryConverter;
|
||||
import com.sk89q.worldedit.command.argument.VectorConverter;
|
||||
import com.sk89q.worldedit.command.argument.ZonedDateTimeConverter;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.command.util.CommandQueued;
|
||||
import com.sk89q.worldedit.command.util.CommandQueuedCondition;
|
||||
import com.sk89q.worldedit.command.util.PermissionCondition;
|
||||
|
@ -114,6 +115,8 @@ import com.sk89q.worldedit.world.World;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -128,7 +131,9 @@ import javax.annotation.Nullable;
|
|||
import org.enginehub.piston.Command;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
import org.enginehub.piston.TextConfig;
|
||||
import org.enginehub.piston.converter.ArgumentConverter;
|
||||
import org.enginehub.piston.converter.ArgumentConverters;
|
||||
import org.enginehub.piston.converter.ConversionResult;
|
||||
import org.enginehub.piston.exception.CommandException;
|
||||
import org.enginehub.piston.exception.CommandExecutionException;
|
||||
import org.enginehub.piston.exception.ConditionFailedException;
|
||||
|
@ -175,6 +180,11 @@ public final class PlatformCommandManager {
|
|||
private final CommandRegistrationHandler registration;
|
||||
private static PlatformCommandManager INSTANCE;
|
||||
|
||||
/*
|
||||
Command types
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
|
@ -523,6 +533,18 @@ public final class PlatformCommandManager {
|
|||
return new CommandArgParser(CommandArgParser.spaceSplit(input.substring(1))).parseArgs();
|
||||
}
|
||||
|
||||
public <T> Collection<T> parse(Class<T> clazz, String arguments, @Nullable Actor actor) {
|
||||
List<T> def = Collections.emptyList();
|
||||
Optional<ArgumentConverter<T>> converterOptional = commandManager.getConverter(Key.of(clazz));
|
||||
if (converterOptional.isPresent()) {
|
||||
ArgumentConverter<T> converter = converterOptional.get();
|
||||
MemoizingValueAccess injectedValues = initializeInjectedValues(() -> arguments, actor);
|
||||
ConversionResult<T> result = converter.convert(arguments, injectedValues);
|
||||
return result.orElse(def);
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void handleCommand(CommandEvent event) {
|
||||
Request.reset();
|
||||
|
@ -571,8 +593,6 @@ public final class PlatformCommandManager {
|
|||
Request.request().setWorld(((World) extent));
|
||||
}
|
||||
}
|
||||
LocalConfiguration config = worldEdit.getConfiguration();
|
||||
|
||||
MemoizingValueAccess context = initializeInjectedValues(event::getArguments, actor);
|
||||
|
||||
final FawePlayer fp = FawePlayer.wrap(actor);
|
||||
|
|
|
@ -19,37 +19,26 @@
|
|||
|
||||
package com.sk89q.worldedit.extent;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.jnbt.anvil.generator.GenBase;
|
||||
import com.boydti.fawe.jnbt.anvil.generator.Resource;
|
||||
import com.boydti.fawe.object.HistoryExtent;
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.object.extent.LightingExtent;
|
||||
import com.boydti.fawe.util.ExtentTraverser;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.OperationQueue;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
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.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* A base class for {@link Extent}s that merely passes extents onto another.
|
||||
*/
|
||||
|
@ -206,6 +195,7 @@ public class AbstractDelegateExtent implements Extent, LightingExtent {
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightness(int x, int y, int z) {
|
||||
if (extent instanceof LightingExtent) {
|
||||
return ((LightingExtent) extent).getBrightness(x, y, z);
|
||||
|
@ -213,6 +203,15 @@ public class AbstractDelegateExtent implements Extent, LightingExtent {
|
|||
return getBlock(x, y, z).getBlockType().getMaterial().getLightValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void relightChunk(int chunkX, int chunkZ) {
|
||||
if (extent instanceof LightingExtent) {
|
||||
((LightingExtent) extent).relightChunk(chunkX, chunkZ);
|
||||
} else {
|
||||
throw new UnsupportedOperationException("Cannot relight");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Generic
|
||||
*/
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.internal.command;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.CommandQueuedConditionGenerator;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
import org.enginehub.piston.gen.CommandCallListener;
|
||||
import org.enginehub.piston.gen.CommandRegistration;
|
||||
|
@ -30,6 +31,8 @@ import java.util.List;
|
|||
public class CommandRegistrationHandler {
|
||||
|
||||
private static final CommandPermissionsConditionGenerator PERM_GEN = new CommandPermissionsConditionGenerator();
|
||||
private static final CommandQueuedConditionGenerator QUEUED_GEN = new CommandQueuedConditionGenerator();
|
||||
|
||||
|
||||
private final List<CommandCallListener> callListeners;
|
||||
|
||||
|
@ -43,7 +46,12 @@ public class CommandRegistrationHandler {
|
|||
.listeners(callListeners);
|
||||
if (registration instanceof CommandPermissionsConditionGenerator.Registration) {
|
||||
((CommandPermissionsConditionGenerator.Registration) registration).commandPermissionsConditionGenerator(
|
||||
PERM_GEN
|
||||
PERM_GEN
|
||||
);
|
||||
}
|
||||
if (registration instanceof CommandQueuedConditionGenerator.Registration) {
|
||||
((CommandQueuedConditionGenerator.Registration) registration).commandQueuedConditionGenerator(
|
||||
QUEUED_GEN
|
||||
);
|
||||
}
|
||||
registration.build();
|
||||
|
|
|
@ -91,7 +91,7 @@ configure(subprojects + project("core:ap")) {
|
|||
def textExtrasVersion = "3.0.2"
|
||||
project("core") {
|
||||
def textVersion = "3.0.1"
|
||||
def pistonVersion = '0.4.2'
|
||||
def pistonVersion = '0.4.3-SNAPSHOT'
|
||||
|
||||
dependencies {
|
||||
shade "net.kyori:text-api:$textVersion"
|
||||
|
@ -103,7 +103,7 @@ project("core") {
|
|||
}
|
||||
shade 'com.thoughtworks.paranamer:paranamer:2.6'
|
||||
shade 'com.sk89q.lib:jlibnoise:1.0.0'
|
||||
shade "org.enginehub.piston:core:$pistonVersion"
|
||||
shade "FAWE-Piston:lastSuccessfulBuild:core/build/libs/core-$pistonVersion@jar"
|
||||
shade "org.enginehub.piston.core-ap:runtime:$pistonVersion"
|
||||
shade "org.enginehub.piston:default-impl:$pistonVersion"
|
||||
}
|
||||
|
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren