From c05d425f649d09a6919055287b3be5fa20fdfc0a Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 23 Jul 2019 06:58:18 +1000 Subject: [PATCH] couple more compilation issues --- .../com/boydti/fawe/beta/IQueueExtent.java | 2 +- .../com/boydti/fawe/command/CFICommand.java | 1 - .../com/boydti/fawe/command/CFICommands.java | 51 ++-- .../boydti/fawe/command/CommandProcessor.java | 2 +- .../fawe/object/brush/BrushSettings.java | 2 +- .../boydti/fawe/object/brush/HeightBrush.java | 5 +- .../fawe/object/brush/ScatterCommand.java | 2 +- .../fawe/object/change/MutableTileChange.java | 1 - .../boydti/fawe/object/extent/NullExtent.java | 254 ++++++++++++++---- .../fawe/object/schematic/Schematic.java | 3 +- .../fawe/object/visitor/AboveVisitor.java | 10 +- .../general/plot/FaweLocalBlockQueue.java | 2 +- .../fawe/util/DocumentationPrinter.java | 1 - .../worldedit/command/BrushCommands.java | 12 +- .../sk89q/worldedit/command/MaskCommands.java | 22 +- .../worldedit/command/MethodCommands.java | 6 +- .../platform/PlatformCommandManager.java | 24 +- .../function/visitor/BreadthFirstSearch.java | 3 - .../function/visitor/NonRisingVisitor.java | 8 +- .../worldedit/internal/annotation/Range.java | 2 - .../sk89q/worldedit/world/SimpleWorld.java | 3 +- .../java/com/sk89q/worldedit/world/World.java | 9 +- 22 files changed, 274 insertions(+), 151 deletions(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueExtent.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueExtent.java index dcd7eb729..a94003ca8 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueExtent.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/IQueueExtent.java @@ -126,5 +126,5 @@ public interface IQueueExtent extends Flushable, Trimable, Extent { boolean isEmpty(); - void sendChunk(int chunkX, int chunkZ); + void sendChunk(int chunkX, int chunkZ, int bitMask); } \ No newline at end of file diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommand.java b/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommand.java index 3eba33eb6..0e4490070 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommand.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommand.java @@ -5,7 +5,6 @@ import com.boydti.fawe.object.FawePlayer; import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator; import com.boydti.fawe.object.changeset.CFIChangeSet; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.util.formatting.text.TextComponent; import org.enginehub.piston.CommandManager; import org.enginehub.piston.exception.StopExecutionException; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java b/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java index 0c24cc27b..58eeb5825 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommands.java @@ -1,10 +1,7 @@ package com.boydti.fawe.command; -import static com.boydti.fawe.util.image.ImageUtil.load; - import com.boydti.fawe.Fawe; import com.boydti.fawe.FaweAPI; -import com.boydti.fawe.beta.IQueueExtent; import com.boydti.fawe.beta.SingleFilterBlock; import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.Commands; @@ -21,23 +18,11 @@ import com.boydti.fawe.util.TaskManager; import com.boydti.fawe.util.TextureUtil; import com.boydti.fawe.util.chat.Message; import com.boydti.fawe.util.image.ImageUtil; -import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; - -import java.nio.file.Path; -import java.util.function.Consumer; -import java.util.stream.IntStream; - -import com.sk89q.worldedit.extension.platform.binding.ProvideBindings; -import com.sk89q.worldedit.util.formatting.text.TextComponent; -import org.enginehub.piston.annotation.Command; -import org.enginehub.piston.exception.StopExecutionException; -import org.enginehub.piston.inject.InjectedValueAccess; import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.worldedit.EmptyClipboardException; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.command.MethodCommands; import com.sk89q.worldedit.command.util.CommandPermissions; import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; import com.sk89q.worldedit.entity.Player; @@ -45,6 +30,7 @@ import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.extension.platform.binding.ProvideBindings; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.function.mask.Mask; @@ -55,11 +41,20 @@ import com.sk89q.worldedit.registry.state.PropertyKey; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; +import org.enginehub.piston.annotation.Command; +import org.enginehub.piston.annotation.CommandContainer; +import org.enginehub.piston.annotation.param.Arg; +import org.enginehub.piston.annotation.param.Switch; +import org.enginehub.piston.exception.StopExecutionException; +import org.enginehub.piston.inject.InjectedValueAccess; + +import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; import java.io.ByteArrayOutputStream; @@ -67,6 +62,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.net.URL; +import java.nio.file.Path; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayDeque; @@ -74,17 +70,15 @@ import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.IntStream; -import javax.imageio.ImageIO; -import org.enginehub.piston.annotation.Command; -import org.enginehub.piston.annotation.CommandContainer; -import org.enginehub.piston.annotation.param.Arg; -import org.enginehub.piston.annotation.param.Switch; -import org.enginehub.piston.inject.InjectedValueAccess; + +import static com.boydti.fawe.util.image.ImageUtil.load; +import static com.sk89q.worldedit.command.MethodCommands.*; @CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class) -public class CFICommands extends MethodCommands { +public class CFICommands { private final WorldEdit worldEdit; @@ -104,18 +98,6 @@ public class CFICommands extends MethodCommands { return new File(path.toFile().getParentFile().getParentFile(), worldName + File.separator + "region"); } - @Command( - name = "", - desc = "CFI command" - ) - @CommandPermissions("worldedit.anvil.cfi") - public void cfi(FawePlayer fp, List args) { - CFISettings settings = getSettings(fp); - if (!settings.hasGenerator()) { - - } - } - @Command( name = "heightmap", desc = "Start CFI with a height map as a base" @@ -1046,7 +1028,6 @@ public class CFICommands extends MethodCommands { .send(fp); } - private static CFISettings assertSettings(FawePlayer fp) { CFISettings settings = getSettings(fp); if (!settings.hasGenerator()) { diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/CommandProcessor.java b/worldedit-core/src/main/java/com/boydti/fawe/command/CommandProcessor.java index 5db5d712b..348eff575 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/CommandProcessor.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/CommandProcessor.java @@ -70,7 +70,7 @@ public abstract class CommandProcessor implements CommandManager { public final O /* Need to recompile with FAWE-piston */ execute(InjectedValueAccess context, List args) { args = preprocess(context, args); if (args != null) { - I result = (I) (Object) parent.execute(context, args); + I result = (I) parent.execute(context, args); return process(context, args, result); // TODO NOT IMPLEMENTED (recompile piston) } else { return null; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/BrushSettings.java b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/BrushSettings.java index 5779d3d7a..46eda2246 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/BrushSettings.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/BrushSettings.java @@ -63,7 +63,7 @@ public class BrushSettings { if (constructor == null) { return new BrushSettings(); } - BrushSettings bs = (BrushSettings) manager.parseArgs(constructor); + BrushSettings bs = (BrushSettings) manager.parse(BrushSettings.class, constructor, player); bs.constructor.put(SettingType.BRUSH, constructor); if (settings.containsKey(SettingType.PERMISSIONS.name())) { bs.permissions.addAll((Collection) settings.get(SettingType.PERMISSIONS.name())); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/HeightBrush.java b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/HeightBrush.java index f28ecee41..1738219af 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/HeightBrush.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/HeightBrush.java @@ -11,6 +11,7 @@ import com.boydti.fawe.util.MathMan; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.command.tool.brush.Brush; +import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Masks; @@ -75,7 +76,7 @@ public class HeightBrush implements Brush { HeightMap map = getHeightMap(); map.setSize(size); - IQueueExtent queue = editSession.getQueue(); + Extent queue = editSession.getExtent(); // Optimized application of height map if (queue instanceof HeightMapMCAGenerator) { HeightMapMCAGenerator hmmg = (HeightMapMCAGenerator) queue; @@ -85,8 +86,6 @@ public class HeightBrush implements Brush { hmmg.getMetaData().setMeta("PRECISION_HEIGHT", metaHeight = new byte[hmmg.getArea()]); } - Vector3 origin = hmmg.getOrigin(); - int bx = position.getBlockX(); int bz = position.getBlockZ(); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/ScatterCommand.java b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/ScatterCommand.java index b75cc2d3f..cef385f41 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/ScatterCommand.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/ScatterCommand.java @@ -32,7 +32,7 @@ public class ScatterCommand extends ScatterBrush { String replaced = command.replace("{x}", position.getBlockX() + "") .replace("{y}", Integer.toString(position.getBlockY())) .replace("{z}", Integer.toString(position.getBlockZ())) - .replace("{world}", editSession.getQueue().getWorldName()) + .replace("{world}", editSession.getWorld().getName()) .replace("{size}", Integer.toString(radius)); FawePlayer fp = editSession.getPlayer(); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/change/MutableTileChange.java b/worldedit-core/src/main/java/com/boydti/fawe/object/change/MutableTileChange.java index 6d0dbec80..c6c02e9cb 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/change/MutableTileChange.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/change/MutableTileChange.java @@ -2,7 +2,6 @@ package com.boydti.fawe.object.change; import com.boydti.fawe.Fawe; import com.boydti.fawe.beta.IQueueExtent; -import com.boydti.fawe.object.HasIQueueExtent; import com.boydti.fawe.util.ExtentTraverser; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.IntTag; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/extent/NullExtent.java b/worldedit-core/src/main/java/com/boydti/fawe/object/extent/NullExtent.java index 157064697..680e521c3 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/extent/NullExtent.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/extent/NullExtent.java @@ -3,26 +3,34 @@ package com.boydti.fawe.object.extent; import com.boydti.fawe.config.BBC; import com.boydti.fawe.object.FaweLimit; import com.boydti.fawe.object.exception.FaweException; - +import com.sk89q.worldedit.MaxChangedBlocksException; 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; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.session.ClipboardHolder; +import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.World; 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.BlockType; import javax.annotation.Nullable; -import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.List; +import java.util.Set; public class NullExtent extends FaweRegionExtent { @@ -53,26 +61,27 @@ public class NullExtent extends FaweRegionExtent { @Override public BiomeType getBiome(final BlockVector2 arg0) { - if(reason != null) { - throw reason; - } - return null; + throw reason; + } + + @Override + public BiomeType getBiomeType(int x, int z) { + throw reason; } @Override public BlockState getBlock(final BlockVector3 arg0) { - if(reason != null) { - throw reason; - } - return null; + throw reason; } @Override public BlockState getBlock(int x, int y, int z) { - if(reason != null) { - throw reason; - } - return null; + throw reason; + } + + @Override + public BaseBlock getFullBlock(BlockVector3 position) { + throw reason; } @Override @@ -85,44 +94,73 @@ public class NullExtent extends FaweRegionExtent { @Override public boolean setBiome(final BlockVector2 arg0, final BiomeType arg1) { - if(reason != null) { - throw reason; - } - return false; + throw reason; + } + + @Override + public boolean setBiome(int x, int y, int z, BiomeType biome) { + throw reason; } @Override public boolean setBlock(final BlockVector3 arg0, final BlockStateHolder arg1) throws WorldEditException { - if(reason != null) { - throw reason; - } - return false; + throw reason; } @Override public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException { - if(reason != null) { - throw reason; - } - return false; + throw reason; + } + + @Nullable + @Override + public Entity createEntity(final Location arg0, final BaseEntity arg1) { + throw reason; } @Override - public Entity createEntity(final Location arg0, final BaseEntity arg1) { - if(reason != null) { - throw reason; - } - return null; + public boolean isQueueEnabled() { + throw reason; + } + + @Override + public void enableQueue() { + throw reason; + } + + @Override + public void disableQueue() { + throw reason; + } + + @Override + public boolean isWorld() { + throw reason; + } + + @Override + public boolean regenerateChunk(int x, int z, @Nullable BiomeType type, @Nullable Long seed) { + throw reason; + } + + @Override + public int getHighestTerrainBlock(int x, int z, int minY, int maxY) { + throw reason; + } + + @Override + public int getHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter) { + throw reason; } @Override public List getEntities() { - return new ArrayList<>(); + throw reason; } @Override public List getEntities(final Region arg0) { - return new ArrayList<>(); + throw reason; } @Override @@ -137,57 +175,157 @@ public class NullExtent extends FaweRegionExtent { @Override public boolean contains(int x, int z) { - if(reason != null) { - throw reason; - } - return false; + throw reason; } @Override public boolean contains(int x, int y, int z) { - if(reason != null) { - throw reason; - } - return false; + throw reason; } @Override public Collection getRegions() { - return Collections.emptyList(); + throw reason; } @Nullable @Override public Operation commit() { - return null; + throw reason; + } + + @Override + public boolean cancel() { + throw reason; + } + + @Override + public int getMaxY() { + throw reason; + } + + @Override + public BlockArrayClipboard lazyCopy(Region region) { + throw reason; + } + + @Override + public int countBlocks(Region region, Set searchBlocks) { + throw reason; + } + + @Override + public int countBlocks(Region region, Mask searchMask) { + throw reason; + } + + @Override + public > int setBlocks(Region region, B block) throws MaxChangedBlocksException { + throw reason; + } + + @Override + public int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException { + throw reason; + } + + @Override + public > int replaceBlocks(Region region, Set filter, B replacement) throws MaxChangedBlocksException { + throw reason; + } + + @Override + public int replaceBlocks(Region region, Set filter, Pattern pattern) throws MaxChangedBlocksException { + throw reason; + } + + @Override + public int replaceBlocks(Region region, Mask mask, Pattern pattern) throws MaxChangedBlocksException { + throw reason; + } + + @Override + public int center(Region region, Pattern pattern) throws MaxChangedBlocksException { + throw reason; + } + + @Override + public int setBlocks(Set vset, Pattern pattern) { + throw reason; + } + + @Override + public World getWorld() { + throw reason; } @Override public int getNearestSurfaceLayer(int x, int z, int y, int minY, int maxY) { - if(reason != null) { - throw reason; - } - return -1; + throw reason; + } + + @Override + public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, boolean ignoreAir) { + throw reason; } @Override public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY) { - if(reason != null) { - throw reason; - } - return -1; + throw reason; } @Override public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax) { - if(reason != null) { - throw reason; - } - return -1; + throw reason; } @Override - public Extent getExtent() { - return this; + public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, Mask mask) { + throw reason; + } + + @Override + public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, boolean ignoreAir) { + throw reason; + } + + @Override + public void addCaves(Region region) throws WorldEditException { + throw reason; + } + + @Override + public void generate(Region region, GenBase gen) throws WorldEditException { + throw reason; + } + + @Override + public void addSchems(Region region, Mask mask, List clipboards, int rarity, boolean rotate) throws WorldEditException { + throw reason; + } + + @Override + public void spawnResource(Region region, Resource gen, int rarity, int frequency) throws WorldEditException { + throw reason; + } + + @Override + public void addOre(Region region, Mask mask, Pattern material, int size, int frequency, int rarity, int minY, int maxY) throws WorldEditException { + throw reason; + } + + @Override + public void addOres(Region region, Mask mask) throws WorldEditException { + throw reason; + } + + @Override + public List> getBlockDistribution(Region region) { + throw reason; + } + + @Override + public List> getBlockDistributionWithData(Region region) { + throw reason; } } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/schematic/Schematic.java b/worldedit-core/src/main/java/com/boydti/fawe/object/schematic/Schematic.java index 71032c7bf..dda472c7a 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/schematic/Schematic.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/schematic/Schematic.java @@ -1,6 +1,5 @@ package com.boydti.fawe.object.schematic; -import com.boydti.fawe.object.HasIQueueExtent; import com.boydti.fawe.object.clipboard.FaweClipboard; import com.boydti.fawe.object.clipboard.ReadOnlyClipboard; import com.boydti.fawe.util.EditSessionBuilder; @@ -266,7 +265,7 @@ public class Schematic { extent.setBlock(xx, mutable.getBlockY() + rely, zz, block); return false; } - }, (HasIQueueExtent) (null)); + }); Operations.completeBlindly(visitor); } // Entity offset is the paste location subtract the clipboard origin (entity's location is already relative to the world origin) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/visitor/AboveVisitor.java b/worldedit-core/src/main/java/com/boydti/fawe/object/visitor/AboveVisitor.java index 025895840..6421601f6 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/visitor/AboveVisitor.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/visitor/AboveVisitor.java @@ -1,14 +1,10 @@ package com.boydti.fawe.object.visitor; -import com.boydti.fawe.object.HasIQueueExtent; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.visitor.RecursiveVisitor; import com.sk89q.worldedit.math.BlockVector3; -import java.util.Arrays; -import java.util.Collection; - import static com.google.common.base.Preconditions.checkNotNull; @@ -31,11 +27,11 @@ public class AboveVisitor extends RecursiveVisitor { * @param baseY the base Y */ public AboveVisitor(Mask mask, RegionFunction function, int baseY) { - this(mask, function, baseY, Integer.MAX_VALUE, null); + this(mask, function, baseY, Integer.MAX_VALUE); } - public AboveVisitor(Mask mask, RegionFunction function, int baseY, int depth, HasIQueueExtent hasIQueueExtent) { - super(mask, function, depth, hasIQueueExtent); + public AboveVisitor(Mask mask, RegionFunction function, int baseY, int depth) { + super(mask, function, depth); checkNotNull(mask); this.baseY = baseY; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/FaweLocalBlockQueue.java b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/FaweLocalBlockQueue.java index 3eed78a4e..8c066009c 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/FaweLocalBlockQueue.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/FaweLocalBlockQueue.java @@ -121,7 +121,7 @@ public class FaweLocalBlockQueue extends LocalBlockQueue { @Override public void refreshChunk(int x, int z) { - IMP.sendChunk(x, z); + IMP.sendChunk(x, z, 0); } @Override diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/DocumentationPrinter.java b/worldedit-core/src/main/java/com/boydti/fawe/util/DocumentationPrinter.java index 752c5cb98..d4537cbc3 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/DocumentationPrinter.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/DocumentationPrinter.java @@ -59,7 +59,6 @@ import java.lang.reflect.Method; import java.lang.reflect.Parameter; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.List; @SuppressWarnings("UseOfSystemOutOrSystemErr") diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java index b912d05b7..76293c3d4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java @@ -124,11 +124,13 @@ import org.enginehub.piston.annotation.param.Switch; import org.enginehub.piston.inject.InjectedValueAccess; import org.enginehub.piston.inject.Key; +import static com.sk89q.worldedit.command.MethodCommands.*; + /** * Commands to set brush shape. */ @CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class) -public class BrushCommands extends MethodCommands { +public class BrushCommands { private final WorldEdit worldEdit; @@ -298,8 +300,8 @@ public class BrushCommands extends MethodCommands { } @Command( - name = "sspl", - aliases = {"sspline", "surfacespline"}, + name = "surfacespline", + aliases = {"sspline", "sspl"}, desc = "Draws a spline (curved line) on the surface", descFooter = "Create a spline on the surface\n" + "Video: https://www.youtube.com/watch?v=zSN-2jJxXlM" @@ -549,8 +551,8 @@ public class BrushCommands extends MethodCommands { } @Command( - name = "scmd", - aliases = {"scattercmd", "scattercommand", "scommand"}, + name = "scattercommand", + aliases = {"scattercmd", "scmd", "scommand"}, desc = "Run commands at random points on a surface", descFooter = "Run commands at random points on a surface\n" + diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java index 34c453a20..015a93f38 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java @@ -48,18 +48,20 @@ 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)", - descFooter = "Masks determine if a block can be placed\n" + - " - Use [brackets] for arguments\n" + - " - Use , to OR multiple\n" + - " - Use & to AND multiple\n" + - "e.g. >[stone,dirt],#light[0][5],$jungle\n" + - "More Info: https://git.io/v9r4K" -) +//@Command(aliases = {"masks"}, +// desc = "Help for the various masks. [More Info](https://git.io/v9r4K)", +// descFooter = "Masks determine if a block can be placed\n" + +// " - Use [brackets] for arguments\n" + +// " - Use , to OR multiple\n" + +// " - Use & to AND multiple\n" + +// "e.g. >[stone,dirt],#light[0][5],$jungle\n" + +// "More Info: https://git.io/v9r4K" +//) public class MaskCommands extends MethodCommands { + private final WorldEdit worldEdit; + public MaskCommands(WorldEdit worldEdit) { - super(worldEdit); + this.worldEdit = worldEdit; } @Command( diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/MethodCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/MethodCommands.java index 8b3d4979d..ec6fcee5a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/MethodCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/MethodCommands.java @@ -15,7 +15,7 @@ import java.util.Optional; import static com.google.common.base.Preconditions.checkNotNull; public class MethodCommands { - public Command getCommand() { + public static Command getCommand() { try { StackTraceElement[] stack = new Exception().getStackTrace(); for (StackTraceElement elem : stack) { @@ -33,7 +33,7 @@ public class MethodCommands { return null; } - public String getArguments(InjectedValueAccess context) { + public static String getArguments(InjectedValueAccess context) { if (context == null) return null; Optional arguments = context.injectedValue(Key.of(Arguments.class)); if (arguments.isPresent()) { @@ -42,7 +42,7 @@ public class MethodCommands { return null; } - public String[] getPermissions(InjectedValueAccess context) { + public static String[] getPermissions(InjectedValueAccess context) { CommandPermissions cmdPerms = context.injectedValue(Key.of(CommandPermissions.class)).orElse(null); if (cmdPerms != null) { return cmdPerms.value(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java index 9dff58749..0ac7ae229 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java @@ -23,6 +23,9 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.boydti.fawe.Fawe; import com.boydti.fawe.command.AnvilCommands; +import com.boydti.fawe.command.AnvilCommandsRegistration; +import com.boydti.fawe.command.CFICommand; +import com.boydti.fawe.command.CFICommands; import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.FawePlayer; @@ -33,7 +36,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.TypeToken; import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; @@ -105,7 +107,6 @@ import com.sk89q.worldedit.extension.platform.binding.CommandBindings; import com.sk89q.worldedit.extension.platform.binding.ConsumeBindings; import com.sk89q.worldedit.extension.platform.binding.ProvideBindings; import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.internal.annotation.Selection; import com.sk89q.worldedit.internal.command.CommandArgParser; import com.sk89q.worldedit.internal.command.CommandLoggingHandler; import com.sk89q.worldedit.internal.command.CommandRegistrationHandler; @@ -161,7 +162,6 @@ import org.enginehub.piston.part.SubCommandPart; import org.enginehub.piston.suggestion.Suggestion; import org.enginehub.piston.util.HelpGenerator; import org.enginehub.piston.util.ValueProvider; -import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -250,9 +250,8 @@ public final class PlatformCommandManager { RegionFactoryConverter.register(commandManager); } - public void register(Object classWithMethods) { + public void registerAlwaysInjectedValues() { globalInjectedValues.injectValue(Key.of(InjectedValueAccess.class), Optional::of); - // TODO NOT IMPLEMENTED - register the following using a custom processor / annotations register(new AnnotatedBindings(worldEdit)); register(new CommandBindings(worldEdit)); register(new ConsumeBindings(worldEdit)); @@ -260,6 +259,10 @@ public final class PlatformCommandManager { register(new ProvideBindings(worldEdit)); } + public void register(Object classWithMethods) { + // TODO NOT IMPLEMENTED - register the following using a custom processor / annotations + } + private void registerSubCommands(String name, List aliases, String desc, CommandRegistration registration, CI instance) { registerSubCommands(name, aliases, desc, registration, instance, m -> {}); @@ -380,9 +383,14 @@ public final class PlatformCommandManager { new GeneralCommands(worldEdit) ); this.registration.register( - commandManager, - GenerationCommandsRegistration.builder(), - new GenerationCommands(worldEdit) + commandManager, + GenerationCommandsRegistration.builder(), + new GenerationCommands(worldEdit) + ); + this.registration.register( + new CFICommand(commandManager), + CFICommands.builder(), + new CFICommands(worldEdit) ); this.registration.register( commandManager, diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java index a276dbc24..79a2890c6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java @@ -22,7 +22,6 @@ package com.sk89q.worldedit.function.visitor; import static com.google.common.base.Preconditions.checkNotNull; import com.boydti.fawe.config.BBC; -import com.boydti.fawe.example.MappedIQueueExtent; import com.boydti.fawe.object.collection.BlockVectorSet; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; @@ -37,8 +36,6 @@ import java.util.Collection; import java.util.HashSet; import java.util.List; -import static com.google.common.base.Preconditions.checkNotNull; - /** * Performs a breadth-first search starting from points added with * {@link #visit(BlockVector3)}. The search continues diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java index 566029a30..1bafdb45d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.function.visitor; -import com.boydti.fawe.object.HasIQueueExtent; - import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; @@ -39,11 +37,11 @@ public class NonRisingVisitor extends RecursiveVisitor { * @param function the function */ public NonRisingVisitor(Mask mask, RegionFunction function) { - this(mask, function, Integer.MAX_VALUE, null); + this(mask, function, Integer.MAX_VALUE); } - public NonRisingVisitor(Mask mask, RegionFunction function, int depth, HasIQueueExtent hasIQueueExtent) { - super(mask, function, depth, hasIQueueExtent); + public NonRisingVisitor(Mask mask, RegionFunction function, int depth) { + super(mask, function, depth); setDirections( BlockVector3.UNIT_X, BlockVector3.UNIT_MINUS_X, diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Range.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Range.java index 2eaef0576..be4bdc773 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Range.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Range.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.internal.annotation; -import com.sk89q.worldedit.util.command.binding.PrimitiveBindings; - import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/SimpleWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/SimpleWorld.java index 3fefe238f..8a2a42c46 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/SimpleWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/SimpleWorld.java @@ -41,6 +41,7 @@ import com.sk89q.worldedit.world.weather.WeatherType; import com.sk89q.worldedit.world.weather.WeatherTypes; import javax.annotation.Nullable; import java.nio.file.Path; +import java.util.function.Supplier; /** * An abstract implementation of {@link World}. @@ -105,7 +106,7 @@ public interface SimpleWorld extends World { @Override default boolean queueBlockBreakEffect(Platform server, BlockVector3 position, BlockType blockType, double priority) { - Fawe.get().getQueueHandler().sync(() -> playEffect(position, 2001, blockType.getLegacyCombinedId() >> 4)); + Fawe.get().getQueueHandler().sync((Supplier) () -> playEffect(position, 2001, blockType.getLegacyCombinedId() >> 4)); return true; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java index 5161a8f9e..53d66d7a6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.world; +import com.boydti.fawe.object.extent.LightingExtent; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.WorldEditException; @@ -127,7 +128,13 @@ public interface World extends Extent { * @param position the position * @return the light level (0-15) */ - int getBlockLightLevel(BlockVector3 position); + default int getBlockLightLevel(BlockVector3 position) { + if (this instanceof LightingExtent) { + LightingExtent extent = (LightingExtent) this; + return extent.getBlockLight(position.getX(), position.getY(), position.getZ()); + } + return getBlock(position).getMaterial().getLightValue(); + } /** * Clear a chest's contents.