diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniperListener.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniperListener.java index eb0844e3f..da6e8eba5 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniperListener.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniperListener.java @@ -4,9 +4,27 @@ import com.boydti.fawe.config.BBC; import com.boydti.fawe.object.FawePlayer; import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.worldedit.extension.platform.PlatformCommandManager; -import com.sk89q.worldedit.util.command.parametric.ExceptionConverter; +import com.sk89q.worldedit.internal.command.exception.ExceptionConverter; import com.thevoxelbox.voxelsniper.api.command.VoxelCommand; -import com.thevoxelbox.voxelsniper.command.*; +import com.thevoxelbox.voxelsniper.command.VoxelBrushCommand; +import com.thevoxelbox.voxelsniper.command.VoxelBrushToolCommand; +import com.thevoxelbox.voxelsniper.command.VoxelCenterCommand; +import com.thevoxelbox.voxelsniper.command.VoxelChunkCommand; +import com.thevoxelbox.voxelsniper.command.VoxelDefaultCommand; +import com.thevoxelbox.voxelsniper.command.VoxelGoToCommand; +import com.thevoxelbox.voxelsniper.command.VoxelHeightCommand; +import com.thevoxelbox.voxelsniper.command.VoxelInkCommand; +import com.thevoxelbox.voxelsniper.command.VoxelInkReplaceCommand; +import com.thevoxelbox.voxelsniper.command.VoxelListCommand; +import com.thevoxelbox.voxelsniper.command.VoxelPaintCommand; +import com.thevoxelbox.voxelsniper.command.VoxelPerformerCommand; +import com.thevoxelbox.voxelsniper.command.VoxelReplaceCommand; +import com.thevoxelbox.voxelsniper.command.VoxelSniperCommand; +import com.thevoxelbox.voxelsniper.command.VoxelUndoCommand; +import com.thevoxelbox.voxelsniper.command.VoxelUndoUserCommand; +import com.thevoxelbox.voxelsniper.command.VoxelVoxelCommand; +import java.util.HashMap; +import java.util.Map; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -14,9 +32,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; -import java.util.HashMap; -import java.util.Map; - public class VoxelSniperListener implements Listener { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CloneStampBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CloneStampBrush.java index 189c0cbfc..334b7a5ed 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CloneStampBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CloneStampBrush.java @@ -17,7 +17,7 @@ public CloneStampBrush() { /** * The clone method is used to grab a snapshot of the selected area dictated blockPositionY targetBlock.x y z v.brushSize v.voxelHeight and v.cCen. *

- * x y z -- initial center of the selection v.brushSize -- the radius of the cylinder v.voxelHeight -- the heigth of the cylinder c.cCen -- the offset on + * x y z -- initial center of the selection v.brushSize -- the radius of the cylinder v.voxelHeight -- the height of the cylinder c.cCen -- the offset on * the Y axis of the selection ( bottom of the cylinder ) as blockPositionY: Bottom_Y = targetBlock.y + v.cCen; * * @param v Sniper Caller @@ -71,7 +71,7 @@ public CloneStampBrush() { } } } - v.sendMessage(ChatColor.GREEN + String.valueOf(this.clone.size()) + ChatColor.AQUA + " blocks copied sucessfully."); + v.sendMessage(ChatColor.GREEN + String.valueOf(this.clone.size()) + ChatColor.AQUA + " blocks copied successfully."); } @Override diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBrush.java index b2de663cd..d2e37f7e8 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBrush.java @@ -174,7 +174,7 @@ public class ErodeBrush extends Brush { vm.brushName(this.getName()); vm.size(); vm.custom(ChatColor.AQUA + "Erosion minimum exposed faces set to " + this.currentPreset.getErosionFaces()); - vm.custom(ChatColor.BLUE + "Fill minumum touching faces set to " + this.currentPreset.getFillFaces()); + vm.custom(ChatColor.BLUE + "Fill minimum touching faces set to " + this.currentPreset.getFillFaces()); vm.custom(ChatColor.DARK_BLUE + "Erosion recursion amount set to " + this.currentPreset.getErosionRecursion()); vm.custom(ChatColor.DARK_GREEN + "Fill recursion amount set to " + this.currentPreset.getFillRecursion()); } @@ -252,9 +252,9 @@ public class ErodeBrush extends Brush { /** * Generates a concat string of all options. * - * @param seperator Seperator for delimiting entries. + * @param separator Separator for delimiting entries. */ - public static String getValuesString(String seperator) { + public static String getValuesString(String separator) { StringBuilder valuesString = new StringBuilder(); boolean delimiterHelper = true; @@ -262,7 +262,7 @@ public class ErodeBrush extends Brush { if (delimiterHelper) { delimiterHelper = false; } else { - valuesString.append(seperator); + valuesString.append(separator); } valuesString.append(preset.name()); } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot3DBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot3DBrush.java index 008d32d9e..651401d7b 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot3DBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot3DBrush.java @@ -102,10 +102,10 @@ public class Rot3DBrush extends Brush { private void rotate(final SnipeData v) { // basically 1) make it a sphere we are rotating in, not a cylinder - // 2) do three rotations in a row, one in each dimension, unless some dimensions are set to zero or udnefined or whatever, then skip those. - // --> Why not utilize Sniper'world new oportunities and have arrow rotate all 3, powder rotate x, goldsisc y, otherdisc z. Or something like that. Or + // 2) do three rotations in a row, one in each dimension, unless some dimensions are set to zero or undefined or whatever, then skip those. + // --> Why not utilize Sniper'world new opportunities and have arrow rotate all 3, powder rotate x, goldsisc y, otherdisc z. Or something like that. Or // we - // could just use arrow and powder and just differenciate between left and right click that gis 4 different situations + // could just use arrow and powder and just differentiate between left and right click that gis 4 different situations // --> Well, there would be 7 different possibilities... X, Y, Z, XY, XZ, YZ, XYZ, and different numbers of parameters for each, so I think each having // and item is too confusing. How about this: arrow = rotate one dimension, based on the face you click, and takes 1 param... powder: rotates all three // at once, and takes 3 params. diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SnowConeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SnowConeBrush.java index a79a19339..0188ad5b3 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SnowConeBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SnowConeBrush.java @@ -27,8 +27,8 @@ public class SnowConeBrush extends Brush { } final int brushSizeDoubled = 2 * brushSize; - final int[][] snowcone = new int[brushSizeDoubled + 1][brushSizeDoubled + 1]; // Will hold block IDs - final int[][] snowconeData = new int[brushSizeDoubled + 1][brushSizeDoubled + 1]; // Will hold data values for snowcone + final int[][] snowCone = new int[brushSizeDoubled + 1][brushSizeDoubled + 1]; // Will hold block IDs + final int[][] snowConeData = new int[brushSizeDoubled + 1][brushSizeDoubled + 1]; // Will hold data values for snowCone final int[][] yOffset = new int[brushSizeDoubled + 1][brushSizeDoubled + 1]; // prime the arrays @@ -44,12 +44,12 @@ public class SnowConeBrush extends Brush { } } } - snowcone[x][z] = this.getBlockIdAt(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z); - snowconeData[x][z] = this.clampY(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z).getPropertyId(); + snowCone[x][z] = this.getBlockIdAt(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z); + snowConeData[x][z] = this.clampY(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z).getPropertyId(); } } - // figure out new snowheights + // figure out new snowHeights for (int x = 0; x <= brushSizeDoubled; x++) { final double xSquared = Math.pow(x - brushSize, 2); @@ -61,35 +61,35 @@ public class SnowConeBrush extends Brush { if (snowData >= 0) { // no funny business switch (snowData) { case 0: - if (BlockTypes.get(snowcone[x][z]).getMaterial().isAir()) { - snowcone[x][z] = BlockTypes.SNOW.getInternalId(); - snowconeData[x][z] = 0; + if (BlockTypes.get(snowCone[x][z]).getMaterial().isAir()) { + snowCone[x][z] = BlockTypes.SNOW.getInternalId(); + snowConeData[x][z] = 0; } break; - case 7: // Turn largest snowtile into snowblock - if (snowcone[x][z] == BlockTypes.SNOW.getInternalId()) { - snowcone[x][z] = BlockTypes.SNOW_BLOCK.getInternalId(); - snowconeData[x][z] = 0; + case 7: // Turn largest snowTile into snow block + if (snowCone[x][z] == BlockTypes.SNOW.getInternalId()) { + snowCone[x][z] = BlockTypes.SNOW_BLOCK.getInternalId(); + snowConeData[x][z] = 0; } break; - default: // Increase snowtile size, if smaller than target + default: // Increase snowTile size, if smaller than target - if (snowData > snowconeData[x][z]) { + if (snowData > snowConeData[x][z]) { BlockType blockType = - BlockTypes.get(snowcone[x][z]); + BlockTypes.get(snowCone[x][z]); if (blockType.getMaterial().isAir()) { - snowconeData[x][z] = snowData; - snowcone[x][z] = BlockTypes.SNOW.getInternalId(); + snowConeData[x][z] = snowData; + snowCone[x][z] = BlockTypes.SNOW.getInternalId(); - snowconeData[x][z] = snowData; + snowConeData[x][z] = snowData; } else if (blockType == BlockTypes.SNOW_BLOCK) { - snowconeData[x][z] = snowData; + snowConeData[x][z] = snowData; } - } else if (yOffset[x][z] > 0 && snowcone[x][z] == BlockTypes.SNOW.getInternalId()) { - snowconeData[x][z]++; - if (snowconeData[x][z] == 7) { - snowconeData[x][z] = 0; - snowcone[x][z] = BlockTypes.SNOW_BLOCK.getInternalId(); + } else if (yOffset[x][z] > 0 && snowCone[x][z] == BlockTypes.SNOW.getInternalId()) { + snowConeData[x][z]++; + if (snowConeData[x][z] == 7) { + snowConeData[x][z] = 0; + snowCone[x][z] = BlockTypes.SNOW_BLOCK.getInternalId(); } } break; @@ -103,11 +103,11 @@ public class SnowConeBrush extends Brush { for (int x = 0; x <= brushSizeDoubled; x++) { for (int z = 0; z <= brushSizeDoubled; z++) { - if (this.getBlockIdAt(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z) != snowcone[x][z] || this.clampY(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z).getPropertyId() != snowconeData[x][z]) { + if (this.getBlockIdAt(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z) != snowCone[x][z] || this.clampY(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z).getPropertyId() != snowConeData[x][z]) { undo.put(this.clampY(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z)); } - this.setBlockIdAt(blockPositionZ - brushSize + z, blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], snowcone[x][z]); - this.clampY(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z).setPropertyId(snowconeData[x][z]); + this.setBlockIdAt(blockPositionZ - brushSize + z, blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], snowCone[x][z]); + this.clampY(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z).setPropertyId(snowConeData[x][z]); } } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PerformerE.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PerformerE.java index 273d9a3df..76faef954 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PerformerE.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PerformerE.java @@ -22,11 +22,11 @@ import java.util.logging.Logger; * * new extra: n = no undo * - * The main benefit of this system is that it provides the least possible number of characters in the paramaters + * The main benefit of this system is that it provides the least possible number of characters in the parameters * while guaranteeing that all sensible combinations will be made. Additionally, the names will be VERY consistent * * EX Old System: /b b isrcup (use /v, /vi, /vr and /vir, update graphics and no physics) - * EX New System: /b b ccup (two characters shorter, good because snipers have been complaing about keystrokes) + * EX New System: /b b ccup (two characters shorter, good because snipers have been complaining about keystrokes) * */ diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelBrushCommand.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelBrushCommand.java index 6762d723d..4cf614640 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelBrushCommand.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelBrushCommand.java @@ -43,12 +43,12 @@ public class VoxelBrushCommand extends VoxelCommand { Bukkit.getPluginManager().callEvent(event); snipeData.getVoxelMessage().size(); return true; - } catch (NumberFormatException ingored) { + } catch (NumberFormatException ignored) { } Class brush = plugin.getBrushManager().getBrushForHandle(args[0]); if (brush != null) { - IBrush orignalBrush = sniper.getBrush(currentToolId); + IBrush originalBrush = sniper.getBrush(currentToolId); sniper.setBrush(currentToolId, brush); if (args.length > 1) { @@ -63,7 +63,7 @@ public class VoxelBrushCommand extends VoxelCommand { return true; } } - SniperBrushChangedEvent event = new SniperBrushChangedEvent(sniper, currentToolId, orignalBrush, sniper.getBrush(currentToolId)); + SniperBrushChangedEvent event = new SniperBrushChangedEvent(sniper, currentToolId, originalBrush, sniper.getBrush(currentToolId)); sniper.displayInfo(); return true; } else { diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java index 435366446..feecc0ce5 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java @@ -458,10 +458,10 @@ public class FaweBukkit implements IFawe, Listener { e.printStackTrace(); } } - final Plugin preciousstonesPlugin = Bukkit.getServer().getPluginManager().getPlugin("PreciousStones"); - if (preciousstonesPlugin != null && preciousstonesPlugin.isEnabled()) { + final Plugin preciousStonesPlugin = Bukkit.getServer().getPluginManager().getPlugin("PreciousStones"); + if (preciousStonesPlugin != null && preciousStonesPlugin.isEnabled()) { try { - managers.add(new PreciousStonesFeature(preciousstonesPlugin, this)); + managers.add(new PreciousStonesFeature(preciousStonesPlugin, this)); Fawe.debug("Plugin 'PreciousStones' found. Using it now."); } catch (final Throwable e) { e.printStackTrace(); diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/beta/BukkitQueue.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/beta/BukkitQueue.java index 4cb3896bf..e23c09c0f 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/beta/BukkitQueue.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/beta/BukkitQueue.java @@ -284,7 +284,7 @@ public class BukkitQueue extends SimpleCharQueueExtent { } final int[] blockToPalette = FaweCache.BLOCK_TO_PALETTE.get(); final int[] paletteToBlock = FaweCache.PALETTE_TO_BLOCK.get(); - final long[] blockstates = FaweCache.BLOCK_STATES.get(); + final long[] blockStates = FaweCache.BLOCK_STATES.get(); final int[] blocksCopy = FaweCache.SECTION_BLOCKS.get(); try { int num_palette = 0; @@ -317,9 +317,9 @@ public class BukkitQueue extends SimpleCharQueueExtent { final int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6; if (num_palette == 1) { - for (int i = 0; i < blockBitArrayEnd; i++) blockstates[i] = 0; + for (int i = 0; i < blockBitArrayEnd; i++) blockStates[i] = 0; } else { - final BitArray4096 bitArray = new BitArray4096(blockstates, bitsPerEntry); + final BitArray4096 bitArray = new BitArray4096(blockStates, bitsPerEntry); bitArray.fromRaw(blocksCopy); } @@ -327,7 +327,7 @@ public class BukkitQueue extends SimpleCharQueueExtent { final DataPaletteBlock dataPaletteBlocks = section.getBlocks(); // private DataPalette h; // protected DataBits a; - final long[] bits = Arrays.copyOfRange(blockstates, 0, blockBitArrayEnd); + final long[] bits = Arrays.copyOfRange(blockStates, 0, blockBitArrayEnd); final DataBits nmsBits = new DataBits(bitsPerEntry, 4096, bits); final DataPalette palette; // palette = new DataPaletteHash<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d, GameProfileSerializer::a); diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitTextAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitTextAdapter.java index 1ff04325f..fba2c2b1e 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitTextAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitTextAdapter.java @@ -25,24 +25,24 @@ import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; public class BukkitTextAdapter { - public static String reduceToText(Component component) { - StringBuilder text = new StringBuilder(); - appendTextTo(text, component); - return text.toString(); - } - - private static void appendTextTo(StringBuilder builder, Component component) { - if (component instanceof TextComponent) { - builder.append(((TextComponent) component).content()); - } else if (component instanceof TranslatableComponent) { - builder.append(((TranslatableComponent) component).key()); + public static String reduceToText(Component component) { + StringBuilder text = new StringBuilder(); + appendTextTo(text, component); + return text.toString(); } - for (Component child : component.children()) { - appendTextTo(builder, child); - } - } - private BukkitTextAdapter() { - } + private static void appendTextTo(StringBuilder builder, Component component) { + if (component instanceof TextComponent) { + builder.append(((TextComponent) component).content()); + } else if (component instanceof TranslatableComponent) { + builder.append(((TranslatableComponent) component).key()); + } + for (Component child : component.children()) { + appendTextTo(builder, child); + } + } + + private BukkitTextAdapter() { + } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index f04aac89f..b22974a4f 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -199,9 +199,9 @@ public class BukkitWorld extends AbstractWorld { // We have to restore the block if it was outside if (!region.contains(pt)) { - editSession.setBlock(pt, history[index]); + editSession.smartSetBlock(pt, history[index]); } else { // Otherwise fool with history - editSession.setBlock().add(new BlockChange(pt, history[index], editSession.getFullBlock(pt))); + editSession.getChangeSet().add(new BlockChange(pt, history[index], editSession.getFullBlock(pt))); } } } @@ -420,8 +420,21 @@ public class BukkitWorld extends AbstractWorld { getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally(); } + private static volatile boolean hasWarnedImplError = false; + @Override public com.sk89q.worldedit.world.block.BlockState getBlock(BlockVector3 position) { + BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); + if (adapter != null) { + try { + return adapter.getBlock(BukkitAdapter.adapt(getWorld(), position)).toImmutableState(); + } catch (Exception e) { + if (!hasWarnedImplError) { + hasWarnedImplError = true; + logger.warn("Unable to retrieve block via impl adapter", e); + } + } + } Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()); return BukkitAdapter.adapt(bukkitBlock.getBlockData()); } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java index e3634a178..7097a9e8c 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java @@ -21,7 +21,6 @@ package com.sk89q.worldedit.bukkit; -import com.bekvon.bukkit.residence.commands.command; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; @@ -45,7 +44,6 @@ import org.enginehub.piston.inject.MapBackedValueStore; import java.util.Iterator; import java.util.Optional; -import java.util.function.Predicate; /** * Handles all events thrown in relation to a Player @@ -75,8 +73,9 @@ public class WorldEditListener implements Listener { @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onPlayerCommandSend(PlayerCommandSendEvent event) { - InjectedValueStore store = null; + // Command processing used to show up in timings CommandManager commandManager = plugin.getWorldEdit().getPlatformManager().getPlatformCommandManager().getCommandManager(); + InjectedValueStore store = null; Iterator iter = event.getCommands().iterator(); while (iter.hasNext()) { String name = iter.next(); diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index 2178212ee..dcc606800 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -217,7 +217,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter public void setupRegistries() { // Biome for (Biome biome : Biome.values()) { - BiomeType.REGISTRY.register("minecraft:" + biome.name().toLowerCase(Locale.ROOT), new BiomeType("minecraft:" + biome.name().toLowerCase(Locale.ROOT))); + String lowerCaseBiomeName = biome.name().toLowerCase(Locale.ROOT); + BiomeType.REGISTRY.register("minecraft:" + lowerCaseBiomeName, new BiomeType("minecraft:" + lowerCaseBiomeName)); } // Block & Item for (Material material : Material.values()) { @@ -254,7 +255,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter for (org.bukkit.entity.EntityType entityType : org.bukkit.entity.EntityType.values()) { String mcid = entityType.getName(); if (mcid != null) { - EntityType.REGISTRY.register("minecraft:" + mcid.toLowerCase(Locale.ROOT), new EntityType("minecraft:" + mcid.toLowerCase(Locale.ROOT))); + String lowerCaseMcId = mcid.toLowerCase(Locale.ROOT); + EntityType.REGISTRY.register("minecraft:" + lowerCaseMcId, new EntityType("minecraft:" + lowerCaseMcId)); } } } @@ -426,7 +428,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter // code of WorldEdit expects it String[] split = new String[args.length + 1]; System.arraycopy(args, 0, split, 1, args.length); - split[0] = cmd.getName(); + split[0] = "/" + cmd.getName(); CommandEvent event = new CommandEvent(wrapCommandSender(sender), Joiner.on(" ").join(split)); getWorldEdit().getEventBus().post(event); @@ -441,11 +443,12 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter // code of WorldEdit expects it String[] split = new String[args.length + 1]; System.arraycopy(args, 0, split, 1, args.length); - split[0] = cmd.getName(); + split[0] = "/" + cmd.getName(); - CommandSuggestionEvent event = new CommandSuggestionEvent(wrapCommandSender(sender), Joiner.on(" ").join(split)); + String arguments = Joiner.on(" ").join(split); + CommandSuggestionEvent event = new CommandSuggestionEvent(wrapCommandSender(sender), arguments); getWorldEdit().getEventBus().post(event); - return event.getSuggestions(); + return CommandUtil.fixSuggestions(arguments, event.getSuggestions()); } */ @@ -581,13 +584,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter CommandSuggestionEvent suggestEvent = new CommandSuggestionEvent(wrapCommandSender(event.getSender()), event.getBuffer()); getWorldEdit().getEventBus().post(suggestEvent); - List suggestions = suggestEvent.getSuggestions(); - if (suggestions != null && !suggestions.isEmpty()) { - event.setCompletions(suggestions); - event.setHandled(true); - } - //event.setCompletions(CommandUtil.fixSuggestions(event.getBuffer(), suggestEvent.getSuggestions())); - //event.setHandled(true); + + event.setCompletions(CommandUtil.fixSuggestions(event.getBuffer(), suggestEvent.getSuggestions())); + event.setHandled(true); } } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java index fb59444cd..085c88226 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java @@ -54,7 +54,7 @@ public class BukkitImplLoader { "** will be blank, and so on. There will be no support for entity\n" + "** and block property-related functions.\n" + "**\n" + - "** Please see http://wiki.sk89q.com/wiki/WorldEdit/Bukkit_adapters\n" + + "** Please see https://worldedit.rtfd.io/en/latest/faq/#bukkit-adapters\n" + "**********************************************\n"; /** diff --git a/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.java b/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.java index 470061db4..7742f5dda 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/FaweCache.java @@ -112,11 +112,11 @@ public final class FaweCache implements Trimable { */ public int[] paletteToBlock; - public int blockstatesLength; + public int blockStatesLength; /** - * Reusable buffer array, MUST check blockstatesLength for actual length + * Reusable buffer array, MUST check blockStatesLength for actual length */ - public long[] blockstates; + public long[] blockStates; } private static final IterableThreadLocal PALETTE_CACHE = new IterableThreadLocal() { @@ -149,7 +149,7 @@ public final class FaweCache implements Trimable { private static Palette toPalette(int layerOffset, int[] blocksInts, char[] blocksChars) { int[] blockToPalette = BLOCK_TO_PALETTE.get(); int[] paletteToBlock = PALETTE_TO_BLOCK.get(); - long[] blockstates = BLOCK_STATES.get(); + long[] blockStates = BLOCK_STATES.get(); int[] blocksCopy = SECTION_BLOCKS.get(); int blockIndexStart = layerOffset << 12; @@ -193,10 +193,10 @@ public final class FaweCache implements Trimable { int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6; if (num_palette == 1) { // Set a value, because minecraft needs it for some reason - blockstates[0] = 0; + blockStates[0] = 0; blockBitArrayEnd = 1; } else { - BitArray4096 bitArray = new BitArray4096(blockstates, bitsPerEntry); + BitArray4096 bitArray = new BitArray4096(blockStates, bitsPerEntry); bitArray.fromRaw(blocksCopy); } @@ -205,8 +205,8 @@ public final class FaweCache implements Trimable { palette.paletteToBlockLength = num_palette; palette.paletteToBlock = paletteToBlock; - palette.blockstatesLength = blockBitArrayEnd; - palette.blockstates = blockstates; + palette.blockStatesLength = blockBitArrayEnd; + palette.blockStates = blockStates; return palette; } catch (Throwable e) { diff --git a/worldedit-core/src/main/java/com/boydti/fawe/FaweVersion.java b/worldedit-core/src/main/java/com/boydti/fawe/FaweVersion.java index 04c334ef3..2fd3d242f 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/FaweVersion.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/FaweVersion.java @@ -24,8 +24,8 @@ public class FaweVersion { public static FaweVersion tryParse(String version, String commit, String date) { try { return new FaweVersion(version, commit, date); - } catch (Exception ignore) { - ignore.printStackTrace(); + } catch (Exception exception) { + exception.printStackTrace(); return new FaweVersion(0, 0, 0, 0, 0); } } @@ -41,4 +41,4 @@ public class FaweVersion { public boolean isNewer(FaweVersion other) { return other.build < this.build; } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/AnvilCommands.java b/worldedit-core/src/main/java/com/boydti/fawe/command/AnvilCommands.java index 4635b546c..3288c5e02 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/AnvilCommands.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/AnvilCommands.java @@ -1,37 +1,25 @@ package com.boydti.fawe.command; -import com.boydti.fawe.FaweAPI; -import com.boydti.fawe.config.BBC; -import com.boydti.fawe.object.FawePlayer; -import com.boydti.fawe.object.RegionWrapper; -import com.boydti.fawe.object.RunnableVal4; -import com.boydti.fawe.object.changeset.AnvilHistory; -import com.boydti.fawe.object.clipboard.remap.ClipboardRemapper; -import com.boydti.fawe.object.mask.FaweBlockMatcher; -import com.boydti.fawe.util.MainUtil; +import static com.google.common.base.Preconditions.checkNotNull; + import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.command.util.CommandPermissions; +import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.annotation.Selection; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BiomeType; +import java.io.IOException; 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 java.io.IOException; -import java.io.RandomAccessFile; - -import static com.google.common.base.Preconditions.checkNotNull; - -@Command(aliases = {"/anvil"}, desc = "Manipulate billions of blocks: [More Info](https://github.com/boy0001/FastAsyncWorldedit/wiki/Anvil-API)") +@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class) public class AnvilCommands { /** @@ -247,11 +235,10 @@ public class AnvilCommands { desc = "Trim chunks in a Plot World", descFooter = "Unclaimed chunks will be deleted\n" + - "Unmodified chunks will be deleted\n" + - "Use -v to also delete unvisited chunks\n" + "Unmodified chunks will be deleted\n" ) @CommandPermissions("worldedit.anvil.trimallplots") - public void trimAllPlots(Player player, @Switch(name='v', desc = "TODO") boolean deleteUnvisited) throws WorldEditException { + public void trimAllPlots(Player player, @Switch(name='v', desc = "Delete unvisited chunks") boolean deleteUnvisited) throws WorldEditException { // String folder = player.getWorld().getName(); TODO NOT IMPLEMENTED // int visitTime = deleteUnvisited ? 1 : -1; // PlotTrimFilter filter = new PlotTrimFilter(player.getWorld(), 0, visitTime, 600000); @@ -266,7 +253,6 @@ public class AnvilCommands { @Command( name = "deletebiomechunks", - desc = "Delete chunks matching a specific biome" ) @CommandPermissions("worldedit.anvil.trimallair") @@ -280,7 +266,6 @@ public class AnvilCommands { @Command( name = "trimallair", - desc = "Trim all air in the world" ) @CommandPermissions("worldedit.anvil.trimallair") @@ -310,7 +295,7 @@ public class AnvilCommands { name = "replaceallpattern", aliases = {"reap", "repallpat"}, desc = "Replace all blocks in the selection with another" -) + ) @CommandPermissions("worldedit.anvil.replaceall") public void replaceAllPattern(Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, final Pattern to, @Switch(name='d', desc = "TODO") boolean useData, @Switch(name='m', desc = "TODO") boolean useMap) throws WorldEditException { // MCAFilterCounter filter; TODO NOT IMPLEMENTED @@ -339,7 +324,7 @@ public class AnvilCommands { @Command( name = "countall", desc = "Count all blocks in a world" -) + ) @CommandPermissions("worldedit.anvil.countall") public void countAll(Player player, EditSession editSession, String folder, String arg, @Switch(name='d', desc = "TODO") boolean useData) throws WorldEditException { // Set searchBlocks = worldEdit.getBlocks(player, arg, true); @@ -413,7 +398,7 @@ public class AnvilCommands { @Command( name = "count", desc = "Count blocks in a selection" -) + ) @CommandPermissions("worldedit.anvil.count") public void count(Player player, EditSession editSession, @Selection Region selection, String arg, @Switch(name='d', desc = "TODO") boolean useData) throws WorldEditException { // Set searchBlocks = worldEdit.getBlocks(player, arg, true); TODO NOT IMPLEMENTED @@ -621,8 +606,7 @@ public class AnvilCommands { @Command( name = "paste", desc = "Paste chunks from your anvil clipboard", - descFooter = - "Paste the chunks from your anvil clipboard.\n" + + descFooter = "Paste the chunks from your anvil clipboard.\n" + "The -c flag will align the paste to the chunks." ) @CommandPermissions("worldedit.anvil.pastechunks") 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 bd5e3a657..0c24cc27b 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,14 +1,16 @@ 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; -import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator; import com.boydti.fawe.object.FawePlayer; import com.boydti.fawe.object.RunnableVal; +import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator; import com.boydti.fawe.object.clipboard.MultiClipboardHolder; import com.boydti.fawe.util.CleanTextureUtil; import com.boydti.fawe.util.FilteredTextureUtil; @@ -25,17 +27,19 @@ 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.command.util.CommandPermissions; 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; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; @@ -51,14 +55,11 @@ 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 org.enginehub.piston.annotation.param.Switch; 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 javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; import java.io.ByteArrayOutputStream; @@ -74,10 +75,13 @@ import java.util.HashSet; import java.util.List; import java.util.Set; 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 static com.boydti.fawe.util.image.ImageUtil.load; +import org.enginehub.piston.annotation.param.Switch; +import org.enginehub.piston.inject.InjectedValueAccess; @CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class) public class CFICommands extends MethodCommands { @@ -117,11 +121,11 @@ public class CFICommands extends MethodCommands { desc = "Start CFI with a height map as a base" ) @CommandPermissions("worldedit.anvil.cfi") - public void heightmap(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Arg(name = "yscale", desc = "double", def = "1") double yscale) { + public void heightmap(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "yscale", desc = "double", def = "1") double yscale) { if (yscale != 0) { int[] raw = ((DataBufferInt) image.load().getRaster().getDataBuffer()).getData(); int[] table = IntStream.range(0, 256).map(i -> Math.min(255, (int) (i * yscale))) - .toArray(); + .toArray(); for (int i = 0; i < raw.length; i++) { int color = raw[i]; int red = table[(color >> 16) & 0xFF]; @@ -139,7 +143,7 @@ public class CFICommands extends MethodCommands { desc = "Start CFI with an empty map as a base" ) @CommandPermissions("worldedit.anvil.cfi") - public void heightmap(FawePlayer fp, int width, int length) { + public void heightMap(FawePlayer fp, int width, int length) { HeightMapMCAGenerator generator = new HeightMapMCAGenerator(width, length, getFolder(generateName())); setup(generator, fp); } @@ -169,9 +173,9 @@ public class CFICommands extends MethodCommands { Message msg; if (settings.getGenerator().getImageViewer() != null) { msg = msg("CFI supports using brushes during creation").newline() - .text(" - Place the map on a wall of item frames").newline() - .text(" - Use any WorldEdit brush on the item frames").newline() - .text(" - Example: ").text("Video").linkTip("https://goo.gl/PK4DMG").newline(); + .text(" - Place the map on a wall of item frames").newline() + .text(" - Use any WorldEdit brush on the item frames").newline() + .text(" - Example: ").text("Video").linkTip("https://goo.gl/PK4DMG").newline(); } else { msg = msg("This is not supported with your platform/version").newline(); } @@ -250,7 +254,7 @@ public class CFICommands extends MethodCommands { desc = "Set the floor and main block" ) @CommandPermissions("worldedit.anvil.cfi") - public void column(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ + public void column(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); if (image != null) { gen.setColumn(load(image), pattern, !disableWhiteOnly); @@ -269,14 +273,14 @@ public class CFICommands extends MethodCommands { desc = "Set the floor (default: grass)" ) @CommandPermissions("worldedit.anvil.cfi") - public void floorCmd(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ + public void floorCmd(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ floor(fp, pattern, image, mask, disableWhiteOnly); fp.sendMessage("Set floor!"); assertSettings(fp).resetComponent(); component(fp); } - private void floor(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) { + private void floor(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) { HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); if (image != null) { gen.setFloor(load(image), pattern, !disableWhiteOnly); @@ -292,14 +296,14 @@ public class CFICommands extends MethodCommands { desc = "Set the main block (default: stone)" ) @CommandPermissions("worldedit.anvil.cfi") - public void mainCmd(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ + public void mainCmd(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ main(fp, pattern, image, mask, disableWhiteOnly); fp.sendMessage("Set main!"); assertSettings(fp).resetComponent(); component(fp); } - public void main(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ + public void main(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); if (image != null) { gen.setMain(load(image), pattern, !disableWhiteOnly); @@ -318,7 +322,7 @@ public class CFICommands extends MethodCommands { "e.g. Tallgrass" ) @CommandPermissions("worldedit.anvil.cfi") - public void overlay(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ + public void overlay(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); if (image != null) { gen.setOverlay(load(image), pattern, !disableWhiteOnly); @@ -340,13 +344,13 @@ public class CFICommands extends MethodCommands { " - A good value for radius and iterations would be 1 8." ) @CommandPermissions("worldedit.anvil.cfi") - public void smoothCmd(FawePlayer fp, int radius, int iterations, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ + public void smoothCmd(FawePlayer fp, int radius, int iterations, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ smooth(fp, radius, iterations, image, mask, disableWhiteOnly); assertSettings(fp).resetComponent(); component(fp); } - private void smooth(FawePlayer fp, int radius, int iterations, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ + private void smooth(FawePlayer fp, int radius, int iterations, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); if (image != null) { gen.smooth(load(image), !disableWhiteOnly, radius, iterations); @@ -360,7 +364,7 @@ public class CFICommands extends MethodCommands { desc = "Create some snow" ) @CommandPermissions("worldedit.anvil.cfi") - public void snow(FawePlayer fp, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ + public void snow(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); floor(fp, BlockTypes.SNOW.getDefaultState().with(PropertyKey.LAYERS, 7), image, mask, disableWhiteOnly); main(fp, BlockTypes.SNOW_BLOCK, image, mask, disableWhiteOnly); @@ -395,16 +399,16 @@ public class CFICommands extends MethodCommands { public void paletteblocks(FawePlayer fp, Player player, LocalSession session, @Arg(name = "arg", desc = "String", def = "") String arg) throws EmptyClipboardException, InputParseException, FileNotFoundException { if (arg == null) { msg("What blocks do you want to color with?").newline() - .text("[All]").cmdTip(alias() + " PaletteBlocks *").text(" - All available blocks") - .newline() - .text("[Clipboard]").cmdTip(alias() + " PaletteBlocks #clipboard").text(" - The blocks in your clipboard") - .newline() - .text("[List]").suggestTip(alias() + " PaletteBlocks stone,gravel").text(" - A comma separated list of blocks") - .newline() - .text("[Complexity]").cmdTip(alias() + " Complexity").text(" - Block textures within a complexity range") - .newline() - .text("< [Back]").cmdTip(alias() + " " + Commands.getAlias(CFICommands.class, "coloring")) - .send(fp); + .text("[All]").cmdTip(alias() + " PaletteBlocks *").text(" - All available blocks") + .newline() + .text("[Clipboard]").cmdTip(alias() + " PaletteBlocks #clipboard").text(" - The blocks in your clipboard") + .newline() + .text("[List]").suggestTip(alias() + " PaletteBlocks stone,gravel").text(" - A comma separated list of blocks") + .newline() + .text("[Complexity]").cmdTip(alias() + " Complexity").text(" - Block textures within a complexity range") + .newline() + .text("< [Back]").cmdTip(alias() + " " + Commands.getAlias(CFICommands.class, "coloring")) + .send(fp); return; } HeightMapMCAGenerator generator = assertSettings(fp).getGenerator(); @@ -503,7 +507,7 @@ public class CFICommands extends MethodCommands { " - The distance is the spacing between each schematic" ) @CommandPermissions("worldedit.anvil.cfi") - public void schem(FawePlayer fp, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri imageMask, Mask mask, String schematic, int rarity, int distance, boolean rotate)throws IOException, WorldEditException { + public void schem(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, Mask mask, String schematic, int rarity, int distance, boolean rotate)throws IOException, WorldEditException { HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); World world = fp.getWorld(); @@ -529,7 +533,7 @@ public class CFICommands extends MethodCommands { " - If a mask is used, the biome will be set anywhere the mask applies" ) @CommandPermissions("worldedit.anvil.cfi") - public void biome(FawePlayer fp, BiomeType biome, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ + public void biome(FawePlayer fp, BiomeType biome, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){ HeightMapMCAGenerator gen = assertSettings(fp).getGenerator(); if (image != null) { gen.setBiome(load(image), biome, !disableWhiteOnly); @@ -696,7 +700,7 @@ public class CFICommands extends MethodCommands { ) // ![79,174,212,5:3,5:4,18,161,20] @CommandPermissions("worldedit.anvil.cfi") - public void glass(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException { + public void glass(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException { CFISettings settings = assertSettings(fp); settings.getGenerator().setColorWithGlass(load(image)); msg("Set color with glass!").send(fp); @@ -713,7 +717,7 @@ public class CFICommands extends MethodCommands { "The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance" ) @CommandPermissions("worldedit.anvil.cfi") - public void color(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException { + public void color(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException { CFISettings settings = assertSettings(fp); HeightMapMCAGenerator gen = settings.getGenerator(); if (imageMask != null) { @@ -737,7 +741,7 @@ public class CFICommands extends MethodCommands { "The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance" ) @CommandPermissions("worldedit.anvil.cfi") - public void blockbiome(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException { + public void blockbiome(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException { CFISettings settings = assertSettings(fp); settings.getGenerator().setBlockAndBiomeColor(load(image), mask, load(imageMask), !disableWhiteOnly); msg("Set color with blocks and biomes!").send(fp); @@ -753,7 +757,7 @@ public class CFICommands extends MethodCommands { " - If you changed the block to something other than grass you will not see anything." ) @CommandPermissions("worldedit.anvil.cfi") - public void biomecolor(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException { + public void biomecolor(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException { CFISettings settings = assertSettings(fp); settings.getGenerator().setBiomeColor(load(image)); msg("Set color with biomes!").send(fp); @@ -810,14 +814,14 @@ public class CFICommands extends MethodCommands { int biomePriority = gen.getBiomePriority(); Message msg = msg(">> Current Settings <<").newline() - .text("Randomization ").text("[" + (Boolean.toString(rand).toUpperCase()) + "]").cmdTip(alias() + " randomization " + (!rand)) - .newline() - .text("Mask ").text("[" + mask + "]").cmdTip(alias() + " mask") - .newline() - .text("Blocks ").text("[" + blocks + "]").tooltip(blockList).command(alias() + " paletteBlocks") - .newline() - .text("BiomePriority ").text("[" + biomePriority + "]").cmdTip(alias() + " biomepriority") - .newline(); + .text("Randomization ").text("[" + (Boolean.toString(rand).toUpperCase()) + "]").cmdTip(alias() + " randomization " + (!rand)) + .newline() + .text("Mask ").text("[" + mask + "]").cmdTip(alias() + " mask") + .newline() + .text("Blocks ").text("[" + blocks + "]").tooltip(blockList).command(alias() + " paletteBlocks") + .newline() + .text("BiomePriority ").text("[" + biomePriority + "]").cmdTip(alias() + " biomepriority") + .newline(); if (settings.image != null) { StringBuilder colorArgs = new StringBuilder(); @@ -833,16 +837,16 @@ public class CFICommands extends MethodCommands { } msg.text("Image: ") - .text("[" + settings.imageArg + "]").cmdTip(alias() + " " + Commands.getAlias(CFICommands.class, "image")) - .newline().newline() - .text("&cLet's Color: ") - .cmdOptions(alias() + " ", colorArgs.toString(), "Biomes", "Blocks", "BlockAndBiome", "Glass") - .newline(); + .text("[" + settings.imageArg + "]").cmdTip(alias() + " " + Commands.getAlias(CFICommands.class, "image")) + .newline().newline() + .text("&cLet's Color: ") + .cmdOptions(alias() + " ", colorArgs.toString(), "Biomes", "Blocks", "BlockAndBiome", "Glass") + .newline(); } else { msg.newline().text("You can color a world using an image like ") - .text("[This]").linkTip("http://i.imgur.com/vJYinIU.jpg").newline() - .text("&cYou MUST provide an image: ") - .text("[None]").cmdTip(alias() + " " + Commands.getAlias(Command.class, "image")).newline(); + .text("[This]").linkTip("http://i.imgur.com/vJYinIU.jpg").newline() + .text("&cYou MUST provide an image: ") + .text("[None]").cmdTip(alias() + " " + Commands.getAlias(Command.class, "image")).newline(); } msg.text("< [Back]").cmdTip(alias()).send(fp); } @@ -852,7 +856,7 @@ public class CFICommands extends MethodCommands { desc = "Select a mask" ) @CommandPermissions("worldedit.anvil.cfi") - public void mask(FawePlayer fp, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly, InjectedValueAccess context){ + public void mask(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly, InjectedValueAccess context){ CFISettings settings = assertSettings(fp); String[] split = getArguments(context).split(" "); int index = 2; @@ -917,7 +921,7 @@ public class CFICommands extends MethodCommands { desc = "Select an image" ) @CommandPermissions("worldedit.anvil.cfi") - public void image(FawePlayer fp, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, InjectedValueAccess context)throws CommandException { + public void image(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, InjectedValueAccess context)throws CommandException { CFISettings settings = getSettings(fp); String[] split = getArguments(context).split(" "); int index = 2; @@ -928,10 +932,10 @@ public class CFICommands extends MethodCommands { StringBuilder cmd = new StringBuilder(alias() + " image "); if (image == null) { msg("Please provide an image:").newline() - .text("From a URL: ").text("[Click Here]").suggestTip(cmd + "http://") - .newline() - .text("From a file: ").text("[Click Here]").suggestTip(cmd + "file://") - .send(fp); + .text("From a URL: ").text("[Click Here]").suggestTip(cmd + "http://") + .newline() + .text("From a file: ").text("[Click Here]").suggestTip(cmd + "file://") + .send(fp); } else { if (settings.hasGenerator()) { coloring(fp); @@ -953,10 +957,10 @@ public class CFICommands extends MethodCommands { settings.popMessages(fp); settings.setCategory(this::populate); msg("What would you like to populate?").newline() - .text("(You will need to type these commands)").newline() - .cmdOptions(alias() + " ", "", "Ores", "Ore", "Caves", "Schematics", "Smooth") - .newline().text("< [Back]").cmdTip(alias()) - .send(fp); + .text("(You will need to type these commands)").newline() + .cmdOptions(alias() + " ", "", "Ores", "Ore", "Caves", "Schematics", "Smooth") + .newline().text("< [Back]").cmdTip(alias()) + .send(fp); } @Command( @@ -997,49 +1001,49 @@ public class CFICommands extends MethodCommands { String snow = Commands.getAlias(CFICommands.class, "snow"); Message msg = msg(">> Current Settings <<").newline() - .text("Mask ").text("[" + mask + "]").cmdTip(alias() + " mask") - .newline() - .text("Pattern ").text("[" + pattern + "]").cmdTip(alias() + " pattern") - .newline() - .newline() - .text(">> Components <<") - .newline() - .text("[Height]").suggestTip(alias() + " " + alias("height") + " 120").text(" - Terrain height for whole map") - .newline() - .text("[WaterHeight]").suggestTip(alias() + " " + alias("waterheight") + " 60").text(" - Sea level for whole map") - .newline() - .text("[FloorThickness]").suggestTip(alias() + " " + alias("floorthickness") + " 60").text(" - Floor thickness of entire map") - .newline() - .text("[WorldThickness]").suggestTip(alias() + " " + alias("worldthickness") + " 60").text(" - World thickness of entire map") - .newline() - .text("[Snow]").suggestTip(alias() + " " + alias("snow") + maskArgs).text(" - Set snow in the masked areas") - .newline(); + .text("Mask ").text("[" + mask + "]").cmdTip(alias() + " mask") + .newline() + .text("Pattern ").text("[" + pattern + "]").cmdTip(alias() + " pattern") + .newline() + .newline() + .text(">> Components <<") + .newline() + .text("[Height]").suggestTip(alias() + " " + alias("height") + " 120").text(" - Terrain height for whole map") + .newline() + .text("[WaterHeight]").suggestTip(alias() + " " + alias("waterheight") + " 60").text(" - Sea level for whole map") + .newline() + .text("[FloorThickness]").suggestTip(alias() + " " + alias("floorthickness") + " 60").text(" - Floor thickness of entire map") + .newline() + .text("[WorldThickness]").suggestTip(alias() + " " + alias("worldthickness") + " 60").text(" - World thickness of entire map") + .newline() + .text("[Snow]").suggestTip(alias() + " " + alias("snow") + maskArgs).text(" - Set snow in the masked areas") + .newline(); if (pattern != null) { String disabled = "You must specify a pattern"; msg - .text("[&cWaterId]").tooltip(disabled).newline() - .text("[&cBedrockId]").tooltip(disabled).newline() - .text("[&cFloor]").tooltip(disabled).newline() - .text("[&cMain]").tooltip(disabled).newline() - .text("[&cColumn]").tooltip(disabled).newline() - .text("[&cOverlay]").tooltip(disabled).newline(); + .text("[&cWaterId]").tooltip(disabled).newline() + .text("[&cBedrockId]").tooltip(disabled).newline() + .text("[&cFloor]").tooltip(disabled).newline() + .text("[&cMain]").tooltip(disabled).newline() + .text("[&cColumn]").tooltip(disabled).newline() + .text("[&cOverlay]").tooltip(disabled).newline(); } else { StringBuilder compArgs = new StringBuilder(); compArgs.append(" " + settings.patternArg + maskArgs); msg - .text("[WaterId]").cmdTip(alias() + " waterId " + pattern).text(" - Water id for whole map").newline() - .text("[BedrockId]").cmdTip(alias() + " baseId " + pattern).text(" - Bedrock id for whole map").newline() - .text("[Floor]").cmdTip(alias() + " floor" + compArgs).text(" - Set the floor in the masked areas").newline() - .text("[Main]").cmdTip(alias() + " main" + compArgs).text(" - Set the main block in the masked areas").newline() - .text("[Column]").cmdTip(alias() + " column" + compArgs).text(" - Set the columns in the masked areas").newline() - .text("[Overlay]").cmdTip(alias() + " overlay" + compArgs).text(" - Set the overlay in the masked areas").newline(); + .text("[WaterId]").cmdTip(alias() + " waterId " + pattern).text(" - Water id for whole map").newline() + .text("[BedrockId]").cmdTip(alias() + " baseId " + pattern).text(" - Bedrock id for whole map").newline() + .text("[Floor]").cmdTip(alias() + " floor" + compArgs).text(" - Set the floor in the masked areas").newline() + .text("[Main]").cmdTip(alias() + " main" + compArgs).text(" - Set the main block in the masked areas").newline() + .text("[Column]").cmdTip(alias() + " column" + compArgs).text(" - Set the columns in the masked areas").newline() + .text("[Overlay]").cmdTip(alias() + " overlay" + compArgs).text(" - Set the overlay in the masked areas").newline(); } msg.newline() - .text("< [Back]").cmdTip(alias()) - .send(fp); + .text("< [Back]").cmdTip(alias()) + .send(fp); } @@ -1062,10 +1066,10 @@ public class CFICommands extends MethodCommands { private HeightMapMCAGenerator generator; - protected FawePrimitiveBinding.ImageUri image; + protected ProvideBindings.ImageUri image; protected String imageArg; protected Mask mask; - protected FawePrimitiveBinding.ImageUri imageMask; + protected ProvideBindings.ImageUri imageMask; protected boolean whiteOnly = true; protected String maskArg; protected String imageMaskArg; @@ -1094,11 +1098,11 @@ public class CFICommands extends MethodCommands { this.maskArg = arg; } - public void setImage(FawePrimitiveBinding.ImageUri image, String arg) { + public void setImage(ProvideBindings.ImageUri image, String arg) { this.image = image; } - public void setImageMask(FawePrimitiveBinding.ImageUri imageMask, String arg) { + public void setImageMask(ProvideBindings.ImageUri imageMask, String arg) { this.imageMask = imageMask; this.imageMaskArg = arg; } @@ -1188,8 +1192,8 @@ public class CFICommands extends MethodCommands { protected static Message msg(String text) { return new Message().newline() - .text(BBC.getPrefix()) - .text(text); + .text(BBC.getPrefix()) + .text(text); } protected static void mainMenu(FawePlayer fp) { diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/FaweBinding.java b/worldedit-core/src/main/java/com/boydti/fawe/command/FaweBinding.java index 2973feb5e..89d3d9321 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/FaweBinding.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/FaweBinding.java @@ -1,16 +1,16 @@ -package com.boydti.fawe.command; - -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.util.command.parametric.BindingHelper; - -public class FaweBinding extends BindingHelper { - private final WorldEdit worldEdit; - - public FaweBinding(WorldEdit worldEdit) { - this.worldEdit = worldEdit; - } - - public WorldEdit getWorldEdit() { - return worldEdit; - } -} +//package com.boydti.fawe.command; +// +//import com.sk89q.worldedit.WorldEdit; +//import com.sk89q.worldedit.util.command.parametric.BindingHelper; +// +//public class FaweBinding extends BindingHelper { +// private final WorldEdit worldEdit; +// +// public FaweBinding(WorldEdit worldEdit) { +// this.worldEdit = worldEdit; +// } +// +// public WorldEdit getWorldEdit() { +// return worldEdit; +// } +//} diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/MaskBinding.java b/worldedit-core/src/main/java/com/boydti/fawe/command/MaskBinding.java index 5711c43a4..64f119ee8 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/MaskBinding.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/MaskBinding.java @@ -1,29 +1,29 @@ -package com.boydti.fawe.command; - -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.util.command.parametric.ParameterData; -import com.sk89q.worldedit.world.block.BlockTypes; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class MaskBinding extends FaweBinding { - private final WorldEdit worldEdit; - - public MaskBinding(WorldEdit worldEdit) { - super(worldEdit); - this.worldEdit = worldEdit; - } - - @Override - public List getSuggestions(ParameterData parameter, String prefix) { - if (prefix.isEmpty()) { - return Stream.concat(Stream.of("#"), BlockTypes.getNameSpaces().stream().map(n -> n + ":")).collect(Collectors.toList()); - } - return super.getSuggestions(parameter, prefix); - } -} \ No newline at end of file +//package com.boydti.fawe.command; +// +//import com.sk89q.worldedit.WorldEdit; +//import com.sk89q.worldedit.util.command.parametric.ParameterData; +//import com.sk89q.worldedit.world.block.BlockTypes; +// +//import java.util.ArrayList; +//import java.util.HashSet; +//import java.util.List; +//import java.util.Set; +//import java.util.stream.Collectors; +//import java.util.stream.Stream; +// +//public class MaskBinding extends FaweBinding { +// private final WorldEdit worldEdit; +// +// public MaskBinding(WorldEdit worldEdit) { +// super(worldEdit); +// this.worldEdit = worldEdit; +// } +// +// @Override +// public List getSuggestions(ParameterData parameter, String prefix) { +// if (prefix.isEmpty()) { +// return Stream.concat(Stream.of("#"), BlockTypes.getNameSpaces().stream().map(n -> n + ":")).collect(Collectors.toList()); +// } +// return super.getSuggestions(parameter, prefix); +// } +//} diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/PatternBinding.java b/worldedit-core/src/main/java/com/boydti/fawe/command/PatternBinding.java index fb05ed40a..d3fbc7897 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/PatternBinding.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/PatternBinding.java @@ -1,26 +1,26 @@ -package com.boydti.fawe.command; - -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.util.command.parametric.ParameterData; -import com.sk89q.worldedit.world.block.BlockTypes; - -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class PatternBinding extends FaweBinding { - private final WorldEdit worldEdit; - - public PatternBinding(WorldEdit worldEdit) { - super(worldEdit); - this.worldEdit = worldEdit; - } - - @Override - public List getSuggestions(ParameterData parameter, String prefix) { - if (prefix.isEmpty()) { - return Stream.concat(Stream.of("#"), BlockTypes.getNameSpaces().stream()).collect(Collectors.toList()); - } - return super.getSuggestions(parameter, prefix); - } -} +//package com.boydti.fawe.command; +// +//import com.sk89q.worldedit.WorldEdit; +//import com.sk89q.worldedit.util.command.parametric.ParameterData; +//import com.sk89q.worldedit.world.block.BlockTypes; +// +//import java.util.List; +//import java.util.stream.Collectors; +//import java.util.stream.Stream; +// +//public class PatternBinding extends FaweBinding { +// private final WorldEdit worldEdit; +// +// public PatternBinding(WorldEdit worldEdit) { +// super(worldEdit); +// this.worldEdit = worldEdit; +// } +// +// @Override +// public List getSuggestions(ParameterData parameter, String prefix) { +// if (prefix.isEmpty()) { +// return Stream.concat(Stream.of("#"), BlockTypes.getNameSpaces().stream()).collect(Collectors.toList()); +// } +// return super.getSuggestions(parameter, prefix); +// } +//} diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/PlotLoader.java b/worldedit-core/src/main/java/com/boydti/fawe/command/PlotLoader.java index 5974a3bac..4ce6f4507 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/PlotLoader.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/PlotLoader.java @@ -21,8 +21,10 @@ import java.io.IOException; import java.util.function.Function; public class PlotLoader { + @Deprecated - public static void autoClaimFromDatabase(PlotPlayer player, PlotArea area, PlotId start, com.github.intellectualsites.plotsquared.plot.object.RunnableVal whenDone) { + public static void autoClaimFromDatabase(PlotPlayer player, PlotArea area, PlotId start, + com.github.intellectualsites.plotsquared.plot.object.RunnableVal whenDone) { final Plot plot = area.getNextFreePlot(player, start); if (plot == null) { whenDone.run(null); @@ -30,15 +32,12 @@ public class PlotLoader { } whenDone.value = plot; plot.owner = player.getUUID(); - DBFunc.createPlotSafe(plot, whenDone, new Runnable() { - @Override - public void run() { - autoClaimFromDatabase(player, area, plot.getId(), whenDone); - } - }); + DBFunc.createPlotSafe(plot, whenDone, + () -> autoClaimFromDatabase(player, area, plot.getId(), whenDone)); } - public void load(FawePlayer fp, CFICommands.CFISettings settings, Function createTask) throws IOException { + public void load(FawePlayer fp, CFICommands.CFISettings settings, + Function createTask) throws IOException { PlotAreaManager manager = PlotSquared.get().getPlotAreaManager(); if (manager instanceof SinglePlotAreaManager) { SinglePlotAreaManager sManager = (SinglePlotAreaManager) manager; @@ -49,7 +48,8 @@ public class PlotLoader { Plot plot = TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Plot o) { - int currentPlots = Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(area.worldname); + int currentPlots = Settings.Limit.GLOBAL ? player.getPlotCount() + : player.getPlotCount(area.worldname); int diff = player.getAllowedPlots() - currentPlots; if (diff < 1) { Captions.CANT_CLAIM_MORE_PLOTS_NUM.send(player, -diff); @@ -73,12 +73,7 @@ public class PlotLoader { File folder = CFICommands.getFolder(plot.getWorldName()); Boolean result = createTask.apply(folder); if (result == Boolean.TRUE) { - TaskManager.IMP.sync(new RunnableVal() { - @Override - public void run(Object value) { - plot.teleportPlayer(player); - } - }); + TaskManager.IMP.sync(() -> plot.teleportPlayer(player)); } return; } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/Rollback.java b/worldedit-core/src/main/java/com/boydti/fawe/command/Rollback.java index a0a0a57ce..2d5dd1892 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/Rollback.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/Rollback.java @@ -25,7 +25,7 @@ public class Rollback extends FaweCommand { } @Override - public boolean execute(final FawePlayer player, final String... args) { + public boolean execute(FawePlayer player, String... args) { if (!Settings.IMP.HISTORY.USE_DATABASE) { BBC.SETTING_DISABLE.send(player, "history.use-database (Import with /frb #import )"); return false; @@ -50,12 +50,11 @@ public class Rollback extends FaweCommand { } World world = player.getWorld(); switch (args[0]) { - default: { + default: BBC.COMMAND_SYNTAX.send(player, "/frb info u: r: t: