From 031332081612c8bb648a60a213fca96627a92801 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 20 Jun 2019 20:05:18 -0400 Subject: [PATCH] As Jesse would say... * --- .../voxelsniper/RangeBlockHelper.java | 2 +- .../thevoxelbox/voxelsniper/SnipeData.java | 11 +- .../com/thevoxelbox/voxelsniper/Undo.java | 2 +- .../voxelsniper/VoxelSniperListener.java | 4 +- .../voxelsniper/brush/BallBrush.java | 6 +- .../voxelsniper/brush/BiomeBrush.java | 3 +- .../voxelsniper/brush/BlendBallBrush.java | 4 +- .../voxelsniper/brush/BlendBrushBase.java | 19 - .../voxelsniper/brush/BlendVoxelBrush.java | 2 +- .../voxelsniper/brush/BlobBrush.java | 5 +- .../voxelsniper/brush/BlockResetBrush.java | 3 - .../brush/BlockResetSurfaceBrush.java | 27 +- .../thevoxelbox/voxelsniper/brush/Brush.java | 3 +- .../voxelsniper/brush/CanyonBrush.java | 8 +- .../brush/CanyonSelectionBrush.java | 4 +- .../brush/CheckerVoxelDiscBrush.java | 7 - .../voxelsniper/brush/CleanSnowBrush.java | 3 - .../voxelsniper/brush/CloneStampBrush.java | 8 +- .../voxelsniper/brush/CometBrush.java | 5 - .../voxelsniper/brush/CopyPastaBrush.java | 12 +- .../voxelsniper/brush/CylinderBrush.java | 3 - .../voxelsniper/brush/DiscBrush.java | 3 - .../voxelsniper/brush/DiscFaceBrush.java | 3 - .../voxelsniper/brush/DomeBrush.java | 4 - .../voxelsniper/brush/DrainBrush.java | 5 - .../voxelsniper/brush/EllipseBrush.java | 5 +- .../voxelsniper/brush/EllipsoidBrush.java | 2 +- .../voxelsniper/brush/EntityBrush.java | 4 +- .../voxelsniper/brush/EntityRemovalBrush.java | 4 +- .../voxelsniper/brush/EraserBrush.java | 4 +- .../voxelsniper/brush/ErodeBlendBrush.java | 86 +- .../voxelsniper/brush/ErodeBrush.java | 40 +- .../voxelsniper/brush/ExtrudeBrush.java | 5 +- .../voxelsniper/brush/FillDownBrush.java | 8 +- .../voxelsniper/brush/FlatOceanBrush.java | 4 - .../voxelsniper/brush/GenerateTreeBrush.java | 12 +- .../voxelsniper/brush/HeatRayBrush.java | 28 +- .../voxelsniper/brush/JaggedLineBrush.java | 4 - .../voxelsniper/brush/JockeyBrush.java | 10 +- .../voxelsniper/brush/LightningBrush.java | 3 - .../voxelsniper/brush/LineBrush.java | 5 - .../voxelsniper/brush/OceanBrush.java | 4 +- .../voxelsniper/brush/OverlayBrush.java | 33 +- .../voxelsniper/brush/PaintingBrush.java | 1 + .../voxelsniper/brush/PullBrush.java | 8 +- .../voxelsniper/brush/PunishBrush.java | 8 - .../voxelsniper/brush/RandomErodeBrush.java | 35 +- .../voxelsniper/brush/RingBrush.java | 4 +- .../voxelsniper/brush/Rot2DBrush.java | 4 +- .../voxelsniper/brush/Rot2DvertBrush.java | 20 +- .../voxelsniper/brush/RulerBrush.java | 3 - .../voxelsniper/brush/ScannerBrush.java | 3 - .../voxelsniper/brush/SetBrush.java | 4 +- .../brush/SetRedstoneFlipBrush.java | 4 +- .../brush/SetRedstoneRotateBrush.java | 4 +- .../voxelsniper/brush/ShellBallBrush.java | 3 +- .../voxelsniper/brush/ShellSetBrush.java | 4 +- .../voxelsniper/brush/ShellVoxelBrush.java | 3 +- .../voxelsniper/brush/SignOverwriteBrush.java | 9 +- .../voxelsniper/brush/SnipeBrush.java | 4 +- .../voxelsniper/brush/SnowConeBrush.java | 8 +- .../brush/SpiralStaircaseBrush.java | 34 +- .../voxelsniper/brush/SplatterBallBrush.java | 9 +- .../voxelsniper/brush/SplatterDiscBrush.java | 7 +- .../brush/SplatterOverlayBrush.java | 15 +- .../voxelsniper/brush/SplatterVoxelBrush.java | 9 +- .../brush/SplatterVoxelDiscBrush.java | 7 +- .../voxelsniper/brush/SplineBrush.java | 8 +- .../voxelsniper/brush/StampBrush.java | 40 +- .../voxelsniper/brush/StencilBrush.java | 102 ++- .../voxelsniper/brush/StencilListBrush.java | 29 +- .../brush/ThreePointCircleBrush.java | 15 +- .../voxelsniper/brush/TreeSnipeBrush.java | 4 - .../voxelsniper/brush/TriangleBrush.java | 3 - .../voxelsniper/brush/UnderlayBrush.java | 8 - .../voxelsniper/brush/VoltMeterBrush.java | 4 - .../voxelsniper/brush/VoxelBrush.java | 4 +- .../voxelsniper/brush/VoxelDiscBrush.java | 4 +- .../voxelsniper/brush/VoxelDiscFaceBrush.java | 4 +- .../voxelsniper/brush/WarpBrush.java | 47 +- .../brush/perform/PerformBrush.java | 46 +- .../voxelsniper/brush/perform/Performer.java | 7 +- .../voxelsniper/brush/perform/PerformerE.java | 4 +- .../voxelsniper/brush/perform/pCombo.java | 6 +- .../brush/perform/pComboCombo.java | 7 +- .../brush/perform/pComboComboNoPhys.java | 9 +- .../voxelsniper/brush/perform/pComboInk.java | 7 +- .../brush/perform/pComboInkNoPhys.java | 7 +- .../voxelsniper/brush/perform/pComboMat.java | 7 +- .../brush/perform/pComboMatNoPhys.java | 7 +- .../brush/perform/pComboNoPhys.java | 7 +- .../brush/perform/pComboNoUndo.java | 9 +- .../brush/perform/pExcludeCombo.java | 7 +- .../brush/perform/pExcludeInk.java | 7 +- .../brush/perform/pExcludeMat.java | 7 +- .../brush/perform/pIncludeCombo.java | 7 +- .../brush/perform/pIncludeInk.java | 7 +- .../brush/perform/pIncludeMat.java | 7 +- .../voxelsniper/brush/perform/pInk.java | 7 +- .../voxelsniper/brush/perform/pInkCombo.java | 7 +- .../brush/perform/pInkComboNoPhys.java | 9 +- .../voxelsniper/brush/perform/pInkInk.java | 7 +- .../brush/perform/pInkInkNoPhys.java | 9 +- .../voxelsniper/brush/perform/pInkMat.java | 7 +- .../brush/perform/pInkMatNoPhys.java | 9 +- .../voxelsniper/brush/perform/pInkNoPhys.java | 7 +- .../voxelsniper/brush/perform/pInkNoUndo.java | 9 +- .../voxelsniper/brush/perform/pMatCombo.java | 7 +- .../brush/perform/pMatComboNophys.java | 7 +- .../voxelsniper/brush/perform/pMatInk.java | 7 +- .../brush/perform/pMatInkNoPhys.java | 7 +- .../voxelsniper/brush/perform/pMatMat.java | 7 +- .../brush/perform/pMatMatNoPhys.java | 7 +- .../voxelsniper/brush/perform/pMaterial.java | 7 +- .../brush/perform/pMaterialNoPhys.java | 7 +- .../voxelsniper/brush/perform/pNoUndo.java | 9 +- .../voxelsniper/brush/perform/vPerformer.java | 7 +- .../command/VoxelVoxelCommand.java | 2 +- .../event/SniperBrushChangedEvent.java | 2 +- .../event/SniperMaterialChangedEvent.java | 2 +- .../voxelsniper/util/BlockWrapper.java | 7 - .../com/boydti/fawe/bukkit/FaweBukkit.java | 3 +- .../fawe/bukkit/regions/FactionsFeature.java | 5 +- .../fawe/bukkit/v1_13/BukkitChunk_1_13.java | 2 +- .../fawe/bukkit/v1_13/BukkitQueue_1_13.java | 110 +-- .../fawe/bukkit/wrapper/AsyncBlock.java | 86 +- .../src/main/java/com/boydti/fawe/Fawe.java | 2 +- .../com/boydti/fawe/jnbt/anvil/MCAChunk.java | 13 +- .../jnbt/anvil/filters/RemoveLayerFilter.java | 1 - .../com/boydti/fawe/object/FawePlayer.java | 38 +- .../java/com/boydti/fawe/util/ArrayUtil.java | 27 - .../java/com/boydti/fawe/util/ColorUtil.java | 9 +- .../java/com/boydti/fawe/util/FaweTimer.java | 9 +- .../boydti/fawe/util/FilteredTextureUtil.java | 6 +- .../com/boydti/fawe/util/ImgurUtility.java | 10 +- .../java/com/boydti/fawe/util/MainUtil.java | 195 ++--- .../boydti/fawe/util/RandomTextureUtil.java | 10 +- .../com/boydti/fawe/util/ReflectionUtils.java | 69 +- .../boydti/fawe/util/ShapeInterpolator.java | 738 ------------------ .../com/boydti/fawe/util/TextureUtil.java | 450 ++++++----- .../com/sk89q/worldedit/CuboidClipboard.java | 7 +- .../extension/platform/CommandManager.java | 8 +- .../worldedit/function/mask/BlockMask.java | 36 +- .../sk89q/worldedit/regions/CuboidRegion.java | 83 +- .../util/command/parametric/BindingMap.java | 9 - .../worldedit/world/block/BlockTypes.java | 12 +- 146 files changed, 906 insertions(+), 2252 deletions(-) delete mode 100644 worldedit-core/src/main/java/com/boydti/fawe/util/ArrayUtil.java delete mode 100644 worldedit-core/src/main/java/com/boydti/fawe/util/ShapeInterpolator.java diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/RangeBlockHelper.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/RangeBlockHelper.java index 84ae57b85..26778a69c 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/RangeBlockHelper.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/RangeBlockHelper.java @@ -1,4 +1,4 @@ -/** +/* This file is part of VoxelSniper, licensed under the MIT License (MIT). Copyright (c) The VoxelBox diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/SnipeData.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/SnipeData.java index 0c7bbe9e9..ef4d2e9ba 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/SnipeData.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/SnipeData.java @@ -1,4 +1,4 @@ -/** +/* This file is part of VoxelSniper, licensed under the MIT License (MIT). Copyright (c) The VoxelBox @@ -33,9 +33,6 @@ import org.bukkit.ChatColor; import org.bukkit.World; import org.bukkit.entity.Player; -/** - * @author Piotr - */ public class SnipeData { public static final int DEFAULT_REPLACE_DATA_VALUE = 0; @@ -87,9 +84,6 @@ public class SnipeData { private Pattern pattern; private String patternInfo; - /** - * @param vs - */ public SnipeData(final Sniper vs) { this.owner = vs; } @@ -219,9 +213,6 @@ public class SnipeData { this.voxelList = new VoxelList(); } - /** - * @param message - */ public final void sendMessage(final String message) { this.owner.getPlayer().sendMessage(message); } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/Undo.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/Undo.java index a999f7bf4..7f6f7a2f4 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/Undo.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/Undo.java @@ -1,4 +1,4 @@ -/** +/* This file is part of VoxelSniper, licensed under the MIT License (MIT). Copyright (c) The VoxelBox diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniperListener.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniperListener.java index ac8dc7eb7..3beaf5384 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniperListener.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniperListener.java @@ -17,9 +17,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import java.util.HashMap; import java.util.Map; -/** - * @author Voxel - */ + public class VoxelSniperListener implements Listener { private static final String SNIPER_PERMISSION = "voxelsniper.sniper"; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BallBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BallBrush.java index c772aa85d..ab0be7e1f 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BallBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BallBrush.java @@ -8,6 +8,7 @@ import org.bukkit.ChatColor; /** * A brush that creates a solid ball. + * * @author Piotr */ public class BallBrush extends PerformBrush { @@ -15,10 +16,7 @@ public class BallBrush extends PerformBrush { public static final int TRUE_CIRCLE_OFF_VALUE = 0; private double trueCircle = 0; - /** - * - */ - public BallBrush() { +public BallBrush() { this.setName("Ball"); } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BiomeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BiomeBrush.java index 1f448c893..4fe7eaedf 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BiomeBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BiomeBrush.java @@ -9,6 +9,7 @@ import org.bukkit.block.Block; public class BiomeBrush extends Brush { private Biome selectedBiome = Biome.PLAINS; + public BiomeBrush() { this.setName("Biome (/b biome [Biome Name])"); } @@ -72,7 +73,7 @@ public class BiomeBrush extends Brush { } availableBiomes.append(ChatColor.RED + ", " + ChatColor.DARK_GREEN) - .append(biome.name()); + .append(biome.name()); } v.sendMessage(ChatColor.DARK_BLUE + "Available biomes: " + availableBiomes); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendBallBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendBallBrush.java index 36bad9a4e..76f4a0bc6 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendBallBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendBallBrush.java @@ -35,7 +35,7 @@ public class BlendBallBrush extends BlendBrushBase { for (int x = 0; x <= brushSizeDoubled; x++) { for (int y = 0; y <= brushSizeDoubled; y++) { System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0, - brushSizeDoubled + 1); + brushSizeDoubled + 1); } } @@ -85,7 +85,7 @@ public class BlendBallBrush extends BlendBrushBase { final Undo undo = new Undo(); final double rSquared = Math.pow(brushSize + 1, 2); - // Make the changes + // Make the changes for (int x = brushSizeDoubled; x >= 0; x--) { final double xSquared = Math.pow(x - brushSize - 1, 2); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendBrushBase.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendBrushBase.java index eccd8caac..b0c0a0fa8 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendBrushBase.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendBrushBase.java @@ -4,17 +4,10 @@ import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.SnipeData; import org.bukkit.ChatColor; -/** - * @author Monofraps - */ -@SuppressWarnings("deprecation") public abstract class BlendBrushBase extends Brush { protected boolean excludeAir = true; protected boolean excludeWater = true; - /** - * @param v - */ protected abstract void blend(final SnipeData v); @Override @@ -47,30 +40,18 @@ public abstract class BlendBrushBase extends Brush { } } - /** - * @return - */ protected final boolean isExcludeAir() { return excludeAir; } - /** - * @param excludeAir - */ protected final void setExcludeAir(boolean excludeAir) { this.excludeAir = excludeAir; } - /** - * @return - */ protected final boolean isExcludeWater() { return excludeWater; } - /** - * @param excludeWater - */ protected final void setExcludeWater(boolean excludeWater) { this.excludeWater = excludeWater; } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendVoxelBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendVoxelBrush.java index ac85a497f..89f5946bd 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendVoxelBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlendVoxelBrush.java @@ -35,7 +35,7 @@ public class BlendVoxelBrush extends BlendBrushBase { for (int x = 0; x <= brushSizeDoubled; x++) { for (int y = 0; y <= brushSizeDoubled; y++) { System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0, - brushSizeDoubled + 1); + brushSizeDoubled + 1); } } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlobBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlobBrush.java index 985431b73..7b6a3675d 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlobBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlobBrush.java @@ -7,9 +7,6 @@ import org.bukkit.ChatColor; import java.util.Random; -/** - * @author Giltwist - */ public class BlobBrush extends PerformBrush { private static final int GROW_PERCENT_DEFAULT = 1000; private static final int GROW_PERCENT_MIN = 1; @@ -96,7 +93,7 @@ public class BlobBrush extends PerformBrush { final double rSquared = Math.pow(brushSize + 1, 2); - // Make the changes + // Make the changes for (int x = brushSizeDoubled; x >= 0; x--) { final double xSquared = Math.pow(x - brushSize - 1, 2); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetBrush.java index 447ac2587..f2383e69c 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetBrush.java @@ -7,9 +7,6 @@ import org.bukkit.block.Block; import java.util.ArrayList; -/** - * @author MikeMatrix - */ public class BlockResetBrush extends Brush { private static final ArrayList DENIED_UPDATES = new ArrayList<>(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetSurfaceBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetSurfaceBrush.java index c8e97539b..c08e7e345 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetSurfaceBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/BlockResetSurfaceBrush.java @@ -9,29 +9,26 @@ import com.thevoxelbox.voxelsniper.SnipeData; import org.bukkit.Material; /** -This brush only looks for solid blocks, and then changes those plus any air blocks touching them. If it works, this brush should be faster than the original -blockPositionY an amount proportional to the volume of a snipe selection area / the number of blocks touching air in the selection. This is because every solid block -surrounded blockPositionY others should take equally long to check and not change as it would take MC to change them and then check and find no lighting to update. For -air blocks surrounded blockPositionY other air blocks, this brush saves about 80-100 checks blockPositionY not updating them or their lighting. And for air blocks touching solids, -this brush is slower, because it replaces the air once per solid block it is touching. I assume on average this is about 2 blocks. So every air block -touching a solid negates one air block floating in air. Thus, for selections that have more air blocks surrounded blockPositionY air than air blocks touching solids, -this brush will be faster, which is almost always the case, especially for undeveloped terrain and for larger brush sizes (unlike the original brush, this -should only slow down blockPositionY the square of the brush size, not the cube of the brush size). For typical terrain, blockPositionY my calculations, overall speed increase is -about a factor of 5-6 for a size 20 brush. For a complicated city or ship, etc., this may be only a factor of about 2. In a hypothetical worst case scenario -of a 3d checkerboard of stone and air every other block, this brush should only be about 1.5x slower than the original brush. Savings increase for larger -brushes. + * This brush only looks for solid blocks, and then changes those plus any air blocks touching them. If it works, this brush should be faster than the original + * blockPositionY an amount proportional to the volume of a snipe selection area / the number of blocks touching air in the selection. This is because every solid block + * surrounded blockPositionY others should take equally long to check and not change as it would take MC to change them and then check and find no lighting to update. For + * air blocks surrounded blockPositionY other air blocks, this brush saves about 80-100 checks blockPositionY not updating them or their lighting. And for air blocks touching solids, + * this brush is slower, because it replaces the air once per solid block it is touching. I assume on average this is about 2 blocks. So every air block + * touching a solid negates one air block floating in air. Thus, for selections that have more air blocks surrounded blockPositionY air than air blocks touching solids, + * this brush will be faster, which is almost always the case, especially for undeveloped terrain and for larger brush sizes (unlike the original brush, this + * should only slow down blockPositionY the square of the brush size, not the cube of the brush size). For typical terrain, blockPositionY my calculations, overall speed increase is + * about a factor of 5-6 for a size 20 brush. For a complicated city or ship, etc., this may be only a factor of about 2. In a hypothetical worst case scenario + * of a 3d checkerboard of stone and air every other block, this brush should only be about 1.5x slower than the original brush. Savings increase for larger + * brushes. * * @author GavJenks */ public class BlockResetSurfaceBrush extends Brush { - /** - * - */ + public BlockResetSurfaceBrush() { this.setName("Block Reset Brush Surface Only"); } - @SuppressWarnings("deprecation") private void applyBrush(final SnipeData v) { final AsyncWorld world = this.getWorld(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Brush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Brush.java index 0c8825e41..abe48d61f 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Brush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Brush.java @@ -123,7 +123,7 @@ public abstract class Brush implements IBrush { } else { RangeBlockHelper rangeBlockHelper; if (v.owner().getSnipeData(v.owner().getCurrentToolId()).isRanged()) { - rangeBlockHelper = new RangeBlockHelper(v.owner().getPlayer(), v.owner().getWorld(), (double) v.owner().getSnipeData(v.owner().getCurrentToolId()).getRange()); + rangeBlockHelper = new RangeBlockHelper(v.owner().getPlayer(), v.owner().getWorld(), v.owner().getSnipeData(v.owner().getCurrentToolId()).getRange()); this.setTargetBlock(rangeBlockHelper.getRangeBlock()); } else { rangeBlockHelper = new RangeBlockHelper(v.owner().getPlayer(), v.owner().getWorld()); @@ -190,7 +190,6 @@ public abstract class Brush implements IBrush { * @param z Z coordinate * @return Type ID of Block at given coordinates in the world of the targeted Block. */ - @SuppressWarnings("deprecation") protected int getBlockIdAt(int x, int y, int z) { return getWorld().getBlockAt(x, y, z).getTypeId(); } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CanyonBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CanyonBrush.java index 50dbae179..d075d7225 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CanyonBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CanyonBrush.java @@ -11,9 +11,7 @@ import org.bukkit.Chunk; import org.bukkit.Material; import org.bukkit.block.Block; -/** - * @author Voxel - */ + public class CanyonBrush extends Brush { private static final int SHIFT_LEVEL_MIN = 10; private static final int SHIFT_LEVEL_MAX = 60; @@ -23,10 +21,6 @@ public class CanyonBrush extends Brush { this.setName("Canyon"); } - /** - * @param chunk - * @param undo - */ @SuppressWarnings("deprecation") protected final void canyon(final AsyncChunk chunk, final Undo undo) { for (int x = 0; x < CHUNK_SIZE; x++) { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CanyonSelectionBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CanyonSelectionBrush.java index d810f21f8..7b2183fbe 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CanyonSelectionBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CanyonSelectionBrush.java @@ -6,9 +6,7 @@ import com.thevoxelbox.voxelsniper.Undo; import org.bukkit.ChatColor; import org.bukkit.Chunk; -/** - * @author Voxel - */ + public class CanyonSelectionBrush extends CanyonBrush { private boolean first = true; private int fx; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CheckerVoxelDiscBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CheckerVoxelDiscBrush.java index ad45f4d27..50db6161d 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CheckerVoxelDiscBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CheckerVoxelDiscBrush.java @@ -6,9 +6,6 @@ import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import org.bukkit.ChatColor; import org.bukkit.block.Block; -/** - * @author MikeMatrix - */ public class CheckerVoxelDiscBrush extends PerformBrush { private boolean useWorldCoordinates = true; @@ -19,10 +16,6 @@ public class CheckerVoxelDiscBrush extends PerformBrush { this.setName("Checker Voxel Disc"); } - /** - * @param v Snipe Data - * @param target - */ private void applyBrush(final SnipeData v, final Block target) { for (int x = v.getBrushSize(); x >= -v.getBrushSize(); x--) { for (int y = v.getBrushSize(); y >= -v.getBrushSize(); y--) { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CleanSnowBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CleanSnowBrush.java index 24a15c64a..69a012c4c 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CleanSnowBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CleanSnowBrush.java @@ -7,9 +7,6 @@ import com.thevoxelbox.voxelsniper.Undo; import org.bukkit.ChatColor; import org.bukkit.Material; -/** - * @author psanker - */ public class CleanSnowBrush extends Brush { private double trueCircle = 0; 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 35ba3b364..189c0cbfc 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CloneStampBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CloneStampBrush.java @@ -6,13 +6,11 @@ import org.bukkit.ChatColor; /** * The CloneStamp class is used to create a collection of blocks in a cylinder shape according to the selection the player has set. + * * @author Voxel */ public class CloneStampBrush extends StampBrush { - /** - * - */ - public CloneStampBrush() { +public CloneStampBrush() { this.setName("Clone"); } @@ -107,7 +105,7 @@ public class CloneStampBrush extends StampBrush { } @Override - public final void parameters(final String[] par, final com.thevoxelbox.voxelsniper.SnipeData v) { + public final void parameters(final String[] par, final SnipeData v) { final String parameter = par[1]; if (parameter.equalsIgnoreCase("info")) { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CometBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CometBrush.java index 78665cec4..4e1780fe8 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CometBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CometBrush.java @@ -8,11 +8,6 @@ import org.bukkit.entity.LargeFireball; import org.bukkit.entity.SmallFireball; import org.bukkit.util.Vector; -/** - * @author Gavjenks Heavily revamped from ruler brush blockPositionY - * @author Giltwist - * @author Monofraps (Merged Meteor brush) - */ public class CometBrush extends Brush { private boolean useBigBalls = false; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CopyPastaBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CopyPastaBrush.java index 7bf2d6559..9b75d324e 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CopyPastaBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CopyPastaBrush.java @@ -7,9 +7,6 @@ import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.Undo; import org.bukkit.ChatColor; -/** - * @author giltwist - */ public class CopyPastaBrush extends Brush { private static final int BLOCK_LIMIT = 10000; @@ -23,13 +20,12 @@ public class CopyPastaBrush extends Brush { private int[] offsetPoint = new int[3]; private int[] blockArray; private int[] arraySize = new int[3]; - private int pivot = 0; // ccw degrees + private int pivot = 0; // ccw degrees public CopyPastaBrush() { this.setName("CopyPasta"); } - @SuppressWarnings("deprecation") private void doCopy(final SnipeData v) { for (int i = 0; i < 3; i++) { this.arraySize[i] = Math.abs(this.firstPoint[i] - this.secondPoint[i]) + 1; @@ -98,7 +94,7 @@ public class CopyPastaBrush extends Brush { } @Override - protected final void arrow(final com.thevoxelbox.voxelsniper.SnipeData v) { + protected final void arrow(final SnipeData v) { switch (this.points) { case 0: this.firstPoint[0] = this.getTargetBlock().getX(); @@ -126,7 +122,7 @@ public class CopyPastaBrush extends Brush { } @Override - protected final void powder(final com.thevoxelbox.voxelsniper.SnipeData v) { + protected final void powder(final SnipeData v) { if (this.points == 2) { if (this.numBlocks == 0) { this.doCopy(v); @@ -151,7 +147,7 @@ public class CopyPastaBrush extends Brush { } @Override - public final void parameters(final String[] par, final com.thevoxelbox.voxelsniper.SnipeData v) { + public final void parameters(final String[] par, final SnipeData v) { final String parameter = par[1]; if (parameter.equalsIgnoreCase("info")) { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CylinderBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CylinderBrush.java index 92a1f58a3..7aedbaeaa 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CylinderBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CylinderBrush.java @@ -6,9 +6,6 @@ import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import org.bukkit.ChatColor; import org.bukkit.block.Block; -/** - * @author Kavutop - */ public class CylinderBrush extends PerformBrush { private double trueCircle = 0; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DiscBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DiscBrush.java index 6d36846dd..907af9b75 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DiscBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DiscBrush.java @@ -7,9 +7,6 @@ import org.bukkit.ChatColor; import org.bukkit.block.Block; import org.bukkit.util.Vector; -/** - * @author Voxel - */ public class DiscBrush extends PerformBrush { private double trueCircle = 0; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DiscFaceBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DiscFaceBrush.java index efba98bd8..fd79fda34 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DiscFaceBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DiscFaceBrush.java @@ -7,9 +7,6 @@ import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import org.bukkit.ChatColor; import org.bukkit.block.BlockFace; -/** - * @author Voxel - */ public class DiscFaceBrush extends PerformBrush { private double trueCircle = 0; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DomeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DomeBrush.java index e23c12bc7..8ab6d0480 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DomeBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DomeBrush.java @@ -11,10 +11,6 @@ import org.bukkit.util.Vector; import java.util.HashSet; import java.util.Set; -/** - * @author Gavjenks - * @author MikeMatrix - */ public class DomeBrush extends Brush { public DomeBrush() { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DrainBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DrainBrush.java index 8deb15d07..80f0fcd2e 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DrainBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/DrainBrush.java @@ -6,10 +6,6 @@ import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.Undo; import org.bukkit.ChatColor; -/** - * @author Gavjenks - * @author psanker - */ public class DrainBrush extends Brush { private double trueCircle = 0; private boolean disc = false; @@ -18,7 +14,6 @@ public class DrainBrush extends Brush { this.setName("Drain"); } - @SuppressWarnings("deprecation") private void drain(final SnipeData v) { final int brushSize = v.getBrushSize(); final double brushSizeSquared = Math.pow(brushSize + this.trueCircle, 2); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EllipseBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EllipseBrush.java index cf16cc68a..586e228a1 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EllipseBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EllipseBrush.java @@ -6,9 +6,6 @@ import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import org.bukkit.ChatColor; -/** - * @author psanker - */ public class EllipseBrush extends PerformBrush { private static final double TWO_PI = (2 * Math.PI); private static final int SCL_MIN = 1; @@ -177,7 +174,7 @@ public class EllipseBrush extends PerformBrush { } @Override - public final void parameters(final String[] par, final com.thevoxelbox.voxelsniper.SnipeData v) { + public final void parameters(final String[] par, final SnipeData v) { for (int i = 1; i < par.length; i++) { final String parameter = par[i]; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EllipsoidBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EllipsoidBrush.java index ea8e8296d..6202e4af5 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EllipsoidBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EllipsoidBrush.java @@ -72,7 +72,7 @@ public class EllipsoidBrush extends PerformBrush { } @Override - public final void parameters(final String[] par, final com.thevoxelbox.voxelsniper.SnipeData v) { + public final void parameters(final String[] par, final SnipeData v) { this.istrue = false; for (int i = 1; i < par.length; i++) { final String parameter = par[i]; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EntityBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EntityBrush.java index d5a8214c0..70998fdae 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EntityBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EntityBrush.java @@ -5,9 +5,7 @@ import com.thevoxelbox.voxelsniper.SnipeData; import org.bukkit.ChatColor; import org.bukkit.entity.EntityType; -/** - * @author Piotr - */ + public class EntityBrush extends Brush { private EntityType entityType = EntityType.ZOMBIE; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EntityRemovalBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EntityRemovalBrush.java index ef6c78762..03273c709 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EntityRemovalBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EntityRemovalBrush.java @@ -123,8 +123,8 @@ public class EntityRemovalBrush extends Brush { // +#/-# will suppress auto-prefixing final String exemptionPattern = currentParam.startsWith("+#") || currentParam.startsWith("-#") ? - currentParam.substring(2) : - (currentParam.contains(".") ? currentParam.substring(1) : ".*." + currentParam.substring(1)); + currentParam.substring(2) : + (currentParam.contains(".") ? currentParam.substring(1) : ".*." + currentParam.substring(1)); if (isAddOperation) { exemptions.add(exemptionPattern); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EraserBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EraserBrush.java index edeccf1ad..8d4c00c96 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EraserBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/EraserBrush.java @@ -10,9 +10,7 @@ import org.bukkit.block.Block; import java.util.EnumSet; import java.util.Set; -/** - * @author Voxel - */ + public class EraserBrush extends Brush { private static final Set EXCLUSIVE_MATERIALS = EnumSet.of( diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBlendBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBlendBrush.java index 3f81e05f4..281db0b0d 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBlendBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBlendBrush.java @@ -3,50 +3,50 @@ package com.thevoxelbox.voxelsniper.brush; import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.SnipeData; -public class ErodeBlendBrush extends Brush{ - - private BlendBallBrush blendBall; - private ErodeBrush erode; +public class ErodeBlendBrush extends Brush { - public ErodeBlendBrush() { - this.blendBall = new BlendBallBrush(); - this.erode = new ErodeBrush(); - this.setName("Erode BlendBall"); - } - - @Override - protected final void arrow(final SnipeData v) { - this.blendBall.excludeAir = false; - this.blendBall.setTargetBlock(this.getTargetBlock()); - this.blendBall.arrow(v); - this.erode.setTargetBlock(this.getTargetBlock()); - this.erode.arrow(v); - } - - @Override - protected final void powder(final SnipeData v) { - this.blendBall.excludeAir = false; - this.blendBall.setTargetBlock(this.getTargetBlock()); - this.blendBall.arrow(v); - this.erode.setTargetBlock(this.getTargetBlock()); - this.erode.powder(v); - } - - @Override - public final void parameters(final String[] par, final SnipeData v) { - this.blendBall.parameters(par, v); - this.erode.parameters(par, v); - } - - @Override - public String getPermissionNode() { - return "voxelsniper.brush.erodeblend"; - } + private BlendBallBrush blendBall; + private ErodeBrush erode; - @Override - public void info(Message vm) { - this.erode.info(vm); - this.blendBall.info(vm); - } + public ErodeBlendBrush() { + this.blendBall = new BlendBallBrush(); + this.erode = new ErodeBrush(); + this.setName("Erode BlendBall"); + } + + @Override + protected final void arrow(final SnipeData v) { + this.blendBall.excludeAir = false; + this.blendBall.setTargetBlock(this.getTargetBlock()); + this.blendBall.arrow(v); + this.erode.setTargetBlock(this.getTargetBlock()); + this.erode.arrow(v); + } + + @Override + protected final void powder(final SnipeData v) { + this.blendBall.excludeAir = false; + this.blendBall.setTargetBlock(this.getTargetBlock()); + this.blendBall.arrow(v); + this.erode.setTargetBlock(this.getTargetBlock()); + this.erode.powder(v); + } + + @Override + public final void parameters(final String[] par, final SnipeData v) { + this.blendBall.parameters(par, v); + this.erode.parameters(par, v); + } + + @Override + public String getPermissionNode() { + return "voxelsniper.brush.erodeblend"; + } + + @Override + public void info(Message vm) { + this.erode.info(vm); + this.blendBall.info(vm); + } } 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 b0a9981b4..b2de663cd 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBrush.java @@ -22,10 +22,6 @@ import org.bukkit.util.Vector; import java.util.*; -/** - * @author Piotr - * @author MikeMatrix - */ public class ErodeBrush extends Brush { private static final Vector[] FACES_TO_CHECK = {new Vector(0, 0, 1), new Vector(0, 0, -1), new Vector(0, 1, 0), new Vector(0, -1, 0), new Vector(1, 0, 0), new Vector(-1, 0, 0)}; private final HelpJSAP parser = new HelpJSAP("/b e", "Brush for eroding landscape.", ChatPaginator.GUARANTEED_NO_WRAP_CHAT_PAGE_WIDTH); @@ -44,12 +40,6 @@ public class ErodeBrush extends Brush { } } - /** - * @param result - * @param player - * @param helpJSAP - * @return if a message was sent. - */ public static boolean sendHelpOrErrorMessageToPlayer(final JSAPResult result, final Player player, final HelpJSAP helpJSAP) { final List output = helpJSAP.writeHelpOrErrorMessageIfRequired(result); if (!output.isEmpty()) { @@ -247,11 +237,12 @@ public class ErodeBrush extends Brush { return "voxelsniper.brush.erode"; } - /** - * @author MikeMatrix - */ private enum Preset { - MELT(new ErosionPreset(2, 1, 5, 1)), FILL(new ErosionPreset(5, 1, 2, 1)), SMOOTH(new ErosionPreset(3, 1, 3, 1)), LIFT(new ErosionPreset(6, 0, 1, 1)), FLOATCLEAN(new ErosionPreset(6, 1, 6, 1)); + MELT(new ErosionPreset(2, 1, 5, 1)), + FILL(new ErosionPreset(5, 1, 2, 1)), + SMOOTH(new ErosionPreset(3, 1, 3, 1)), + LIFT(new ErosionPreset(6, 0, 1, 1)), + FLOATCLEAN(new ErosionPreset(6, 1, 6, 1)); private ErosionPreset preset; Preset(final ErosionPreset preset) { @@ -262,21 +253,20 @@ public class ErodeBrush extends Brush { * Generates a concat string of all options. * * @param seperator Seperator for delimiting entries. - * @return */ public static String getValuesString(String seperator) { - String valuesString = ""; + StringBuilder valuesString = new StringBuilder(); boolean delimiterHelper = true; for (final Preset preset : Preset.values()) { if (delimiterHelper) { delimiterHelper = false; } else { - valuesString += seperator; + valuesString.append(seperator); } - valuesString += preset.name(); + valuesString.append(preset.name()); } - return valuesString; + return valuesString.toString(); } public ErosionPreset getPreset() { @@ -286,9 +276,6 @@ public class ErodeBrush extends Brush { } - /** - * @author MikeMatrix - */ private static final class BlockChangeTracker { private final Map> blockChanges; private final Map flatChanges; @@ -302,7 +289,7 @@ public class ErodeBrush extends Brush { } public BlockWrapper get(final Vector position, final int iteration) { - BlockWrapper changedBlock = null; + BlockWrapper changedBlock; for (int i = iteration - 1; i >= 0; --i) { if (this.blockChanges.containsKey(i) && this.blockChanges.get(i).containsKey(position)) { @@ -334,16 +321,12 @@ public class ErodeBrush extends Brush { } } - /** - * @author MikeMatrix - */ private static final class BlockWrapper { private final AsyncBlock block; private final Material material; private final int data; - @SuppressWarnings("deprecation") public BlockWrapper(final AsyncBlock block) { this.block = block; this.data = block.getPropertyId(); @@ -406,9 +389,6 @@ public class ErodeBrush extends Brush { } - /** - * @author MikeMatrix - */ private static final class ErosionPreset { private final int erosionFaces; private final int erosionRecursion; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ExtrudeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ExtrudeBrush.java index 00a878464..1d67d60a4 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ExtrudeBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ExtrudeBrush.java @@ -7,9 +7,6 @@ import org.bukkit.ChatColor; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -/** - * @author psanker - */ public class ExtrudeBrush extends Brush { private double trueCircle; @@ -148,7 +145,7 @@ public class ExtrudeBrush extends Brush { } @Override - public final void parameters(final String[] par, final com.thevoxelbox.voxelsniper.SnipeData v) { + public final void parameters(final String[] par, final SnipeData v) { for (int i = 1; i < par.length; i++) { final String parameter = par[i]; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/FillDownBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/FillDownBrush.java index 9337c6fa7..cd2315747 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/FillDownBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/FillDownBrush.java @@ -8,9 +8,7 @@ import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import org.bukkit.ChatColor; import org.bukkit.block.Block; -/** - * @author Voxel - */ + public class FillDownBrush extends PerformBrush { private double trueCircle = 0; private boolean fillLiquid = true; @@ -42,7 +40,9 @@ public class FillDownBrush extends PerformBrush { break; } } - if (!found) continue; + if (!found) { + continue; + } y--; } for (; y >= -targetBlock.getY(); --y) { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/FlatOceanBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/FlatOceanBrush.java index 66217eb72..2044ed672 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/FlatOceanBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/FlatOceanBrush.java @@ -6,9 +6,6 @@ import com.thevoxelbox.voxelsniper.SnipeData; import org.bukkit.ChatColor; import org.bukkit.Material; -/** - * @author GavJenks - */ public class FlatOceanBrush extends Brush { private static final int DEFAULT_WATER_LEVEL = 29; private static final int DEFAULT_FLOOR_LEVEL = 8; @@ -19,7 +16,6 @@ public class FlatOceanBrush extends Brush { this.setName("FlatOcean"); } - @SuppressWarnings("deprecation") private void flatOcean(final AsyncChunk chunk) { for (int x = 0; x < CHUNK_SIZE; x++) { for (int z = 0; z < CHUNK_SIZE; z++) { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/GenerateTreeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/GenerateTreeBrush.java index bf3b97a1f..069401909 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/GenerateTreeBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/GenerateTreeBrush.java @@ -14,9 +14,6 @@ import java.util.Random; // Proposal: Use /v and /vr for leave and wood material // or two more parameters -- Monofraps -/** - * @author Ghost8700 @ Voxel - */ public class GenerateTreeBrush extends Brush { // Tree Variables. private Random randGenerator = new Random(); @@ -43,10 +40,7 @@ public class GenerateTreeBrush extends Brush { private int blockPositionY; private int blockPositionZ; - /** - * - */ - public GenerateTreeBrush() { +public GenerateTreeBrush() { this.setName("Generate Tree"); } @@ -79,7 +73,6 @@ public class GenerateTreeBrush extends Brush { } // Branch Creation based on direction chosen from the parameters passed. - @SuppressWarnings("deprecation") private void branchCreate(final int xDirection, final int zDirection) { // Sets branch origin. @@ -123,7 +116,6 @@ public class GenerateTreeBrush extends Brush { blockPositionZ = originZ; } - @SuppressWarnings("deprecation") private void leafNodeCreate() { // Generates the node size. final int nodeRadius = this.randGenerator.nextInt(this.nodeMax - this.nodeMin + 1) + this.nodeMin; @@ -221,7 +213,6 @@ public class GenerateTreeBrush extends Brush { * @param xDirection * @param zDirection */ - @SuppressWarnings("deprecation") private void rootCreate(final int xDirection, final int zDirection) { // Sets Origin. final int originX = blockPositionX; @@ -311,7 +302,6 @@ public class GenerateTreeBrush extends Brush { this.rootCreate(-1, -1); } - @SuppressWarnings("deprecation") private void trunkCreate() { // Creates true circle discs of the set size using the wood type selected. final double bSquared = Math.pow(this.thickness + 0.5, 2); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/HeatRayBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/HeatRayBrush.java index a923ca726..39e3350ce 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/HeatRayBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/HeatRayBrush.java @@ -13,25 +13,19 @@ import org.bukkit.util.noise.PerlinNoiseGenerator; import java.util.ArrayList; import java.util.Random; -/** - * @author Gavjenks - */ public class HeatRayBrush extends Brush { - /** - * @author MikeMatrix - */ -// private enum FlameableBlock -// { -// WOOD(Material.WOOD), SAPLING(Material.SAPLING), LOG(Material.LOG), LEAVES(Material.LEAVES), SPONGE(Material.SPONGE), WEB(Material.WEB), LONG_GRASS(Material.LONG_GRASS), DEAD_BUSH(Material.DEAD_BUSH), WOOL(Material.WOOL), YELLOW_FLOWER(Material.YELLOW_FLOWER), RED_ROSE(Material.RED_ROSE), TORCH(Material.TORCH), FIRE(Material.FIRE), WOOD_STAIRS(Material.WOOD_STAIRS), CROPS(Material.CROPS), SIGN_POST(Material.SIGN_POST), WOODEN_DOOR(Material.WOODEN_DOOR), LADDER(Material.LADDER), WALL_SIGN(Material.WALL_SIGN), WOOD_PLATE(Material.WOOD_PLATE), SNOW(Material.SNOW), ICE(Material.ICE), SUGAR_CANE_BLOCK(Material.SUGAR_CANE_BLOCK), FENCE(Material.FENCE), TRAP_DOOR(Material.TRAP_DOOR), VINE(Material.VINE), FENCE_GATE(Material.FENCE_GATE), WATER_LILLY(Material.WATER_LILY); -// -// private Material material; -// -// FlameableBlock(final Material material) -// { -// this.material = material; -// } -// } +/* private enum FlameableBlock + { + WOOD(Material.WOOD), SAPLING(Material.SAPLING), LOG(Material.LOG), LEAVES(Material.LEAVES), SPONGE(Material.SPONGE), WEB(Material.WEB), LONG_GRASS(Material.LONG_GRASS), DEAD_BUSH(Material.DEAD_BUSH), WOOL(Material.WOOL), YELLOW_FLOWER(Material.YELLOW_FLOWER), RED_ROSE(Material.RED_ROSE), TORCH(Material.TORCH), FIRE(Material.FIRE), WOOD_STAIRS(Material.WOOD_STAIRS), CROPS(Material.CROPS), SIGN_POST(Material.SIGN_POST), WOODEN_DOOR(Material.WOODEN_DOOR), LADDER(Material.LADDER), WALL_SIGN(Material.WALL_SIGN), WOOD_PLATE(Material.WOOD_PLATE), SNOW(Material.SNOW), ICE(Material.ICE), SUGAR_CANE_BLOCK(Material.SUGAR_CANE_BLOCK), FENCE(Material.FENCE), TRAP_DOOR(Material.TRAP_DOOR), VINE(Material.VINE), FENCE_GATE(Material.FENCE_GATE), WATER_LILLY(Material.WATER_LILY); + + private Material material; + + FlameableBlock(final Material material) + { + this.material = material; + } + }*/ private static final double REQUIRED_OBSIDIAN_DENSITY = 0.6; private static final double REQUIRED_COBBLE_DENSITY = 0.5; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/JaggedLineBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/JaggedLineBrush.java index b24c4bf31..19951eec8 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/JaggedLineBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/JaggedLineBrush.java @@ -12,10 +12,6 @@ import org.bukkit.util.Vector; import java.util.Random; -/** - * @author Giltwist - * @author Monofraps - */ public class JaggedLineBrush extends PerformBrush { private static final Vector HALF_BLOCK_OFFSET = new Vector(0.5, 0.5, 0.5); private static final int RECURSION_MIN = 1; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/JockeyBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/JockeyBrush.java index 5050e3655..da7194364 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/JockeyBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/JockeyBrush.java @@ -12,10 +12,6 @@ import org.bukkit.event.player.PlayerTeleportEvent; import java.util.List; -/** - * @author Voxel - * @author Monofraps - */ public class JockeyBrush extends Brush { private static final int ENTITY_STACK_LIMIT = 50; private JockeyType jockeyType = JockeyType.NORMAL_ALL_ENTITIES; @@ -138,11 +134,11 @@ public class JockeyBrush extends Brush { @Override public final void parameters(final String[] par, final SnipeData v) { - boolean inverse = false; - boolean playerOnly = false; - boolean stack = false; try { + boolean inverse = false; + boolean playerOnly = false; + boolean stack = false; for (String parameter : par) { if (parameter.startsWith("-i:")) { inverse = parameter.endsWith("y"); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/LightningBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/LightningBrush.java index fdfd5e7fd..8c123fa4c 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/LightningBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/LightningBrush.java @@ -3,9 +3,6 @@ package com.thevoxelbox.voxelsniper.brush; import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.SnipeData; -/** - * @author Gavjenks - */ public class LightningBrush extends Brush { public LightningBrush() { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/LineBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/LineBrush.java index e8e49be5b..9adf92ff0 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/LineBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/LineBrush.java @@ -10,11 +10,6 @@ import org.bukkit.util.BlockIterator; import org.bukkit.util.NumberConversions; import org.bukkit.util.Vector; -/** - * @author Gavjenks - * @author giltwist - * @author MikeMatrix - */ public class LineBrush extends PerformBrush { private static final Vector HALF_BLOCK_OFFSET = new Vector(0.5, 0.5, 0.5); private Vector originCoords = null; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/OceanBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/OceanBrush.java index 0f067677a..d5dbfea87 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/OceanBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/OceanBrush.java @@ -9,9 +9,7 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; -/** - * @author Voxel - */ + public class OceanBrush extends Brush { private static final int WATER_LEVEL_DEFAULT = 62; // y=63 -- we are using array indices here private static final int WATER_LEVEL_MIN = 12; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/OverlayBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/OverlayBrush.java index b09a3b476..7a7be93fa 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/OverlayBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/OverlayBrush.java @@ -10,9 +10,6 @@ import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import org.bukkit.ChatColor; -/** - * @author Gavjenks - */ public class OverlayBrush extends PerformBrush { private static final int DEFAULT_DEPTH = 3; private int depth = DEFAULT_DEPTH; @@ -32,24 +29,24 @@ public class OverlayBrush extends PerformBrush { // check if column is valid // column is valid if it has no solid block right above the clicked layer final int materialId = this.getBlockIdAt(this.getTargetBlock().getX() + x, - this.getTargetBlock().getY() + 1, this.getTargetBlock().getZ() + z); + this.getTargetBlock().getY() + 1, this.getTargetBlock().getZ() + z); if (isIgnoredBlock(materialId)) { if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared) { for (int y = this.getTargetBlock().getY(); y > 0; y--) { // check for surface final int layerBlockId = this.getBlockIdAt(this.getTargetBlock().getX() + x, y, - this.getTargetBlock().getZ() + z); + this.getTargetBlock().getZ() + z); if (!isIgnoredBlock(layerBlockId)) { for (int currentDepth = y; y - currentDepth < depth; currentDepth--) { final int currentBlockId = this.getBlockIdAt(this.getTargetBlock().getX() + x, - currentDepth, this.getTargetBlock().getZ() + z); + currentDepth, this.getTargetBlock().getZ() + z); if (isOverrideableMaterial(currentBlockId)) { this.current.perform( this.clampY(this.getTargetBlock().getX() + x, - currentDepth, this.getTargetBlock().getZ() + z)); + currentDepth, this.getTargetBlock().getZ() + z)); } } break; @@ -102,25 +99,25 @@ public class OverlayBrush extends PerformBrush { if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared) { // if inside of the column... if (!this.getBlockAt(this.getTargetBlock().getX() + x, y - 1, - this.getTargetBlock().getZ() + z) - .isEmpty()) { // if not a floating block (like one of Notch'world pools) + this.getTargetBlock().getZ() + z) + .isEmpty()) { // if not a floating block (like one of Notch'world pools) if (this.getBlockAt(this.getTargetBlock().getX() + x, y + 1, - this.getTargetBlock().getZ() + z) + this.getTargetBlock().getZ() + z) .isEmpty()) { // must start at surface... this prevents it filling stuff in if // you click in a wall and it starts out below surface. if (!this.allBlocks) { // if the override parameter has not been activated, go to the switch that filters out manmade stuff. BlockType type = BukkitAdapter.asBlockType((this .getBlockType(this.getTargetBlock().getX() + x, y, - this.getTargetBlock().getZ() + z))); + this.getTargetBlock().getZ() + z))); BlockMaterial mat = type.getMaterial(); if (mat.isSolid() && mat.isFullCube() && !mat .hasContainer()) { for (int d = 1; (d < this.depth + 1); d++) { this.current.perform( this.clampY(this.getTargetBlock().getX() + x, - y + d, this.getTargetBlock().getZ() - + z)); // fills down as many layers as you specify + y + d, this.getTargetBlock().getZ() + + z)); // fills down as many layers as you specify // in parameters memory[x + brushSize][z + brushSize] = 1; // stop it from checking any other blocks in this vertical 1x1 column. @@ -132,8 +129,8 @@ public class OverlayBrush extends PerformBrush { for (int d = 1; (d < this.depth + 1); d++) { this.current.perform( this.clampY(this.getTargetBlock().getX() + x, y + d, - this.getTargetBlock().getZ() - + z)); // fills down as many layers as you specify in + this.getTargetBlock().getZ() + + z)); // fills down as many layers as you specify in // parameters memory[x + brushSize][z + brushSize] = 1; // stop it from checking any other blocks in this vertical 1x1 column. @@ -176,9 +173,9 @@ public class OverlayBrush extends PerformBrush { if (parameter.equalsIgnoreCase("info")) { v.sendMessage(ChatColor.GOLD + "Overlay brush parameters:"); v.sendMessage(ChatColor.AQUA - + "d[number] (ex: d3) How many blocks deep you want to replace from the surface."); + + "d[number] (ex: d3) How many blocks deep you want to replace from the surface."); v.sendMessage(ChatColor.BLUE - + "all (ex: /b over all) Sets the brush to overlay over ALL materials, not just natural surface ones (will no longer ignore trees and buildings). The parameter /some will set it back to default."); + + "all (ex: /b over all) Sets the brush to overlay over ALL materials, not just natural surface ones (will no longer ignore trees and buildings). The parameter /some will set it back to default."); return; } if (parameter.startsWith("d")) { @@ -202,7 +199,7 @@ public class OverlayBrush extends PerformBrush { ChatColor.BLUE + "Will overlay only natural block types." + this.depth); } else { v.sendMessage(ChatColor.RED - + "Invalid brush parameters! Use the info parameter to display parameter info."); + + "Invalid brush parameters! Use the info parameter to display parameter info."); } } } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PaintingBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PaintingBrush.java index 6dd8a507a..8e060b079 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PaintingBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PaintingBrush.java @@ -6,6 +6,7 @@ import com.thevoxelbox.voxelsniper.SnipeData; /** * Painting scrolling Brush. + * * @author Voxel */ public class PaintingBrush extends Brush { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PullBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PullBrush.java index 4ac1335ee..8b4d9c451 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PullBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PullBrush.java @@ -8,9 +8,7 @@ import org.bukkit.ChatColor; import java.util.HashSet; -/** - * @author Piotr - */ + public class PullBrush extends Brush { private final HashSet surface = new HashSet<>(); private int vh; @@ -244,9 +242,7 @@ public class PullBrush extends Brush { return "voxelsniper.brush.pull"; } - /** - * @author Piotr - */ + private final class BlockWrapper { private final int id; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PunishBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PunishBrush.java index 5fab0e30e..6e0229ca4 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PunishBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/PunishBrush.java @@ -19,11 +19,6 @@ import org.bukkit.util.Vector; import java.util.List; import java.util.Random; -/** - * @author Monofraps - * @author Deamon - * @author MikeMatrix - */ public class PunishBrush extends PerformBrush { private static final int MAXIMAL_RANDOM_TELEPORTATION_RANGE = 400; private static final int TICKS_PER_SECOND = 20; @@ -313,9 +308,6 @@ public class PunishBrush extends PerformBrush { return "voxelsniper.brush.punish"; } - /** - * @author Monofraps - */ private enum Punishment { // Monofraps FIRE, LIGHTNING, BLINDNESS, DRUNK, KILL, RANDOMTP, ALL_POTION, diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/RandomErodeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/RandomErodeBrush.java index fc296fd8e..4cc354f90 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/RandomErodeBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/RandomErodeBrush.java @@ -8,10 +8,6 @@ import com.thevoxelbox.voxelsniper.Undo; import java.util.Random; -/** - * @author Piotr - * @author Giltwist (Randomized blockPositionY) - */ public class RandomErodeBrush extends Brush { private final double trueCircle = 0.5; private BlockWrapper[][][] snap; @@ -19,7 +15,6 @@ public class RandomErodeBrush extends Brush { private int bsize; private int erodeFace; private int fillFace; - private int brushSize; private int erodeRecursion = 1; private int fillRecursion = 1; private Random generator = new Random(); @@ -55,7 +50,6 @@ public class RandomErodeBrush extends Brush { } } - @SuppressWarnings("deprecation") private boolean fill(final int x, final int y, final int z) { if (this.snap[x][y][z].isSolid()) { return false; @@ -90,19 +84,17 @@ public class RandomErodeBrush extends Brush { } private void getMatrix() { - this.brushSize = ((this.bsize + 1) * 2) + 1; + int brushSize = ((this.bsize + 1) * 2) + 1; if (this.snap.length == 0) { - this.snap = new BlockWrapper[this.brushSize][this.brushSize][this.brushSize]; + this.snap = new BlockWrapper[brushSize][brushSize][brushSize]; int sx = this.getTargetBlock().getX() - (this.bsize + 1); - int sy = this.getTargetBlock().getY() - (this.bsize + 1); - int sz = this.getTargetBlock().getZ() - (this.bsize + 1); for (int x = 0; x < this.snap.length; x++) { - sz = this.getTargetBlock().getZ() - (this.bsize + 1); + int sz = this.getTargetBlock().getZ() - (this.bsize + 1); for (int z = 0; z < this.snap.length; z++) { - sy = this.getTargetBlock().getY() - (this.bsize + 1); + int sy = this.getTargetBlock().getY() - (this.bsize + 1); for (int y = 0; y < this.snap.length; y++) { this.snap[x][y][z] = new BlockWrapper(this.clampY(sx, sy, sz)); sy++; @@ -113,16 +105,14 @@ public class RandomErodeBrush extends Brush { } this.firstSnap = this.snap.clone(); } else { - this.snap = new BlockWrapper[this.brushSize][this.brushSize][this.brushSize]; + this.snap = new BlockWrapper[brushSize][brushSize][brushSize]; int sx = this.getTargetBlock().getX() - (this.bsize + 1); - int sy = this.getTargetBlock().getY() - (this.bsize + 1); - int sz = this.getTargetBlock().getZ() - (this.bsize + 1); for (int x = 0; x < this.snap.length; x++) { - sz = this.getTargetBlock().getZ() - (this.bsize + 1); + int sz = this.getTargetBlock().getZ() - (this.bsize + 1); for (int z = 0; z < this.snap.length; z++) { - sy = this.getTargetBlock().getY() - (this.bsize + 1); + int sy = this.getTargetBlock().getY() - (this.bsize + 1); for (int y = 0; y < this.snap.length; y++) { this.snap[x][y][z] = new BlockWrapper(this.clampY(sx, sy, sz)); sy++; @@ -312,29 +302,18 @@ public class RandomErodeBrush extends Brush { return "voxelsniper.brush.randomerode"; } - /** - * @author unknown - */ private class BlockWrapper { private boolean solid; private AsyncBlock nativeBlock; private int id; private int i; - /** - * @param bl - */ - @SuppressWarnings("deprecation") public BlockWrapper(final AsyncBlock bl) { this.setNativeBlock(bl); this.setI(bl.getTypeId()); switch (bl.getType()) { case AIR: - this.setSolid(false); - break; case WATER: - this.setSolid(false); - break; case LAVA: this.setSolid(false); break; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/RingBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/RingBrush.java index 4e032b846..9208276d9 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/RingBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/RingBrush.java @@ -6,9 +6,7 @@ import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import org.bukkit.ChatColor; -/** - * @author Voxel - */ + public class RingBrush extends PerformBrush { private double trueCircle = 0; private double innerSize = 0; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DBrush.java index fb7dcf687..187f75e09 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DBrush.java @@ -7,9 +7,7 @@ import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.util.BlockWrapper; import org.bukkit.ChatColor; -/** - * @author Piotr - */ + public class Rot2DBrush extends Brush { private int mode = 0; private int bSize; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DvertBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DvertBrush.java index 65e5bac36..ad0944e31 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DvertBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/Rot2DvertBrush.java @@ -8,15 +8,11 @@ import com.thevoxelbox.voxelsniper.util.BlockWrapper; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -/** - * @author Gavjenks, hack job from the other 2d rotation brush blockPositionY piotr - */ // The X Y and Z variable names in this file do NOT MAKE ANY SENSE. Do not attempt to actually figure out what on earth is going on here. Just go to the // original 2d horizontal brush if you wish to make anything similar to this, and start there. I didn't bother renaming everything. public class Rot2DvertBrush extends Brush { private int mode = 0; private int bSize; - private int brushSize; private BlockWrapper[][][] snap; private double se; @@ -26,19 +22,17 @@ public class Rot2DvertBrush extends Brush { @SuppressWarnings("deprecation") private void getMatrix() { - this.brushSize = (this.bSize * 2) + 1; + int brushSize = (this.bSize * 2) + 1; - this.snap = new BlockWrapper[this.brushSize][this.brushSize][this.brushSize]; + this.snap = new BlockWrapper[brushSize][brushSize][brushSize]; int sx = this.getTargetBlock().getX() - this.bSize; - int sy = this.getTargetBlock().getY() - this.bSize; - int sz = this.getTargetBlock().getZ() - this.bSize; for (int x = 0; x < this.snap.length; x++) { - sz = this.getTargetBlock().getZ() - this.bSize; + int sz = this.getTargetBlock().getZ() - this.bSize; for (int z = 0; z < this.snap.length; z++) { - sy = this.getTargetBlock().getY() - this.bSize; + int sy = this.getTargetBlock().getY() - this.bSize; for (int y = 0; y < this.snap.length; y++) { final AsyncBlock block = this.clampY(sx, sy, sz); // why is this not sx + x, sy + y sz + z? @@ -53,7 +47,7 @@ public class Rot2DvertBrush extends Brush { } } - private void rotate(final SnipeData v) { + private void rotate() { final double brushSizeSquared = Math.pow(this.bSize + 0.5, 2); final double cos = Math.cos(this.se); final double sin = Math.sin(this.se); @@ -139,7 +133,7 @@ public class Rot2DvertBrush extends Brush { if (this.mode == 0) { this.getMatrix(); - this.rotate(v); + this.rotate(); } else { v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong."); } @@ -151,7 +145,7 @@ public class Rot2DvertBrush extends Brush { if (this.mode == 0) { this.getMatrix(); - this.rotate(v); + this.rotate(); } else { v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong."); } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/RulerBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/RulerBrush.java index 082efab7c..ce89391d6 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/RulerBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/RulerBrush.java @@ -6,9 +6,6 @@ import com.thevoxelbox.voxelsniper.Undo; import org.bukkit.ChatColor; import org.bukkit.util.Vector; -/** - * @author Gavjenks - */ public class RulerBrush extends Brush { private boolean first = true; private Vector coords = new Vector(0, 0, 0); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ScannerBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ScannerBrush.java index 1bdf5a206..2761adf64 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ScannerBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ScannerBrush.java @@ -8,9 +8,6 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.BlockFace; -/** - * @author DivineRage - */ public class ScannerBrush extends Brush { private static final int DEPTH_MIN = 1; private static final int DEPTH_DEFAULT = 24; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SetBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SetBrush.java index 8ea300481..144901b57 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SetBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SetBrush.java @@ -6,9 +6,7 @@ import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import org.bukkit.ChatColor; import org.bukkit.block.Block; -/** - * @author Voxel - */ + public class SetBrush extends PerformBrush { private static final int SELECTION_SIZE_MAX = 5000000; private Block block = null; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SetRedstoneFlipBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SetRedstoneFlipBrush.java index 36e4c3af1..7c5cd07f3 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SetRedstoneFlipBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SetRedstoneFlipBrush.java @@ -8,9 +8,7 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; -/** - * @author Voxel - */ + public class SetRedstoneFlipBrush extends Brush { private Block block = null; private Undo undo; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SetRedstoneRotateBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SetRedstoneRotateBrush.java index 86eb8e13a..f0ad155bc 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SetRedstoneRotateBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SetRedstoneRotateBrush.java @@ -8,9 +8,7 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; -/** - * @author Voxel - */ + public class SetRedstoneRotateBrush extends Brush { private Block block = null; private Undo undo; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellBallBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellBallBrush.java index fe1f2aece..d3be7c2fc 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellBallBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellBallBrush.java @@ -8,6 +8,7 @@ import org.bukkit.block.Block; /** * THIS BRUSH SHOULD NOT USE PERFORMERS. + * * @author Voxel */ public class ShellBallBrush extends Brush { @@ -39,7 +40,7 @@ public class ShellBallBrush extends Brush { for (int x = 0; x <= brushSizeDoubled; x++) { for (int y = 0; y <= brushSizeDoubled; y++) { System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0, - brushSizeDoubled + 1); + brushSizeDoubled + 1); } } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellSetBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellSetBrush.java index 9195f3ca0..701840f7b 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellSetBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellSetBrush.java @@ -9,9 +9,7 @@ import org.bukkit.block.Block; import java.util.ArrayList; -/** - * @author Piotr - */ + public class ShellSetBrush extends Brush { private static final int MAX_SIZE = 5000000; private Block block = null; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellVoxelBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellVoxelBrush.java index 079ec8b10..402280f5c 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellVoxelBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ShellVoxelBrush.java @@ -8,6 +8,7 @@ import org.bukkit.block.Block; /** * THIS BRUSH SHOULD NOT USE PERFORMERS. + * * @author Voxel */ public class ShellVoxelBrush extends Brush { @@ -38,7 +39,7 @@ public class ShellVoxelBrush extends Brush { for (int x = 0; x <= brushSizeSquared; x++) { for (int y = 0; y <= brushSizeSquared; y++) { System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0, - brushSizeSquared + 1); + brushSizeSquared + 1); } } int temp; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SignOverwriteBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SignOverwriteBrush.java index 8b671a99c..23aacafd7 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SignOverwriteBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SignOverwriteBrush.java @@ -12,6 +12,7 @@ import java.util.Arrays; /** * Overwrites signs. + * * @author Monofraps */ public class SignOverwriteBrush extends Brush { @@ -324,10 +325,10 @@ public class SignOverwriteBrush extends Brush { try (FileReader inFile = new FileReader(store); BufferedReader inStream = new BufferedReader(inFile)) { - for (int i = 0; i < this.signTextLines.length; i++) { - this.signLinesEnabled[i] = Boolean.parseBoolean(inStream.readLine()); - this.signTextLines[i] = inStream.readLine(); - } + for (int i = 0; i < this.signTextLines.length; i++) { + this.signLinesEnabled[i] = Boolean.parseBoolean(inStream.readLine()); + this.signTextLines[i] = inStream.readLine(); + } v.sendMessage(ChatColor.BLUE + "File loaded successfully."); } catch (IOException exception) { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SnipeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SnipeBrush.java index 376544283..141642d9c 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SnipeBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SnipeBrush.java @@ -4,9 +4,7 @@ import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; -/** - * @author Voxel - */ + public class SnipeBrush extends PerformBrush { public SnipeBrush() { 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 7bf188939..a79a19339 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SnowConeBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SnowConeBrush.java @@ -12,9 +12,7 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -/** - * @author Voxel - */ + public class SnowConeBrush extends Brush { @SuppressWarnings("deprecation") private void addSnow(final SnipeData v, Block targetBlock) { @@ -127,11 +125,11 @@ public class SnowConeBrush extends Brush { } else { Block blockAbove = getTargetBlock().getRelative(BlockFace.UP); if (blockAbove != null && BukkitAdapter.adapt(blockAbove.getType()).getMaterial() - .isAir()) { + .isAir()) { addSnow(v, blockAbove); } else { v.owner().getPlayer() - .sendMessage(ChatColor.RED + "Error: Center block neither snow nor air."); + .sendMessage(ChatColor.RED + "Error: Center block neither snow nor air."); } } } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SpiralStaircaseBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SpiralStaircaseBrush.java index 27ccaa856..c76f92963 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SpiralStaircaseBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SpiralStaircaseBrush.java @@ -1,7 +1,6 @@ package com.thevoxelbox.voxelsniper.brush; import com.sk89q.worldedit.extension.input.InputParseException; -import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.SnipeData; @@ -9,9 +8,6 @@ import com.thevoxelbox.voxelsniper.Undo; import org.bukkit.ChatColor; import org.bukkit.block.Block; -/** - * @author giltwist - */ public class SpiralStaircaseBrush extends Brush { private String stairtype = "block"; // "block" 1x1 blocks (default), "step" alternating step double step, "stair" staircase with blocks on corners private String sdirect = "c"; // "c" clockwise (default), "cc" counter-clockwise @@ -21,7 +17,6 @@ public class SpiralStaircaseBrush extends Brush { this.setName("Spiral Staircase"); } - @SuppressWarnings("deprecation") private void buildStairWell(final SnipeData v, Block targetBlock) { if (v.getVoxelHeight() < 1) { v.setVoxelHeight(1); @@ -32,12 +27,9 @@ public class SpiralStaircaseBrush extends Brush { // locate first block in staircase // Note to self, fix these - int startX = 0; - int startZ = 0; + int startX; + int startZ; int y = 0; - int xOffset = 0; - int zOffset = 0; - int toggle = 0; if (this.sdirect.equalsIgnoreCase("cc")) { if (this.sopen.equalsIgnoreCase("n")) { @@ -69,6 +61,9 @@ public class SpiralStaircaseBrush extends Brush { } } + int xOffset = 0; + int zOffset = 0; + int toggle = 0; while (y < v.getVoxelHeight()) { if (this.stairtype.equalsIgnoreCase("block")) { // 1x1x1 voxel material steps @@ -218,9 +213,6 @@ public class SpiralStaircaseBrush extends Brush { break; case 1: - switch (stairtype) { - - } if (this.stairtype.equalsIgnoreCase("block")) { this.setBlockIdAt(blockPositionZ - v.getBrushSize() + z, blockPositionX - v.getBrushSize() + x, blockPositionY + i, v.getVoxelId()); } else if (this.stairtype.equalsIgnoreCase("step")) { @@ -253,7 +245,6 @@ public class SpiralStaircaseBrush extends Brush { v.owner().storeUndo(undo); } - @SuppressWarnings("deprecation") private void digStairWell(final SnipeData v, Block targetBlock) { if (v.getVoxelHeight() < 1) { v.setVoxelHeight(1); @@ -265,12 +256,8 @@ public class SpiralStaircaseBrush extends Brush { // locate first block in staircase // Note to self, fix these - int startX = 0; - int startZ = 0; - int y = 0; - int xOffset = 0; - int zOffset = 0; - int toggle = 0; + int startX; + int startZ; if (this.sdirect.equalsIgnoreCase("cc")) { if (this.sopen.equalsIgnoreCase("n")) { @@ -302,6 +289,10 @@ public class SpiralStaircaseBrush extends Brush { } } + int xOffset = 0; + int zOffset = 0; + int toggle = 0; + int y = 0; while (y < v.getVoxelHeight()) { if (this.stairtype.equalsIgnoreCase("block")) { // 1x1x1 voxel material steps @@ -517,14 +508,11 @@ public class SpiralStaircaseBrush extends Brush { // step/slab try { - BlockType type = BlockTypes.parse(par[i]); this.stairtype = par[i].toLowerCase().intern(); v.sendMessage(ChatColor.BLUE + "Staircase type: " + this.stairtype); return; } catch (InputParseException ignore) { } - if ("block".equals(par[i].toLowerCase())) { - } if (par[i].equalsIgnoreCase("block") || par[i].equalsIgnoreCase("step") || par[i].equalsIgnoreCase("woodstair") || par[i].equalsIgnoreCase("cobblestair")) { this.stairtype = par[i].toLowerCase().intern(); v.sendMessage(ChatColor.BLUE + "Staircase type: " + this.stairtype); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterBallBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterBallBrush.java index e8d71c817..dd8eb0970 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterBallBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterBallBrush.java @@ -8,9 +8,7 @@ import org.bukkit.ChatColor; import java.util.Random; -/** - * @author Voxel - */ + public class SplatterBallBrush extends PerformBrush { private static final int GROW_PERCENT_MIN = 1; private static final int GROW_PERCENT_DEFAULT = 1000; @@ -100,9 +98,10 @@ public class SplatterBallBrush extends PerformBrush { // integrate tempsplat back into splat at end of iteration for (int x = 2 * v.getBrushSize(); x >= 0; x--) { for (int y = 2 * v.getBrushSize(); y >= 0; y--) { - if (2 * v.getBrushSize() + 1 >= 0) + if (2 * v.getBrushSize() + 1 >= 0) { System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0, - 2 * v.getBrushSize() + 1); + 2 * v.getBrushSize() + 1); + } } } } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterDiscBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterDiscBrush.java index ebb8d06ee..0243e90d1 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterDiscBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterDiscBrush.java @@ -8,9 +8,7 @@ import org.bukkit.ChatColor; import java.util.Random; -/** - * @author Voxel - */ + public class SplatterDiscBrush extends PerformBrush { private static final int GROW_PERCENT_MIN = 1; private static final int GROW_PERCENT_DEFAULT = 1000; @@ -90,8 +88,9 @@ public class SplatterDiscBrush extends PerformBrush { // integrate tempsplat back into splat at end of iteration for (int x = 2 * v.getBrushSize(); x >= 0; x--) { - if (2 * v.getBrushSize() + 1 >= 0) + if (2 * v.getBrushSize() + 1 >= 0) { System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1); + } } } this.growPercent = gref; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterOverlayBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterOverlayBrush.java index 9bd7e5ec0..ae01e60ed 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterOverlayBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterOverlayBrush.java @@ -10,9 +10,6 @@ import org.bukkit.ChatColor; import java.util.Random; -/** - * @author Gavjenks Splatterized blockPositionY Giltwist - */ public class SplatterOverlayBrush extends PerformBrush { private static final int GROW_PERCENT_MIN = 1; private static final int GROW_PERCENT_DEFAULT = 1000; @@ -83,8 +80,9 @@ public class SplatterOverlayBrush extends PerformBrush { } // integrate tempsplat back into splat at end of iteration for (int x = 2 * v.getBrushSize(); x >= 0; x--) { - if (2 * v.getBrushSize() + 1 >= 0) + if (2 * v.getBrushSize() + 1 >= 0) { System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1); + } } } this.growPercent = gref; @@ -119,9 +117,6 @@ public class SplatterOverlayBrush extends PerformBrush { memory[x + v.getBrushSize()][z + v.getBrushSize()] = 1; } } - continue; - } else { - continue; } } else { final int depth = randomizeHeight ? generator.nextInt(this.depth) : this.depth; @@ -192,8 +187,9 @@ public class SplatterOverlayBrush extends PerformBrush { } // integrate tempsplat back into splat at end of iteration for (int x = 2 * v.getBrushSize(); x >= 0; x--) { - if (2 * v.getBrushSize() + 1 >= 0) + if (2 * v.getBrushSize() + 1 >= 0) { System.arraycopy(tempsplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1); + } } } this.growPercent = gref; @@ -220,9 +216,6 @@ public class SplatterOverlayBrush extends PerformBrush { // in parameters memory[x + v.getBrushSize()][z + v.getBrushSize()] = 1; // stop it from checking any other blocks in this vertical 1x1 column. } - continue; - } else { - continue; } } else { final int depth = randomizeHeight ? generator.nextInt(this.depth) : this.depth; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelBrush.java index 955c8532e..19a9dfb36 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelBrush.java @@ -8,9 +8,7 @@ import org.bukkit.ChatColor; import java.util.Random; -/** - * @author Voxel - */ + public class SplatterVoxelBrush extends PerformBrush { private static final int GROW_PERCENT_MIN = 1; private static final int GROW_PERCENT_DEFAULT = 1000; @@ -100,9 +98,10 @@ public class SplatterVoxelBrush extends PerformBrush { // integrate tempsplat back into splat at end of iteration for (int x = 2 * v.getBrushSize(); x >= 0; x--) { for (int y = 2 * v.getBrushSize(); y >= 0; y--) { - if (2 * v.getBrushSize() + 1 >= 0) + if (2 * v.getBrushSize() + 1 >= 0) { System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0, - 2 * v.getBrushSize() + 1); + 2 * v.getBrushSize() + 1); + } } } } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelDiscBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelDiscBrush.java index 9ac3ea57b..e9157cbfd 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelDiscBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplatterVoxelDiscBrush.java @@ -8,9 +8,7 @@ import org.bukkit.block.Block; import java.util.Random; -/** - * @author Voxel - */ + public class SplatterVoxelDiscBrush extends PerformBrush { private static final int GROW_PERCENT_MIN = 1; private static final int GROW_PERCENT_DEFAULT = 1000; @@ -87,8 +85,9 @@ public class SplatterVoxelDiscBrush extends PerformBrush { } // integrate tempsplat back into splat at end of iteration for (int x = 2 * v.getBrushSize(); x >= 0; x--) { - if (2 * v.getBrushSize() + 1 >= 0) + if (2 * v.getBrushSize() + 1 >= 0) { System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1); + } } } this.growPercent = gref; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplineBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplineBrush.java index cbfb580d6..1b7d60bdd 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplineBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/SplineBrush.java @@ -43,7 +43,7 @@ public class SplineBrush extends PerformBrush { this.ctrlPts.add(targetBlock); v.sendMessage(ChatColor.GRAY + "Added block " + ChatColor.RED + "(" + targetBlock.getX() + ", " + targetBlock.getY() + ", " + targetBlock.getZ() + ") " + ChatColor.GRAY - + "to control point selection"); + + "to control point selection"); } public final void removeFromSet(final SnipeData v, final boolean ep, Block targetBlock) { @@ -55,7 +55,7 @@ public class SplineBrush extends PerformBrush { this.endPts.add(targetBlock); v.sendMessage(ChatColor.GRAY + "Removed block " + ChatColor.RED + "(" + targetBlock.getX() + ", " + targetBlock.getY() + ", " + targetBlock.getZ() + ") " + ChatColor.GRAY - + "from endpoint selection"); + + "from endpoint selection"); return; } @@ -66,7 +66,7 @@ public class SplineBrush extends PerformBrush { this.ctrlPts.remove(targetBlock); v.sendMessage(ChatColor.GRAY + "Removed block " + ChatColor.RED + "(" + targetBlock.getX() + ", " + targetBlock.getY() + ", " + targetBlock.getZ() + ") " + ChatColor.GRAY - + "from control point selection"); + + "from control point selection"); } public final boolean spline(final Point start, final Point end, final Point c1, final Point c2, final SnipeData v) { @@ -146,7 +146,7 @@ public class SplineBrush extends PerformBrush { } @Override - public final void parameters(final String[] par, final com.thevoxelbox.voxelsniper.SnipeData v) { + public final void parameters(final String[] par, final SnipeData v) { for (int i = 1; i < par.length; i++) { if (par[i].equalsIgnoreCase("info")) { v.sendMessage(ChatColor.GOLD + "Spline brush parameters"); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StampBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StampBrush.java index 70d25f96d..febd39ba5 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StampBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StampBrush.java @@ -27,25 +27,14 @@ public class StampBrush extends Brush { this.sorted = false; } - /** - * @param id - * @return - */ protected final boolean falling(final int id) { return (id > 7 && id < 14); } - /** - * @param id - * @return - */ protected final boolean fallsOff(final int id) { return (BlockTypes.get(id).getMaterial().isFragileWhenPushed()); } - /** - * @param cb - */ @SuppressWarnings("deprecation") protected final void setBlock(final BlockWrapper cb) { final AsyncBlock block = this.clampY(this.getTargetBlock().getX() + cb.x, this.getTargetBlock().getY() + cb.y, this.getTargetBlock().getZ() + cb.z); @@ -54,9 +43,6 @@ public class StampBrush extends Brush { block.setPropertyId(cb.d); } - /** - * @param cb - */ @SuppressWarnings("deprecation") protected final void setBlockFill(final BlockWrapper cb) { final AsyncBlock block = this.clampY(this.getTargetBlock().getX() + cb.x, this.getTargetBlock().getY() + cb.y, this.getTargetBlock().getZ() + cb.z); @@ -67,16 +53,10 @@ public class StampBrush extends Brush { } } - /** - * @param type - */ protected final void setStamp(final StampType type) { this.stamp = type; } - /** - * @param v - */ protected final void stamp(final SnipeData v) { this.undo = new Undo(); @@ -116,9 +96,6 @@ public class StampBrush extends Brush { v.owner().storeUndo(this.undo); } - /** - * @param v - */ protected final void stampFill(final SnipeData v) { this.undo = new Undo(); @@ -159,9 +136,6 @@ public class StampBrush extends Brush { v.owner().storeUndo(this.undo); } - /** - * @param v - */ protected final void stampNoAir(final SnipeData v) { this.undo = new Undo(); @@ -238,16 +212,11 @@ public class StampBrush extends Brush { return "voxelsniper.brush.stamp"; } - /** - * @author Monofraps - */ protected enum StampType { NO_AIR, FILL, DEFAULT } - /** - * @author Voxel - */ + protected class BlockWrapper { public int id; public int x; @@ -255,13 +224,6 @@ public class StampBrush extends Brush { public int z; public int d; - /** - * @param b - * @param blx - * @param bly - * @param blz - */ - @SuppressWarnings("deprecation") public BlockWrapper(final AsyncBlock b, final int blx, final int bly, final int blz) { this.id = b.getTypeId(); this.d = b.getPropertyId(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilBrush.java index 8c02dce54..1a6e9b82f 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilBrush.java @@ -42,10 +42,7 @@ public class StencilBrush extends Brush { private int[] pastePoint = new int[3]; private byte point = 1; - /** - * - */ - public StencilBrush() { +public StencilBrush() { this.setName("Stencil"); } @@ -60,8 +57,7 @@ public class StencilBrush extends Brush { final File file = new File("plugins/VoxelSniper/stencils/" + this.filename + ".vstencil"); if (file.exists()) { - try { - final FaweInputStream in = new FaweInputStream(new DataInputStream(new GZIPInputStream(new BufferedInputStream(new FileInputStream(file))))); + try (final FaweInputStream in = new FaweInputStream(new DataInputStream(new GZIPInputStream(new BufferedInputStream(new FileInputStream(file)))))) { this.x = in.readShort(); this.z = in.readShort(); @@ -222,62 +218,62 @@ public class StencilBrush extends Brush { Files.createParentDirs(file); file.createNewFile(); - final FaweOutputStream out = new FaweOutputStream(new DataOutputStream(new PGZIPOutputStream(new BufferedOutputStream(new FileOutputStream(file))))); - int blockPositionX = Math.min(this.firstPoint[0], this.secondPoint[0]); - int blockPositionZ = Math.min(this.firstPoint[1], this.secondPoint[1]); - int blockPositionY = Math.min(this.firstPoint[2], this.secondPoint[2]); - out.writeShort(this.x); - out.writeShort(this.z); - out.writeShort(this.y); - out.writeShort(this.xRef); - out.writeShort(this.zRef); - out.writeShort(this.yRef); + try (FaweOutputStream out = new FaweOutputStream(new DataOutputStream(new PGZIPOutputStream(new BufferedOutputStream(new FileOutputStream(file)))))) { + int blockPositionX = Math.min(this.firstPoint[0], this.secondPoint[0]); + int blockPositionZ = Math.min(this.firstPoint[1], this.secondPoint[1]); + int blockPositionY = Math.min(this.firstPoint[2], this.secondPoint[2]); + out.writeShort(this.x); + out.writeShort(this.z); + out.writeShort(this.y); + out.writeShort(this.xRef); + out.writeShort(this.zRef); + out.writeShort(this.yRef); - v.sendMessage(ChatColor.AQUA + "Volume: " + this.x * this.z * this.y + " blockPositionX:" + blockPositionX + " blockPositionZ:" + blockPositionZ + " blockPositionY:" + blockPositionY); + v.sendMessage(ChatColor.AQUA + "Volume: " + this.x * this.z * this.y + " blockPositionX:" + blockPositionX + " blockPositionZ:" + blockPositionZ + " blockPositionY:" + blockPositionY); - int[] blockArray = new int[this.x * this.z * this.y]; - byte[] runSizeArray = new byte[this.x * this.z * this.y]; + int[] blockArray = new int[this.x * this.z * this.y]; + byte[] runSizeArray = new byte[this.x * this.z * this.y]; - int lastId = (this.getWorld().getBlockAt(blockPositionX, blockPositionY, blockPositionZ).getCombinedId()); - int thisId; - int counter = 0; - int arrayIndex = 0; - for (int y = 0; y < this.y; y++) { - for (int z = 0; z < this.z; z++) { - for (int x = 0; x < this.x; x++) { - AsyncBlock currentBlock = getWorld().getBlockAt(blockPositionX + x, blockPositionY + y, blockPositionZ + z); - thisId = (currentBlock.getCombinedId()); - if (thisId != lastId || counter == 255) { - blockArray[arrayIndex] = lastId; - runSizeArray[arrayIndex] = (byte) (counter - 128); - arrayIndex++; - counter = 1; - lastId = thisId; - } else { - counter++; - lastId = thisId; + int lastId = (this.getWorld().getBlockAt(blockPositionX, blockPositionY, blockPositionZ).getCombinedId()); + int thisId; + int counter = 0; + int arrayIndex = 0; + for (int y = 0; y < this.y; y++) { + for (int z = 0; z < this.z; z++) { + for (int x = 0; x < this.x; x++) { + AsyncBlock currentBlock = getWorld().getBlockAt(blockPositionX + x, blockPositionY + y, blockPositionZ + z); + thisId = (currentBlock.getCombinedId()); + if (thisId != lastId || counter == 255) { + blockArray[arrayIndex] = lastId; + runSizeArray[arrayIndex] = (byte) (counter - 128); + arrayIndex++; + counter = 1; + lastId = thisId; + } else { + counter++; + lastId = thisId; + } } } } - } - blockArray[arrayIndex] = lastId; // saving last run, which will always be left over. - runSizeArray[arrayIndex] = (byte) (counter - 128); + blockArray[arrayIndex] = lastId; // saving last run, which will always be left over. + runSizeArray[arrayIndex] = (byte) (counter - 128); - out.writeInt(arrayIndex + 1); - // v.sendMessage("number of runs = " + arrayIndex); - for (int i = 0; i < arrayIndex + 1; i++) { - if (runSizeArray[i] > -127) { - out.writeBoolean(true); - out.writeByte(runSizeArray[i]); - out.writeVarInt(blockArray[i]); - } else { - out.writeBoolean(false); - out.writeVarInt(blockArray[i]); + out.writeInt(arrayIndex + 1); + // v.sendMessage("number of runs = " + arrayIndex); + for (int i = 0; i < arrayIndex + 1; i++) { + if (runSizeArray[i] > -127) { + out.writeBoolean(true); + out.writeByte(runSizeArray[i]); + out.writeVarInt(blockArray[i]); + } else { + out.writeBoolean(false); + out.writeVarInt(blockArray[i]); + } } - } - v.sendMessage(ChatColor.BLUE + "Saved as '" + this.filename + "'."); - out.close(); + v.sendMessage(ChatColor.BLUE + "Saved as '" + this.filename + "'."); + } } catch (final Exception exception) { v.sendMessage(ChatColor.RED + "Something went wrong."); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilListBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilListBrush.java index 15c4a6f32..40550c890 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilListBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilListBrush.java @@ -12,9 +12,6 @@ import java.io.FileInputStream; import java.util.HashMap; import java.util.Scanner; -/** - * @author Gavjenks - */ public class StencilListBrush extends Brush { private byte pasteOption = 1; // 0 = full, 1 = fill, 2 = replace private String filename = "NoFileLoaded"; @@ -31,13 +28,13 @@ public class StencilListBrush extends Brush { this.setName("StencilList"); } - private String readRandomStencil(final SnipeData v) { + private String readRandomStencil() { double rand = Math.random() * (this.stencilList.size()); final int choice = (int) rand; return this.stencilList.get(choice); } - private void readStencilList(final String listname, final SnipeData v) { + private void readStencilList() { final File file = new File("plugins/VoxelSniper/stencilLists/" + this.filename + ".txt"); if (file.exists()) { try { @@ -61,16 +58,14 @@ public class StencilListBrush extends Brush { return; } - final String stencilName = this.readRandomStencil(v); + final String stencilName = this.readRandomStencil(); v.sendMessage(stencilName); final Undo undo = new Undo(); final File file = new File("plugins/VoxelSniper/stencils/" + stencilName + ".vstencil"); if (file.exists()) { - try { - final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file))); - + try (final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)))){ this.x = in.readShort(); this.z = in.readShort(); this.y = in.readShort(); @@ -221,14 +216,13 @@ public class StencilListBrush extends Brush { return; } - final String stencilName = this.readRandomStencil(v); + final String stencilName = this.readRandomStencil(); final Undo undo = new Undo(); final File file = new File("plugins/VoxelSniper/stencils/" + stencilName + ".vstencil"); if (file.exists()) { - try { - final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file))); + try (final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)))) { this.x = in.readShort(); this.z = in.readShort(); @@ -380,14 +374,13 @@ public class StencilListBrush extends Brush { return; } - final String stencilName = this.readRandomStencil(v); + final String stencilName = this.readRandomStencil(); final Undo undo = new Undo(); final File file = new File("plugins/VoxelSniper/stencils/" + stencilName + ".vstencil"); if (file.exists()) { - try { - final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file))); + try (final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)))) { this.x = in.readShort(); this.z = in.readShort(); @@ -547,7 +540,7 @@ public class StencilListBrush extends Brush { return; } - final String stencilName = this.readRandomStencil(v); + final String stencilName = this.readRandomStencil(); final Undo undo = new Undo(); final File file = new File("plugins/VoxelSniper/stencils/" + stencilName + ".vstencil"); @@ -701,7 +694,7 @@ public class StencilListBrush extends Brush { private void stencilPasteRotation(final SnipeData v) { // just randomly chooses a rotation and then calls stencilPaste. - this.readStencilList(this.filename, v); + this.readStencilList(); final double random = Math.random(); if (random < 0.26) { this.stencilPaste(v); @@ -753,7 +746,7 @@ public class StencilListBrush extends Brush { final File file = new File("plugins/VoxelSniper/stencilLists/" + this.filename + ".txt"); if (file.exists()) { v.sendMessage(ChatColor.RED + "Stencil List '" + this.filename + "' exists and was loaded."); - this.readStencilList(this.filename, v); + this.readStencilList(); } else { v.sendMessage(ChatColor.AQUA + "Stencil List '" + this.filename + "' does not exist. This brush will not function without a valid stencil list."); this.filename = "NoFileLoaded"; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ThreePointCircleBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ThreePointCircleBrush.java index 336a5c9f7..3a5c5500f 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ThreePointCircleBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ThreePointCircleBrush.java @@ -7,9 +7,6 @@ import org.bukkit.ChatColor; import org.bukkit.util.NumberConversions; import org.bukkit.util.Vector; -/** - * @author Giltwist - */ public class ThreePointCircleBrush extends PerformBrush { private Vector coordsOne; private Vector coordsTwo; @@ -157,12 +154,12 @@ public class ThreePointCircleBrush extends PerformBrush { public final void parameters(final String[] par, final SnipeData v) { if (par[1].equalsIgnoreCase("info")) { v.sendMessage(ChatColor.YELLOW + "3-Point Circle Brush instructions: Select three corners with the arrow brush, then generate the Circle with the powder brush."); - String toleranceOptions = ""; + StringBuilder toleranceOptions = new StringBuilder(); for (final Tolerance tolerance : Tolerance.values()) { - if (!toleranceOptions.isEmpty()) { - toleranceOptions += "|"; + if (toleranceOptions.length() > 0) { + toleranceOptions.append("|"); } - toleranceOptions += tolerance.name().toLowerCase(); + toleranceOptions.append(tolerance.name().toLowerCase()); } v.sendMessage(ChatColor.GOLD + "/b tpc " + toleranceOptions + " -- Toggle the calculations to emphasize accuracy or smoothness"); return; @@ -191,7 +188,9 @@ public class ThreePointCircleBrush extends PerformBrush { * @author MikeMatrix */ private enum Tolerance { - DEFAULT(1000), ACCURATE(10), SMOOTH(2000); + DEFAULT(1000), + ACCURATE(10), + SMOOTH(2000); private int value; Tolerance(final int value) { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/TreeSnipeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/TreeSnipeBrush.java index 530142441..f2ad22f41 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/TreeSnipeBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/TreeSnipeBrush.java @@ -12,10 +12,6 @@ import org.bukkit.Material; import org.bukkit.TreeType; import org.bukkit.block.BlockFace; - -/** - * @author Mick - */ public class TreeSnipeBrush extends Brush { private TreeType treeType = TreeType.TREE; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/TriangleBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/TriangleBrush.java index 846651a94..ac0a7d276 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/TriangleBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/TriangleBrush.java @@ -5,9 +5,6 @@ import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import org.bukkit.ChatColor; -/** - * @author Giltwist - */ public class TriangleBrush extends PerformBrush { private double[] coordsOne = new double[3]; // Three corners private double[] coordsTwo = new double[3]; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java index 925f6f51c..db38e29ff 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java @@ -7,10 +7,6 @@ import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import org.bukkit.ChatColor; -/** - * @author jmck95 Credit to GavJenks for framework and 95 of code. Big Thank you to GavJenks - */ - public class UnderlayBrush extends PerformBrush { private static final int DEFAULT_DEPTH = 3; private int depth = DEFAULT_DEPTH; @@ -43,8 +39,6 @@ public class UnderlayBrush extends PerformBrush { } break; - } else { - continue; } } else { for (int d = 0; (d < this.depth); d++) { @@ -86,8 +80,6 @@ public class UnderlayBrush extends PerformBrush { memory[x + v.getBrushSize()][z + v.getBrushSize()] = 1; // stop it from checking any other blocks in this vertical 1x1 column. } break; - } else { - continue; } } else { for (int d = -1; (d < this.depth - 1); d++) { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoltMeterBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoltMeterBrush.java index 702af9de3..2ded259b0 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoltMeterBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoltMeterBrush.java @@ -7,16 +7,12 @@ import org.bukkit.ChatColor; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -/** - * @author Gavjenks - */ public class VoltMeterBrush extends Brush { public VoltMeterBrush() { this.setName("VoltMeter"); } - @SuppressWarnings("deprecation") private void data(final SnipeData v) { final AsyncBlock block = this.clampY(this.getTargetBlock().getX(), this.getTargetBlock().getY(), this.getTargetBlock().getZ()); final int data = block.getPropertyId(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelBrush.java index c515ffc72..473e7e469 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelBrush.java @@ -4,9 +4,7 @@ import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; -/** - * @author Piotr - */ + public class VoxelBrush extends PerformBrush { public VoxelBrush() { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelDiscBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelDiscBrush.java index d01c6dba8..11f0c780d 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelDiscBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelDiscBrush.java @@ -5,9 +5,7 @@ import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; -/** - * @author Voxel - */ + public class VoxelDiscBrush extends PerformBrush { public VoxelDiscBrush() { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelDiscFaceBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelDiscFaceBrush.java index b5ce2b8d6..d6b795863 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelDiscFaceBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelDiscFaceBrush.java @@ -6,9 +6,7 @@ import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -/** - * @author Voxel - */ + public class VoxelDiscFaceBrush extends PerformBrush { public VoxelDiscFaceBrush() { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WarpBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WarpBrush.java index ee2925ed6..e242a5625 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WarpBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WarpBrush.java @@ -1,26 +1,26 @@ -/** - This file is part of VoxelSniper, licensed under the MIT License (MIT). +/* + This file is part of VoxelSniper, licensed under the MIT License (MIT). - Copyright (c) The VoxelBox - Copyright (c) contributors + Copyright (c) The VoxelBox + Copyright (c) contributors - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. */ package com.thevoxelbox.voxelsniper.brush; @@ -32,19 +32,12 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; -/** - * @author MikeMatrix - */ public class WarpBrush extends Brush { public WarpBrush() { this.setName("Warp"); } - public static Class inject() { - return WarpBrush.class; - } - @Override public final void info(final Message vm) { vm.brushName(this.getName()); @@ -86,4 +79,4 @@ public class WarpBrush extends Brush { public String getPermissionNode() { return "voxelsniper.brush.warp"; } -} \ No newline at end of file +} diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PerformBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PerformBrush.java index f12b8d646..5a874f194 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PerformBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/PerformBrush.java @@ -1,26 +1,26 @@ -/** - * This file is part of VoxelSniper, licensed under the MIT License (MIT). - *

- * Copyright (c) The VoxelBox - * Copyright (c) contributors - *

- * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - *

- * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - *

- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. +/* + This file is part of VoxelSniper, licensed under the MIT License (MIT). +

+ Copyright (c) The VoxelBox + Copyright (c) contributors +

+ Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: +

+ The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. +

+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. */ package com.thevoxelbox.voxelsniper.brush.perform; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/Performer.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/Performer.java index 5363d9a91..94d4094d8 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/Performer.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/Performer.java @@ -5,13 +5,12 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public interface Performer { - void parse(String[] args, com.thevoxelbox.voxelsniper.SnipeData v); + void parse(String[] args, SnipeData v); void showInfo(Message vm); } 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 398ebafec..273d9a3df 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 @@ -12,9 +12,7 @@ import java.util.TreeMap; import java.util.logging.Level; import java.util.logging.Logger; -/** - * @author Voxel - */ + /* The m/i/c system of naming performers: [replacement-option][extras] * diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pCombo.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pCombo.java index d65a5d2f4..19697b650 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pCombo.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pCombo.java @@ -6,10 +6,8 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; -/** - * @author Voxel - */ public class pCombo extends vPerformer { private int i; @@ -27,7 +25,7 @@ public class pCombo extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); i = v.getVoxelId(); d = v.getPropertyId(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboCombo.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboCombo.java index 9e8cbdb0e..ec39d01a4 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboCombo.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboCombo.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pComboCombo extends vPerformer { private int d; @@ -22,7 +21,7 @@ public class pComboCombo extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); dr = v.getReplaceData(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboComboNoPhys.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboComboNoPhys.java index 611cba2fd..0034ab6c3 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboComboNoPhys.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboComboNoPhys.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pComboComboNoPhys extends vPerformer { private int d; @@ -22,7 +21,7 @@ public class pComboComboNoPhys extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); dr = v.getReplaceData(); @@ -53,4 +52,4 @@ public class pComboComboNoPhys extends vPerformer { public boolean isUsingReplaceMaterial() { return true; } -} \ No newline at end of file +} diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboInk.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboInk.java index 61fc98e6b..c4ad7e7f9 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboInk.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboInk.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pComboInk extends vPerformer { private int d; @@ -21,7 +20,7 @@ public class pComboInk extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); dr = v.getReplaceData(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboInkNoPhys.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboInkNoPhys.java index 23aecb643..baa1e7c41 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboInkNoPhys.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboInkNoPhys.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pComboInkNoPhys extends vPerformer { private int d; @@ -21,7 +20,7 @@ public class pComboInkNoPhys extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); dr = v.getReplaceData(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboMat.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboMat.java index fca272002..c0fff13f1 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboMat.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboMat.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pComboMat extends vPerformer { private int d; @@ -21,7 +20,7 @@ public class pComboMat extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); i = v.getVoxelId(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboMatNoPhys.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboMatNoPhys.java index 989d28227..86f95a92c 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboMatNoPhys.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboMatNoPhys.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pComboMatNoPhys extends vPerformer { private int d; @@ -21,7 +20,7 @@ public class pComboMatNoPhys extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); i = v.getVoxelId(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboNoPhys.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboNoPhys.java index d4751538e..f591a1c50 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboNoPhys.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboNoPhys.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pComboNoPhys extends vPerformer { private int i; @@ -27,7 +26,7 @@ public class pComboNoPhys extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); i = v.getVoxelId(); d = v.getPropertyId(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboNoUndo.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboNoUndo.java index 3312bdb2c..c1d08f3e0 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboNoUndo.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pComboNoUndo.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pComboNoUndo extends vPerformer { private int i; @@ -20,7 +19,7 @@ public class pComboNoUndo extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); i = v.getVoxelId(); d = v.getPropertyId(); @@ -40,4 +39,4 @@ public class pComboNoUndo extends vPerformer { b.setTypeIdAndPropertyId(i, d, true); } } -} \ No newline at end of file +} diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pExcludeCombo.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pExcludeCombo.java index d9d7a6582..1531dac22 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pExcludeCombo.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pExcludeCombo.java @@ -6,11 +6,10 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.util.VoxelList; -/** - * @author Voxel - */ + public class pExcludeCombo extends vPerformer { private VoxelList excludeList; @@ -30,7 +29,7 @@ public class pExcludeCombo extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); id = v.getVoxelId(); data = v.getPropertyId(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pExcludeInk.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pExcludeInk.java index cd888ffc1..412a608e9 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pExcludeInk.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pExcludeInk.java @@ -6,11 +6,10 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.util.VoxelList; -/** - * @author Voxel - */ + public class pExcludeInk extends vPerformer { private VoxelList excludeList; @@ -28,7 +27,7 @@ public class pExcludeInk extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); data = v.getPropertyId(); excludeList = v.getVoxelList(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pExcludeMat.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pExcludeMat.java index cc08fd228..4eef243f8 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pExcludeMat.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pExcludeMat.java @@ -6,11 +6,10 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.util.VoxelList; -/** - * @author Voxel - */ + public class pExcludeMat extends vPerformer { private VoxelList excludeList; @@ -28,7 +27,7 @@ public class pExcludeMat extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); id = v.getVoxelId(); excludeList = v.getVoxelList(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pIncludeCombo.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pIncludeCombo.java index 42900375b..58134f7ae 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pIncludeCombo.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pIncludeCombo.java @@ -6,11 +6,10 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.util.VoxelList; -/** - * @author Voxel - */ + public class pIncludeCombo extends vPerformer { private VoxelList includeList; @@ -30,7 +29,7 @@ public class pIncludeCombo extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); id = v.getVoxelId(); data = v.getPropertyId(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pIncludeInk.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pIncludeInk.java index fed9e15c9..f8828956a 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pIncludeInk.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pIncludeInk.java @@ -6,11 +6,10 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.util.VoxelList; -/** - * @author Voxel - */ + public class pIncludeInk extends vPerformer { private VoxelList includeList; @@ -28,7 +27,7 @@ public class pIncludeInk extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); data = v.getPropertyId(); includeList = v.getVoxelList(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pIncludeMat.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pIncludeMat.java index d3af62180..4684581fb 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pIncludeMat.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pIncludeMat.java @@ -6,11 +6,10 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.util.VoxelList; -/** - * @author Voxel - */ + public class pIncludeMat extends vPerformer { private VoxelList includeList; @@ -28,7 +27,7 @@ public class pIncludeMat extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); id = v.getVoxelId(); includeList = v.getVoxelList(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInk.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInk.java index 90bce5498..4cec04c81 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInk.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInk.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pInk extends vPerformer { private int d; @@ -19,7 +18,7 @@ public class pInk extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkCombo.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkCombo.java index 4971662d5..81c603e21 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkCombo.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkCombo.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pInkCombo extends vPerformer { private int d; @@ -21,7 +20,7 @@ public class pInkCombo extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); dr = v.getReplaceData(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkComboNoPhys.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkComboNoPhys.java index 530e9db6b..f3172ab95 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkComboNoPhys.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkComboNoPhys.java @@ -2,10 +2,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pInkComboNoPhys extends vPerformer { private int d; @@ -17,7 +16,7 @@ public class pInkComboNoPhys extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); dr = v.getReplaceData(); @@ -45,4 +44,4 @@ public class pInkComboNoPhys extends vPerformer { public boolean isUsingReplaceMaterial() { return true; } -} \ No newline at end of file +} diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkInk.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkInk.java index 0bea5f28c..cf986654a 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkInk.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkInk.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pInkInk extends vPerformer { private int d; @@ -20,7 +19,7 @@ public class pInkInk extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); dr = v.getReplaceData(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkInkNoPhys.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkInkNoPhys.java index 35097450f..dc1da32d8 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkInkNoPhys.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkInkNoPhys.java @@ -2,10 +2,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pInkInkNoPhys extends vPerformer { private int d; @@ -16,7 +15,7 @@ public class pInkInkNoPhys extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); dr = v.getReplaceData(); @@ -42,4 +41,4 @@ public class pInkInkNoPhys extends vPerformer { public boolean isUsingReplaceMaterial() { return true; } -} \ No newline at end of file +} diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkMat.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkMat.java index 244fc7db8..41a4b213f 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkMat.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkMat.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pInkMat extends vPerformer { private int d; @@ -20,7 +19,7 @@ public class pInkMat extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); ir = v.getReplaceId(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkMatNoPhys.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkMatNoPhys.java index dae7e0392..a6c932c5f 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkMatNoPhys.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkMatNoPhys.java @@ -2,10 +2,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pInkMatNoPhys extends vPerformer { private int d; @@ -16,7 +15,7 @@ public class pInkMatNoPhys extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); ir = v.getReplaceId(); @@ -42,4 +41,4 @@ public class pInkMatNoPhys extends vPerformer { public boolean isUsingReplaceMaterial() { return true; } -} \ No newline at end of file +} diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkNoPhys.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkNoPhys.java index 9564828bc..b27941c90 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkNoPhys.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkNoPhys.java @@ -2,10 +2,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pInkNoPhys extends vPerformer { private int d; @@ -15,7 +14,7 @@ public class pInkNoPhys extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkNoUndo.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkNoUndo.java index 2591b16eb..0cc598220 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkNoUndo.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pInkNoUndo.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pInkNoUndo extends vPerformer { private int d; @@ -19,7 +18,7 @@ public class pInkNoUndo extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); d = v.getPropertyId(); } @@ -37,4 +36,4 @@ public class pInkNoUndo extends vPerformer { b.setPropertyId(d); } } -} \ No newline at end of file +} diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatCombo.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatCombo.java index 10b4ebdef..1cc30bbdf 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatCombo.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatCombo.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pMatCombo extends vPerformer { private int dr; @@ -21,7 +20,7 @@ public class pMatCombo extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); dr = v.getReplaceData(); i = v.getVoxelId(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatComboNophys.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatComboNophys.java index f52358b2e..00ed5b0b2 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatComboNophys.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatComboNophys.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pMatComboNophys extends vPerformer { private int dr; @@ -21,7 +20,7 @@ public class pMatComboNophys extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); dr = v.getReplaceData(); i = v.getVoxelId(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatInk.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatInk.java index d83bf3c55..d0d8dedf8 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatInk.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatInk.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pMatInk extends vPerformer { private int i; @@ -20,7 +19,7 @@ public class pMatInk extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); i = v.getVoxelId(); dr = v.getReplaceData(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatInkNoPhys.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatInkNoPhys.java index a15d26551..bb825b048 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatInkNoPhys.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatInkNoPhys.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pMatInkNoPhys extends vPerformer { private int i; @@ -20,7 +19,7 @@ public class pMatInkNoPhys extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); i = v.getVoxelId(); dr = v.getReplaceData(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatMat.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatMat.java index 10a7a731f..6faf085aa 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatMat.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatMat.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pMatMat extends vPerformer { private int i; @@ -20,7 +19,7 @@ public class pMatMat extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); i = v.getVoxelId(); r = v.getReplaceId(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatMatNoPhys.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatMatNoPhys.java index 83d80976d..66f4760c3 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatMatNoPhys.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMatMatNoPhys.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pMatMatNoPhys extends vPerformer { private int i; @@ -20,7 +19,7 @@ public class pMatMatNoPhys extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); i = v.getVoxelId(); r = v.getReplaceId(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMaterial.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMaterial.java index 27bb4c16c..cf5e8d25e 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMaterial.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMaterial.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pMaterial extends vPerformer { private int i; @@ -19,7 +18,7 @@ public class pMaterial extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); i = v.getVoxelId(); } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMaterialNoPhys.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMaterialNoPhys.java index 7a821570f..5471b0003 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMaterialNoPhys.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pMaterialNoPhys.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pMaterialNoPhys extends vPerformer { private int i; @@ -18,7 +17,7 @@ public class pMaterialNoPhys extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); i = v.getVoxelId(); } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pNoUndo.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pNoUndo.java index f62affc6f..0c524cc1e 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pNoUndo.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/pNoUndo.java @@ -6,10 +6,9 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + -/** - * @author Voxel - */ public class pNoUndo extends vPerformer { private int i; @@ -19,7 +18,7 @@ public class pNoUndo extends vPerformer { } @Override - public void init(com.thevoxelbox.voxelsniper.SnipeData v) { + public void init(SnipeData v) { w = v.getWorld(); i = v.getVoxelId(); } @@ -37,4 +36,4 @@ public class pNoUndo extends vPerformer { b.setTypeId(i); } } -} \ No newline at end of file +} diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/vPerformer.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/vPerformer.java index 2201adf52..9f2be4a83 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/vPerformer.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/perform/vPerformer.java @@ -6,12 +6,11 @@ package com.thevoxelbox.voxelsniper.brush.perform; import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.Undo; import org.bukkit.World; -/** - * @author Voxel - */ + public abstract class vPerformer { public String name = "Performer"; @@ -20,7 +19,7 @@ public abstract class vPerformer { public abstract void info(Message vm); - public abstract void init(com.thevoxelbox.voxelsniper.SnipeData v); + public abstract void init(SnipeData v); public void setUndo() { h = new Undo(); diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelVoxelCommand.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelVoxelCommand.java index 1910ee2ef..0efdfcd0b 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelVoxelCommand.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelVoxelCommand.java @@ -1,4 +1,4 @@ -/** +/* This file is part of VoxelSniper, licensed under the MIT License (MIT). Copyright (c) The VoxelBox diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperBrushChangedEvent.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperBrushChangedEvent.java index 3dd2b954b..37eb5f6d1 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperBrushChangedEvent.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperBrushChangedEvent.java @@ -1,4 +1,4 @@ -/** +/* This file is part of VoxelSniper, licensed under the MIT License (MIT). Copyright (c) The VoxelBox diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperMaterialChangedEvent.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperMaterialChangedEvent.java index e7801eb74..15d2e5a67 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperMaterialChangedEvent.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/event/SniperMaterialChangedEvent.java @@ -1,4 +1,4 @@ -/** +/* This file is part of VoxelSniper, licensed under the MIT License (MIT). Copyright (c) The VoxelBox diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/util/BlockWrapper.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/util/BlockWrapper.java index 7b29aa1a5..c1f80200d 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/util/BlockWrapper.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/util/BlockWrapper.java @@ -4,9 +4,6 @@ import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import org.bukkit.Material; import org.bukkit.World; -/** - * @author MikeMatrix - */ public class BlockWrapper { private int id; @@ -17,10 +14,6 @@ public class BlockWrapper { private int data; private World world; - /** - * @param block - */ - @SuppressWarnings("deprecation") public BlockWrapper(final AsyncBlock block) { this.setId(block.getTypeId()); this.setX(block.getX()); 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 5a1a05ce0..3b2624887 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 @@ -6,7 +6,6 @@ import com.boydti.fawe.bukkit.chat.BukkitChatManager; import com.boydti.fawe.bukkit.listener.AsyncTabCompleteListener; import com.boydti.fawe.bukkit.listener.BrushListener; import com.boydti.fawe.bukkit.listener.BukkitImageListener; -import com.boydti.fawe.bukkit.listener.CFIPacketListener; import com.boydti.fawe.bukkit.listener.RenderListener; import com.boydti.fawe.bukkit.listener.SyncTabCompleteListener; import com.boydti.fawe.bukkit.regions.ASkyBlockHook; @@ -429,7 +428,7 @@ public class FaweBukkit implements IFawe, Listener { final Plugin factionsPlugin = Bukkit.getServer().getPluginManager().getPlugin("Factions"); if ((factionsPlugin != null) && factionsPlugin.isEnabled()) { try { - managers.add(new FactionsFeature(factionsPlugin, this)); + managers.add(new FactionsFeature(factionsPlugin)); Fawe.debug("Plugin 'Factions' found. Using it now."); } catch (final Throwable e) { try { diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FactionsFeature.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FactionsFeature.java index bf33997e5..64e5743f6 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FactionsFeature.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FactionsFeature.java @@ -1,6 +1,5 @@ package com.boydti.fawe.bukkit.regions; -import com.boydti.fawe.bukkit.FaweBukkit; import com.boydti.fawe.object.FawePlayer; import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.Faction; @@ -13,11 +12,9 @@ import org.bukkit.event.Listener; import org.bukkit.plugin.Plugin; public class FactionsFeature extends BukkitMaskManager implements Listener { - FaweBukkit plugin; - public FactionsFeature(final Plugin factionsPlugin, final FaweBukkit p3) { + public FactionsFeature(final Plugin factionsPlugin) { super(factionsPlugin.getName()); - this.plugin = p3; } @Override diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitChunk_1_13.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitChunk_1_13.java index 9a67be5a9..f968cc856 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitChunk_1_13.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitChunk_1_13.java @@ -296,7 +296,7 @@ public class BukkitChunk_1_13 extends IntFaweChunk { @Override public Chunk getNewChunk() { - return ((BukkitQueue_1_13) getParent()).getWorld().getChunkAt(getX(), getZ()); + return getParent().getWorld().getChunkAt(getX(), getZ()); } public void optimize() { diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitQueue_1_13.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitQueue_1_13.java index 68041ca76..e24194071 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitQueue_1_13.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/v1_13/BukkitQueue_1_13.java @@ -1,12 +1,10 @@ package com.boydti.fawe.bukkit.v1_13; -import com.boydti.fawe.Fawe; import com.boydti.fawe.FaweCache; import com.boydti.fawe.bukkit.BukkitPlayer; import com.boydti.fawe.bukkit.adapter.v1_13_1.BlockMaterial_1_13; import com.boydti.fawe.bukkit.adapter.v1_13_1.Spigot_v1_13_R2; import com.boydti.fawe.bukkit.v0.BukkitQueue_0; -import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.Settings; import com.boydti.fawe.example.IntFaweChunk; import com.boydti.fawe.jnbt.anvil.BitArray4096; @@ -26,32 +24,7 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import net.minecraft.server.v1_13_R2.BiomeBase; -import net.minecraft.server.v1_13_R2.Block; -import net.minecraft.server.v1_13_R2.BlockPosition; -import net.minecraft.server.v1_13_R2.ChunkProviderServer; -import net.minecraft.server.v1_13_R2.ChunkSection; -import net.minecraft.server.v1_13_R2.DataBits; -import net.minecraft.server.v1_13_R2.DataPalette; -import net.minecraft.server.v1_13_R2.DataPaletteBlock; -import net.minecraft.server.v1_13_R2.DataPaletteHash; -import net.minecraft.server.v1_13_R2.DataPaletteLinear; -import net.minecraft.server.v1_13_R2.Entity; -import net.minecraft.server.v1_13_R2.EntityPlayer; -import net.minecraft.server.v1_13_R2.EnumSkyBlock; -import net.minecraft.server.v1_13_R2.GameProfileSerializer; -import net.minecraft.server.v1_13_R2.IBlockData; -import net.minecraft.server.v1_13_R2.NBTTagCompound; -import net.minecraft.server.v1_13_R2.Packet; -import net.minecraft.server.v1_13_R2.PacketDataSerializer; -import net.minecraft.server.v1_13_R2.PacketPlayOutMultiBlockChange; -import net.minecraft.server.v1_13_R2.PlayerChunk; -import net.minecraft.server.v1_13_R2.PlayerChunkMap; -import net.minecraft.server.v1_13_R2.RegistryID; -import net.minecraft.server.v1_13_R2.TileEntity; -import net.minecraft.server.v1_13_R2.WorldChunkManager; -import net.minecraft.server.v1_13_R2.WorldData; -import net.minecraft.server.v1_13_R2.WorldServer; +import net.minecraft.server.v1_13_R2.*; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.craftbukkit.v1_13_R2.CraftChunk; @@ -65,51 +38,50 @@ import java.util.Arrays; import java.util.Collection; import java.util.Map; import java.util.concurrent.atomic.LongAdder; -import java.util.function.Supplier; public class BukkitQueue_1_13 extends BukkitQueue_0 { - protected final static Field fieldBits; - protected final static Field fieldPalette; - protected final static Field fieldSize; + final static Field fieldBits; + final static Field fieldPalette; + final static Field fieldSize; - protected final static Field fieldHashBlocks; - protected final static Field fieldLinearBlocks; - protected final static Field fieldHashIndex; - protected final static Field fieldRegistryb; - protected final static Field fieldRegistryc; - protected final static Field fieldRegistryd; - protected final static Field fieldRegistrye; - protected final static Field fieldRegistryf; + final static Field fieldHashBlocks; + final static Field fieldLinearBlocks; + private final static Field fieldHashIndex; + final static Field fieldRegistryb; + final static Field fieldRegistryc; + final static Field fieldRegistryd; + final static Field fieldRegistrye; + final static Field fieldRegistryf; - protected final static Field fieldLinearIndex; - protected final static Field fieldDefaultBlock; + final static Field fieldLinearIndex; + final static Field fieldDefaultBlock; - protected final static Field fieldFluidCount; - protected final static Field fieldTickingBlockCount; - protected final static Field fieldNonEmptyBlockCount; - protected final static Field fieldSection; - protected final static Field fieldLiquidCount; - protected final static Field fieldEmittedLight; - protected final static Field fieldSkyLight; + private final static Field fieldFluidCount; + final static Field fieldTickingBlockCount; + final static Field fieldNonEmptyBlockCount; + final static Field fieldSection; + final static Field fieldLiquidCount; + private final static Field fieldEmittedLight; + private final static Field fieldSkyLight; // protected final static Field fieldBiomes; - protected final static Field fieldChunkGenerator; - protected final static Field fieldSeed; + private final static Field fieldChunkGenerator; + private final static Field fieldSeed; // protected final static Field fieldBiomeCache; // protected final static Field fieldBiomes2; - protected final static Field fieldGenLayer1; - protected final static Field fieldGenLayer2; - protected final static Field fieldSave; + private final static Field fieldGenLayer1; + private final static Field fieldGenLayer2; + private final static Field fieldSave; // protected final static MutableGenLayer genLayer; - protected final static ChunkSection emptySection; + private final static ChunkSection emptySection; // protected static final Method methodResize; - protected final static Field fieldDirtyCount; - protected final static Field fieldDirtyBits; + private final static Field fieldDirtyCount; + private final static Field fieldDirtyBits; static { try { @@ -131,10 +103,8 @@ public class BukkitQueue_1_13 extends BukkitQueue_0 palette; -// palette = new DataPaletteHash<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d, GameProfileSerializer::a); - palette = new DataPaletteLinear<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d); + DataPalette palette = new DataPaletteLinear<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d); // set palette for (int i = 0; i < num_palette; i++) { @@ -934,7 +902,7 @@ public class BukkitQueue_1_13 extends BukkitQueue_0> 4, z >> 4); } @Override - public void setBlockData(BlockData blockData) { + public void setBlockData(@NotNull BlockData blockData) { try { queue.setBlock(x, y, z, BukkitAdapter.adapt(blockData)); } catch (WorldEditException e) { @@ -185,12 +184,12 @@ public class AsyncBlock implements Block { } @Override - public void setBlockData(BlockData blockData, boolean b) { + public void setBlockData(@NotNull BlockData blockData, boolean b) { setBlockData(blockData); } @Override - public void setType(Material type) { + public void setType(@NotNull Material type) { try { queue.setBlock(x, y, z, BukkitAdapter.adapt(type).getDefaultState()); } catch (WorldEditException e) { @@ -199,12 +198,12 @@ public class AsyncBlock implements Block { } @Override - public void setType(Material type, boolean applyPhysics) { + public void setType(@NotNull Material type, boolean applyPhysics) { setType(type); } @Override - public BlockFace getFace(Block block) { + public BlockFace getFace(@NotNull Block block) { BlockFace[] directions = BlockFace.values(); for (BlockFace face : directions) { if (this.getX() + face.getModX() == block.getX() @@ -216,31 +215,28 @@ public class AsyncBlock implements Block { return null; } - @Override + @NotNull @Override public AsyncBlockState getState() { int combined = queue.getCombinedId4Data(x, y, z, 0); BlockType type = BlockTypes.getFromStateId(combined); - switch (type.getInternalId()) { - case BlockID.SIGN: - case BlockID.WALL_SIGN: - return new AsyncSign(this, combined); - default: - return new AsyncBlockState(this, combined); + if (type == BlockTypes.SIGN || type == BlockTypes.WALL_SIGN) { + return new AsyncSign(this, combined); } + return new AsyncBlockState(this, combined); } - @Override + @NotNull @Override public AsyncBlockState getState(boolean useSnapshot) { return getState(); } - @Override + @NotNull @Override public Biome getBiome() { return world.getAdapter().adapt(queue.getBiomeType(x, z)); } @Override - public void setBiome(Biome bio) { + public void setBiome(@NotNull Biome bio) { BiomeType biome = world.getAdapter().adapt(bio); queue.setBiome(x, z, biome); } @@ -256,17 +252,17 @@ public class AsyncBlock implements Block { } @Override - public boolean isBlockFacePowered(BlockFace face) { + public boolean isBlockFacePowered(@NotNull BlockFace face) { return false; } @Override - public boolean isBlockFaceIndirectlyPowered(BlockFace face) { + public boolean isBlockFaceIndirectlyPowered(@NotNull BlockFace face) { return false; } @Override - public int getBlockPower(BlockFace face) { + public int getBlockPower(@NotNull BlockFace face) { return 0; } @@ -313,37 +309,37 @@ public class AsyncBlock implements Block { } @Override - public boolean breakNaturally(ItemStack tool) { + public boolean breakNaturally(@NotNull ItemStack tool) { return TaskManager.IMP.sync(() -> getUnsafeBlock().breakNaturally(tool)); } - @Override + @NotNull @Override public Collection getDrops() { return TaskManager.IMP.sync(() -> getUnsafeBlock().getDrops()); } - @Override - public Collection getDrops(ItemStack tool) { + @NotNull @Override + public Collection getDrops(@NotNull ItemStack tool) { return TaskManager.IMP.sync(() -> getUnsafeBlock().getDrops(tool)); } @Override - public void setMetadata(String metadataKey, MetadataValue newMetadataValue) { + public void setMetadata(@NotNull String metadataKey, @NotNull MetadataValue newMetadataValue) { this.getUnsafeBlock().setMetadata(metadataKey, newMetadataValue); } - @Override - public List getMetadata(String metadataKey) { + @NotNull @Override + public List getMetadata(@NotNull String metadataKey) { return this.getUnsafeBlock().getMetadata(metadataKey); } @Override - public boolean hasMetadata(String metadataKey) { + public boolean hasMetadata(@NotNull String metadataKey) { return this.getUnsafeBlock().hasMetadata(metadataKey); } @Override - public void removeMetadata(String metadataKey, Plugin owningPlugin) { + public void removeMetadata(@NotNull String metadataKey, @NotNull Plugin owningPlugin) { this.getUnsafeBlock().removeMetadata(metadataKey, owningPlugin); } @@ -353,11 +349,11 @@ public class AsyncBlock implements Block { } @Override - public RayTraceResult rayTrace(Location arg0, Vector arg1, double arg2, FluidCollisionMode arg3) { + public RayTraceResult rayTrace(@NotNull Location arg0, @NotNull Vector arg1, double arg2, @NotNull FluidCollisionMode arg3) { return this.getUnsafeBlock().rayTrace(arg0, arg1, arg2, arg3); } - @Override + @NotNull @Override public BoundingBox getBoundingBox() { return this.getUnsafeBlock().getBoundingBox(); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java b/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java index 8266a9ec2..9d45e33ea 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/Fawe.java @@ -402,7 +402,7 @@ public class Fawe { } } catch (Throwable e) { debug("====== MEMORY LISTENER ERROR ======"); - MainUtil.handleError(e, false); + MainUtil.handleError(e); debug("==================================="); debug("FAWE needs access to the JVM memory system:"); debug(" - Change your Java security settings"); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAChunk.java b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAChunk.java index 4a53e22e2..2fb4ba534 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAChunk.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAChunk.java @@ -6,7 +6,6 @@ import com.boydti.fawe.object.FaweChunk; import com.boydti.fawe.object.FaweQueue; import com.boydti.fawe.object.io.FastByteArrayOutputStream; import com.boydti.fawe.object.number.MutableLong; -import com.boydti.fawe.util.ArrayUtil; import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.ReflectionUtils; @@ -191,8 +190,8 @@ public class MCAChunk extends FaweChunk { setNibble(endIndex, thisSkyLight, (byte) 0); setNibble(endIndex, thisBlockLight, (byte) 0); } - ArrayUtil.fill(thisSkyLight, startIndexShift, endIndexShift + 1, (byte) 0); - ArrayUtil.fill(thisBlockLight, startIndexShift, endIndexShift + 1, (byte) 0); + Arrays.fill(thisSkyLight, startIndexShift, endIndexShift + 1, (byte) 0); + Arrays.fill(thisBlockLight, startIndexShift, endIndexShift + 1, (byte) 0); } } continue; @@ -292,8 +291,8 @@ public class MCAChunk extends FaweChunk { if (otherIds == null) { if (currentIds != null) { Arrays.fill(currentIds, indexStart, indexEnd, 0); - ArrayUtil.fill(skyLight[thisLayer], indexStartShift, indexEndShift, (byte) 0); - ArrayUtil.fill(blockLight[thisLayer], indexStartShift, indexEndShift, (byte) 0); + Arrays.fill(skyLight[thisLayer], indexStartShift, indexEndShift, (byte) 0); + Arrays.fill(blockLight[thisLayer], indexStartShift, indexEndShift, (byte) 0); } } else { if (currentIds == null) { @@ -320,8 +319,8 @@ public class MCAChunk extends FaweChunk { continue; } Arrays.fill(thisIds, thisStartIndex, thisStartIndex + 256, 0); - ArrayUtil.fill(this.skyLight[thisLayer], thisStartIndexShift, thisStartIndexShift + 128, (byte) 0); - ArrayUtil.fill(this.blockLight[thisLayer], thisStartIndexShift, thisStartIndexShift + 128, (byte) 0); + Arrays.fill(this.skyLight[thisLayer], thisStartIndexShift, thisStartIndexShift + 128, (byte) 0); + Arrays.fill(this.blockLight[thisLayer], thisStartIndexShift, thisStartIndexShift + 128, (byte) 0); continue; } else if (thisIds == null) { ids[thisLayer] = thisIds = new int[4096]; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/filters/RemoveLayerFilter.java b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/filters/RemoveLayerFilter.java index 164377551..5e0acac44 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/filters/RemoveLayerFilter.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/jnbt/anvil/filters/RemoveLayerFilter.java @@ -3,7 +3,6 @@ package com.boydti.fawe.jnbt.anvil.filters; import com.boydti.fawe.jnbt.anvil.MCAChunk; import com.boydti.fawe.jnbt.anvil.MCAFilterCounter; import com.boydti.fawe.object.number.MutableLong; -import com.boydti.fawe.util.ArrayUtil; import com.sk89q.worldedit.world.block.BlockTypes; import java.util.Arrays; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/FawePlayer.java b/worldedit-core/src/main/java/com/boydti/fawe/object/FawePlayer.java index d36a4e8aa..73f13bb5b 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/FawePlayer.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/FawePlayer.java @@ -10,18 +10,35 @@ import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard; import com.boydti.fawe.object.exception.FaweException; import com.boydti.fawe.object.task.SimpleAsyncNotifyQueue; import com.boydti.fawe.regions.FaweMaskManager; -import com.boydti.fawe.util.*; +import com.boydti.fawe.util.EditSessionBuilder; +import com.boydti.fawe.util.MainUtil; +import com.boydti.fawe.util.SetQueue; +import com.boydti.fawe.util.TaskManager; +import com.boydti.fawe.util.WEManager; import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper; import com.boydti.fawe.wrappers.PlayerWrapper; import com.sk89q.minecraft.util.commands.CommandContext; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.EmptyClipboardException; +import com.sk89q.worldedit.IncompleteRegionException; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.event.platform.CommandEvent; -import com.sk89q.worldedit.extension.platform.*; +import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.extension.platform.CommandManager; +import com.sk89q.worldedit.extension.platform.PlatformManager; +import com.sk89q.worldedit.extension.platform.PlayerProxy; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.Vector3; -import com.sk89q.worldedit.regions.*; +import com.sk89q.worldedit.regions.ConvexPolyhedralRegion; +import com.sk89q.worldedit.regions.CylinderRegion; +import com.sk89q.worldedit.regions.Polygonal2DRegion; +import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.regions.RegionOperationException; +import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.ConvexPolyhedralRegionSelector; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; import com.sk89q.worldedit.regions.selector.CylinderRegionSelector; @@ -32,9 +49,12 @@ import javax.annotation.Nullable; import java.io.File; import java.io.IOException; import java.lang.reflect.Field; -import java.lang.reflect.Method; import java.text.NumberFormat; -import java.util.*; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Map; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; @@ -263,7 +283,7 @@ public abstract class FawePlayer extends Metadatable { e = e.getCause(); } if (e instanceof WorldEditException) { - sendMessage(BBC.getPrefix() + e.getLocalizedMessage()); + sendMessage(e.getLocalizedMessage()); } else { FaweException fe = FaweException.get(e); if (fe != null) { @@ -333,7 +353,7 @@ public abstract class FawePlayer extends Metadatable { } } catch (Exception event) { Fawe.debug("====== INVALID CLIPBOARD ======"); - MainUtil.handleError(event, false); + MainUtil.handleError(event); Fawe.debug("===============---============="); Fawe.debug("This shouldn't result in any failure"); Fawe.debug("File: " + file.getName() + " (len:" + file.length() + ")"); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/ArrayUtil.java b/worldedit-core/src/main/java/com/boydti/fawe/util/ArrayUtil.java deleted file mode 100644 index f5c2f8056..000000000 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/ArrayUtil.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.boydti.fawe.util; - -import java.util.Arrays; - -public class ArrayUtil { - public static final void fill(byte[] a, int fromIndex, int toIndex, byte val) { - for (int i = fromIndex; i < toIndex; i++) a[i] = val; - } - - public static final void fill(char[] a, int fromIndex, int toIndex, char val) { - for (int i = fromIndex; i < toIndex; i++) a[i] = val; - } - - public static T[] concatAll(T[] first, T[]... rest) { - int totalLength = first.length; - for (T[] array : rest) { - totalLength += array.length; - } - T[] result = Arrays.copyOf(first, totalLength); - int offset = first.length; - for (T[] array : rest) { - System.arraycopy(array, 0, result, offset, array.length); - offset += array.length; - } - return result; - } -} diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/ColorUtil.java b/worldedit-core/src/main/java/com/boydti/fawe/util/ColorUtil.java index 635e8247d..08f4a8c8c 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/ColorUtil.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/ColorUtil.java @@ -52,7 +52,7 @@ public class ColorUtil { float g = parseComponent(color, rend+1, gend, PARSE_COMPONENT); float b = parseComponent(color, gend+1, bend, PARSE_COMPONENT); return new Color(r, g, b); - } catch (NumberFormatException nfe) {} + } catch (NumberFormatException ignored) {} throw new IllegalArgumentException("Invalid color specification"); } @@ -67,7 +67,7 @@ public class ColorUtil { float s = parseComponent(color, hend+1, send, PARSE_PERCENT); float l = parseComponent(color, send+1, lend, PARSE_PERCENT); return Color.getHSBColor(h, s, l); - } catch (NumberFormatException nfe) {} + } catch (NumberFormatException ignored) {} throw new IllegalArgumentException("Invalid color specification"); } @@ -102,7 +102,7 @@ public class ColorUtil { } else { Color col = null; try { - Field field = java.awt.Color.class.getField(color.toLowerCase()); + Field field = Color.class.getField(color.toLowerCase()); col = (Color) field.get(null); } catch (Throwable ignore) {} if (col != null) { @@ -116,7 +116,6 @@ public class ColorUtil { int r; int g; int b; - int a; if (len == 3) { r = Integer.parseInt(color.substring(0, 1), 16); @@ -139,7 +138,7 @@ public class ColorUtil { b = Integer.parseInt(color.substring(4, 6), 16); return new Color(r, g, b); } - } catch (NumberFormatException nfe) {} + } catch (NumberFormatException ignored) {} throw new IllegalArgumentException("Invalid color specification"); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/FaweTimer.java b/worldedit-core/src/main/java/com/boydti/fawe/util/FaweTimer.java index f52a33e5f..dd785ffac 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/FaweTimer.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/FaweTimer.java @@ -1,5 +1,7 @@ package com.boydti.fawe.util; +import java.util.Arrays; + public class FaweTimer implements Runnable { private final double[] history = new double[]{20d, 20d, 20d, 20d, 20d, 20d, 20d, 20d, 20d, 20d, 20d, 20d, 20d, 20d, 20d, 20d, 20d, 20d, 20d, 20d}; @@ -7,7 +9,6 @@ public class FaweTimer implements Runnable { private long lastPoll = System.currentTimeMillis(); private long tickStart = System.currentTimeMillis(); private final long tickInterval = 5; - private final double millisPer20Interval = tickInterval * 50 * 20; private long tick = 0; private long tickMod = 0; @@ -24,6 +25,7 @@ public class FaweTimer implements Runnable { if (timeSpent == 0) { timeSpent = 1; } + double millisPer20Interval = tickInterval * 50 * 20; double tps = millisPer20Interval / timeSpent; history[historyIndex++] = tps; if (historyIndex >= history.length) { @@ -39,10 +41,7 @@ public class FaweTimer implements Runnable { if (tick < lastGetTPSTick + tickInterval) { return lastGetTPSValue; } - double total = 0; - for (double tps : history) { - total += tps; - } + double total = Arrays.stream(history).sum(); lastGetTPSValue = total / history.length; lastGetTPSTick = tick; return lastGetTPSValue; diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/FilteredTextureUtil.java b/worldedit-core/src/main/java/com/boydti/fawe/util/FilteredTextureUtil.java index 25a711786..62ea7eea7 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/FilteredTextureUtil.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/FilteredTextureUtil.java @@ -1,9 +1,5 @@ package com.boydti.fawe.util; -import com.boydti.fawe.FaweCache; - -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; @@ -41,4 +37,4 @@ public class FilteredTextureUtil extends TextureUtil { } this.calculateLayerArrays(); } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/ImgurUtility.java b/worldedit-core/src/main/java/com/boydti/fawe/util/ImgurUtility.java index 83a0a3087..a445bd27e 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/ImgurUtility.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/ImgurUtility.java @@ -8,6 +8,7 @@ import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.Base64; +import java.util.stream.Collectors; public class ImgurUtility { public static final String CLIENT_ID = "50e34b65351eb07"; @@ -48,17 +49,14 @@ public class ImgurUtility { conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.connect(); - StringBuilder stb = new StringBuilder(); + String stb; try (OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream())) { wr.write(data); wr.flush(); try (BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()))) { - String line; - while ((line = rd.readLine()) != null) { - stb.append(line).append("\n"); - } + stb = rd.lines().map(line -> line + "\n").collect(Collectors.joining()); } } - return stb.toString(); + return stb; } } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/MainUtil.java b/worldedit-core/src/main/java/com/boydti/fawe/util/MainUtil.java index 262c4e933..e74ad20fd 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/MainUtil.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/MainUtil.java @@ -3,19 +3,35 @@ package com.boydti.fawe.util; import com.boydti.fawe.Fawe; import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.Settings; -import com.boydti.fawe.object.*; +import com.boydti.fawe.object.FaweInputStream; +import com.boydti.fawe.object.FaweOutputStream; +import com.boydti.fawe.object.FawePlayer; +import com.boydti.fawe.object.RegionWrapper; +import com.boydti.fawe.object.RunnableVal; +import com.boydti.fawe.object.RunnableVal2; import com.boydti.fawe.object.changeset.CPUOptimizedChangeSet; import com.boydti.fawe.object.changeset.FaweStreamChangeSet; import com.boydti.fawe.object.io.AbstractDelegateOutputStream; import com.github.luben.zstd.ZstdInputStream; import com.github.luben.zstd.ZstdOutputStream; -import com.sk89q.jnbt.*; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.DoubleTag; +import com.sk89q.jnbt.IntTag; +import com.sk89q.jnbt.ListTag; +import com.sk89q.jnbt.StringTag; +import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.history.changeset.ChangeSet; import com.sk89q.worldedit.util.Location; -import net.jpountz.lz4.*; +import net.jpountz.lz4.LZ4BlockInputStream; +import net.jpountz.lz4.LZ4BlockOutputStream; +import net.jpountz.lz4.LZ4Compressor; +import net.jpountz.lz4.LZ4Factory; +import net.jpountz.lz4.LZ4FastDecompressor; +import net.jpountz.lz4.LZ4InputStream; +import net.jpountz.lz4.LZ4Utils; import javax.annotation.Nullable; import javax.imageio.ImageIO; @@ -24,23 +40,41 @@ import java.awt.image.BufferedImage; import java.io.*; import java.lang.reflect.Array; import java.lang.reflect.Method; -import java.net.*; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLConnection; import java.nio.channels.Channels; import java.nio.channels.FileChannel; import java.nio.channels.ReadableByteChannel; import java.nio.charset.StandardCharsets; -import java.nio.file.*; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.StandardCopyOption; import java.nio.file.attribute.BasicFileAttributes; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; import java.util.List; -import java.util.*; -import java.util.Map.Entry; +import java.util.Map; +import java.util.Scanner; +import java.util.UUID; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.regex.Pattern; -import java.util.zip.*; +import java.util.zip.DataFormatException; +import java.util.zip.Deflater; +import java.util.zip.GZIPInputStream; +import java.util.zip.Inflater; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; import static java.lang.System.arraycopy; @@ -105,10 +139,6 @@ public class MainUtil { return Double.parseDouble(version.substring(0, pos)); } - public static void stacktrace() { - new Exception().printStackTrace(); - } - public static void traverse(Path path, final BiConsumer onEach) { try { Files.walkFileTree(path, new SimpleFileVisitor() { @@ -201,10 +231,6 @@ public class MainUtil { return getFile(base, path.endsWith("." + extension) ? path : path + "." + extension); } - public static FaweOutputStream getCompressedOS(OutputStream os) throws IOException { - return getCompressedOS(os, Settings.IMP.HISTORY.COMPRESSION_LEVEL); - } - public static long getSize(ChangeSet changeSet) { if (changeSet instanceof FaweStreamChangeSet) { FaweStreamChangeSet fscs = (FaweStreamChangeSet) changeSet; @@ -230,7 +256,7 @@ public class MainUtil { return LZ4Utils.maxCompressedLength(size); } - public static byte[] compress(byte[] bytes, byte[] buffer, Deflater deflate) throws IOException { + public static byte[] compress(byte[] bytes, byte[] buffer, Deflater deflate) { if (buffer == null) { buffer = new byte[8192]; } @@ -359,7 +385,7 @@ public class MainUtil { } public static URL upload(UUID uuid, String file, String extension, final RunnableVal writeTask) { - return upload(Settings.IMP.WEB.URL, uuid != null, uuid != null ? uuid.toString() : (String) null, file, extension, writeTask); + return upload(Settings.IMP.WEB.URL, uuid != null, uuid != null ? uuid.toString() : null, file, extension, writeTask); } public static URL upload(String urlStr, boolean save, String uuid, String file, String extension, final RunnableVal writeTask) { @@ -397,7 +423,7 @@ public class MainUtil { writer.append(CRLF).flush(); OutputStream nonClosable = new AbstractDelegateOutputStream(new BufferedOutputStream(output)) { @Override - public void close() throws IOException { + public void close() { } // Don't close }; writeTask.value = nonClosable; @@ -444,36 +470,6 @@ public class MainUtil { } } - private static final Class[] parameters = new Class[]{URL.class}; - - public static ClassLoader loadURLClasspath(URL u) throws IOException { - ClassLoader sysloader = ClassLoader.getSystemClassLoader(); - - Class sysclass = URLClassLoader.class; - - try { - Method method = sysclass.getDeclaredMethod("addURL", parameters); - method.setAccessible(true); - if (sysloader instanceof URLClassLoader) { - method.invoke(sysloader, new Object[]{u}); - } else { - ClassLoader loader = MainUtil.class.getClassLoader(); - while (!(loader instanceof URLClassLoader) && loader.getParent() != null) { - loader = loader.getParent(); - } - if (loader instanceof URLClassLoader) { - method.invoke(sysloader, new Object[]{u}); - } else { - loader = new URLClassLoader(new URL[]{u}, MainUtil.class.getClassLoader()); - return loader; - } - } - } catch (Throwable throwable) { - throwable.printStackTrace(); - } - return sysloader; - } - public static String getText(String url) throws IOException { try (Scanner scanner = new Scanner(new URL(url).openStream(), "UTF-8")) { return scanner.useDelimiter("\\A").next(); @@ -481,8 +477,8 @@ public class MainUtil { } public static void download(URL url, File out) throws IOException { - File parent = out.getParentFile(); if (!out.exists()) { + File parent = out.getParentFile(); if (parent != null) { parent.mkdirs(); } @@ -666,30 +662,10 @@ public class MainUtil { } public static void handleError(Throwable e) { - handleError(e, true); - } - - public static void handleError(Throwable e, boolean debug) { if (e == null) { return; } -// if (!debug) { - e.printStackTrace(); - return; -// } -// String header = "====== FAWE: " + e.getLocalizedMessage() + " ======"; -// Fawe.debug(header); -// String[] trace = getTrace(e); -// for (int i = 0; i < trace.length && i < 8; i++) { -// Fawe.debug(" - " + trace[i]); -// } -// String[] cause = getTrace(e.getCause()); -// Fawe.debug("Cause: " + (cause.length == 0 ? "N/A" : "")); -// for (int i = 0; i < cause.length && i < 8; i++) { -// Fawe.debug(" - " + cause[i]); -// } -// Fawe.debug(StringMan.repeat("=", header.length())); - } + e.printStackTrace(); } public static String[] getTrace(Throwable e) { if (e == null) { @@ -732,40 +708,10 @@ public class MainUtil { return msg; } - public static void warnDeprecated(Class... alternatives) { - StackTraceElement[] stacktrace = new RuntimeException().getStackTrace(); - if (stacktrace.length > 1) { - for (int i = 1; i < stacktrace.length; i++) { - StackTraceElement stack = stacktrace[i]; - String s = stack.toString(); - if (s.startsWith("com.sk89q")) { - continue; - } - try { - StackTraceElement creatorElement = stacktrace[1]; - String className = creatorElement.getClassName(); - Class clazz = Class.forName(className); - String creator = clazz.getSimpleName(); - String packageName = clazz.getPackage().getName(); - - StackTraceElement deprecatedElement = stack; - String myName = Class.forName(deprecatedElement.getClassName()).getSimpleName(); - Fawe.debug("@" + creator + " used by " + myName + "." + deprecatedElement.getMethodName() + "():" + deprecatedElement.getLineNumber() + " is deprecated."); - Fawe.debug(" - Alternatives: " + StringMan.getString(alternatives)); - } catch (Throwable throwable) { - throwable.printStackTrace(); - } finally { - break; - } - } - } - } - public static int[] regionNameToCoords(String fileName) { int[] res = new int[2]; int len = fileName.length() - 4; int val = 0; - boolean neg = false; boolean reading = false; int index = 1; int numIndex = 1; @@ -904,7 +850,9 @@ public class MainUtil { StringBuilder toreturn = new StringBuilder(); if (time >= 33868800) { int years = (int) (time / 33868800); - time -= years * 33868800; + int time1 = years * 33868800; + System.out.println(time1); + time -= time1; toreturn.append(years + "y "); } if (time >= 604800) { @@ -980,10 +928,6 @@ public class MainUtil { return time; } - public static void deleteOlder(File directory, final long timeDiff) { - deleteOlder(directory, timeDiff, true); - } - public static void deleteOlder(File directory, final long timeDiff, boolean printDebug) { final long now = System.currentTimeMillis(); ForkJoinPool pool = new ForkJoinPool(); @@ -1002,45 +946,6 @@ public class MainUtil { } } - public static boolean deleteDirectory(File directory) { - return deleteDirectory(directory, true); - } - - public static boolean deleteDirectory(File directory, boolean printDebug) { - if (directory.exists()) { - File[] files = directory.listFiles(); - if (null != files) { - for (File file : files) { - if (file.isDirectory()) { - deleteDirectory(file, printDebug); - } else { - file.delete(); - if (printDebug) BBC.FILE_DELETED.send(null, file); - } - } - } - } - return (directory.delete()); - } - - public static boolean isValidTag(Tag tag) { - if (tag instanceof EndTag) { - return false; - } else if (tag instanceof ListTag) { - ListTag lt = (ListTag) tag; - if ((lt).getType() == EndTag.class) { - return false; - } - } else if (tag instanceof CompoundTag) { - for (Entry entry : ((CompoundTag) tag).getValue().entrySet()) { - if (!isValidTag(entry.getValue())) { - return false; - } - } - } - return true; - } - public enum OS { LINUX, WINDOWS, MACOS, UNKNOWN; } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/RandomTextureUtil.java b/worldedit-core/src/main/java/com/boydti/fawe/util/RandomTextureUtil.java index 461f760e4..17fe56f2d 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/RandomTextureUtil.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/RandomTextureUtil.java @@ -89,12 +89,10 @@ public class RandomTextureUtil extends CachedTextureUtil { BlockType res = super.getNearestBlock(offsetColor); if (res == null) return null; int newColor = getColor(res); - { - byte dr = (byte) (((color >> 16) & 0xFF) - ((newColor >> 16) & 0xFF)); - byte dg = (byte) (((color >> 8) & 0xFF) - ((newColor >> 8) & 0xFF)); - byte db = (byte) (((color >> 0) & 0xFF) - ((newColor >> 0) & 0xFF)); - offsets.put(color, (Integer) ((dr << 16) + (dg << 8) + (db << 0))); - } + byte dr = (byte) (((color >> 16) & 0xFF) - ((newColor >> 16) & 0xFF)); + byte dg = (byte) (((color >> 8) & 0xFF) - ((newColor >> 8) & 0xFF)); + byte db = (byte) (((color >> 0) & 0xFF) - ((newColor >> 0) & 0xFF)); + offsets.put(color, (Integer) ((dr << 16) + (dg << 8) + (db << 0))); return res; } } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils.java b/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils.java index 8ab6b1cda..d9248121c 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/ReflectionUtils.java @@ -1,5 +1,9 @@ package com.boydti.fawe.util; +import sun.reflect.ConstructorAccessor; +import sun.reflect.FieldAccessor; +import sun.reflect.ReflectionFactory; + import java.lang.reflect.AccessibleObject; import java.lang.reflect.Array; import java.lang.reflect.Constructor; @@ -7,17 +11,13 @@ import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; -import sun.reflect.ConstructorAccessor; -import sun.reflect.FieldAccessor; -import sun.reflect.ReflectionFactory; - -/** - * @author DPOH-VAR - * @version 1.0 - */ -@SuppressWarnings({"UnusedDeclaration", "rawtypes"}) public class ReflectionUtils { public static T as(Class t, Object o) { return t.isInstance(o) ? t.cast(o) : null; @@ -77,46 +77,6 @@ public class ReflectionUtils { } } - public static > void clearEnum(Class enumType) { - // 0. Sanity checks - if (!Enum.class.isAssignableFrom(enumType)) { - throw new RuntimeException("class " + enumType + " is not an instance of Enum"); - } - // 1. Lookup "$VALUES" holder in enum class and get previous enum instances - Field valuesField = null; - Field[] fields = enumType.getDeclaredFields(); - for (Field field : fields) { - if (field.getName().contains("$VALUES")) { - valuesField = field; - break; - } - } - AccessibleObject.setAccessible(new Field[]{valuesField}, true); - try { - setFailsafeFieldValue(valuesField, null, Array.newInstance(enumType, 0)); - // 6. Clean enum cache - cleanEnumCache(enumType); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e.getMessage(), e); - } - } - - public static > void copyEnum(T dest, String value, Class[] additionalTypes, Object[] additionalValues) { - try { - Class clazz = dest.getClass(); - Object newEnum = makeEnum(clazz, value, dest.ordinal(), additionalTypes, additionalValues); - for (Field field : clazz.getDeclaredFields()) { - if (Modifier.isStatic(field.getModifiers())) continue; - field.setAccessible(true); - Object newValue = field.get(newEnum); - setField(field, dest, newValue); - } - } catch (Throwable e) { - e.printStackTrace(); - } - } - public static Object makeEnum(Class enumClass, String value, int ordinal, Class[] additionalTypes, Object[] additionalValues) throws Exception { Object[] parms = new Object[additionalValues.length + 2]; @@ -358,15 +318,6 @@ public class ReflectionUtils { } } - public static void setField(String fieldName, Object instance, Object value) { - try { - Field field = instance.getClass().getDeclaredField(fieldName); - setField(field, instance, value); - } catch (NoSuchFieldException e) { - throw new RuntimeException(e); - } - } - public static void setField(final Field field, final Object instance, final Object value) { if (field == null) { throw new RuntimeException("No such field"); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/ShapeInterpolator.java b/worldedit-core/src/main/java/com/boydti/fawe/util/ShapeInterpolator.java deleted file mode 100644 index 1a4bd2e57..000000000 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/ShapeInterpolator.java +++ /dev/null @@ -1,738 +0,0 @@ -package com.boydti.fawe.util; - -import java.awt.Rectangle; -import java.awt.Shape; -import java.awt.geom.AffineTransform; -import java.awt.geom.FlatteningPathIterator; -import java.awt.geom.IllegalPathStateException; -import java.awt.geom.Path2D; -import java.awt.geom.PathIterator; -import java.awt.geom.Point2D; -import java.awt.geom.Rectangle2D; -import java.util.Vector; - -/** - * Original source
- * An interpolator for {@link Shape} objects. - * This class can be used to morph between the geometries - * of two relatively arbitrary shapes with the only restrictions being - * that the two different numbers of sub-paths or two shapes with - * disparate winding rules may not blend together in a pleasing - * manner. - * The ShapeEvaluator will do the best job it can if the shapes do - * not match in winding rule or number of sub-paths, but the geometry - * of the shapes may need to be adjusted by other means to make the - * shapes more like each other for best aesthetic effect. - *

- * Note that the process of comparing two geometries and finding similar - * structures between them to blend for the morphing operation can be - * expensive. - * Instances of this class will properly perform the necessary - * geometric analysis of their arguments on every method call and attempt - * to cache the information so that they can operate more quickly if called - * multiple times in a row on the same pair of {@code Shape} objects. - * As a result attempting to mutate a {@code Shape} object that is stored - * in one of their keyframes may not have any effect if the associated - * interpolator has already cached the geometry. - * Also, it is advisable to use different instances of {@code ShapeEvaluator} - * for every pair of keyframes being morphed so that the cached information - * can be reused as much as possible. - */ -public class ShapeInterpolator { - - private Shape savedV0; - private Shape savedV1; - private Geometry geom0; - private Geometry geom1; - - public static Shape apply(Shape v0, Shape v1, float fraction) { - return apply(v0, v1, fraction, false); - } - - public static Shape apply(Shape v0, Shape v1, float fraction, boolean unionBounds) { - final ShapeInterpolator instance = new ShapeInterpolator(); - return instance.evaluate(v0, v1, fraction, unionBounds); - } - - /** - * Creates an interpolated shape from tight bounds. - */ - public Shape evaluate(Shape v0, Shape v1, float fraction) { - return evaluate(v0, v1, fraction, false); - } - - /** - * Creates an interpolated shape. - * - * @param v0 the first shape - * @param v1 the second shape - * @param fraction the fraction from zero (just first shape) to one (just second shape) - * @param unionBounds if `true`, the shape reports bounds which are the union of - * the bounds of both shapes, if `false` it reports "tight" bounds - * using the actual interpolated path. - */ - public Shape evaluate(Shape v0, Shape v1, float fraction, boolean unionBounds) { - if (savedV0 != v0 || savedV1 != v1) { - if (savedV0 == v1 && savedV1 == v0) { - // Just swap the geometries - final Geometry tmp = geom0; - geom0 = geom1; - geom1 = tmp; - } else { - recalculate(v0, v1); - } - savedV0 = v0; - savedV1 = v1; - } - return getShape(fraction, unionBounds); - } - - private void recalculate(Shape v0, Shape v1) { - geom0 = new Geometry(v0); - geom1 = new Geometry(v1); - final float[] tVals0 = geom0.getTVals(); - final float[] tVals1 = geom1.getTVals(); - final float[] masterTVals = mergeTVals(tVals0, tVals1); - geom0.setTVals(masterTVals); - geom1.setTVals(masterTVals); - } - - private Shape getShape(float fraction, boolean unionBounds) { - return new MorphedShape(geom0, geom1, fraction, unionBounds); - } - - private static float[] mergeTVals(float[] tVals0, float[] tVals1) { - final int count = sortTVals(tVals0, tVals1, null); - final float[] newTVals = new float[count]; - sortTVals(tVals0, tVals1, newTVals); - return newTVals; - } - - private static int sortTVals(float[] tVals0, - float[] tVals1, - float[] newTVals) { - int i0 = 0; - int i1 = 0; - int numTVals = 0; - while (i0 < tVals0.length && i1 < tVals1.length) { - final float t0 = tVals0[i0]; - final float t1 = tVals1[i1]; - if (t0 <= t1) { - if (newTVals != null) { - newTVals[numTVals] = t0; - } - i0++; - } - if (t1 <= t0) { - if (newTVals != null) { - newTVals[numTVals] = t1; - } - i1++; - } - numTVals++; - } - return numTVals; - } - - private static float interp(float v0, float v1, float t) { - return (v0 + ((v1 - v0) * t)); - } - - private static class Geometry { - static final float THIRD = (1f / 3f); - static final float MIN_LEN = 0.001f; - - final int windingRule; - float[] bezierCoordinates; - int numCoordinates; - float[] myTVals; - - public Geometry(Shape s) { - // Multiple of 6 plus 2 more for initial move-to - bezierCoordinates = new float[20]; - final PathIterator pi = s.getPathIterator(null); - windingRule = pi.getWindingRule(); - if (pi.isDone()) { - // We will have 1 segment and it will be all zeros - // It will have 8 coordinates (2 for move-to, 6 for cubic) - numCoordinates = 8; - } - final float[] coordinates = new float[6]; - int type = pi.currentSegment(coordinates); - pi.next(); - if (type != PathIterator.SEG_MOVETO) { - throw new IllegalPathStateException("missing initial move-to"); - } - float curX, curY, movX, movY; - bezierCoordinates[0] = curX = movX = coordinates[0]; - bezierCoordinates[1] = curY = movY = coordinates[1]; - float newX, newY; - final Vector savedPathEndPoints = new Vector<>(); - numCoordinates = 2; - while (!pi.isDone()) { - switch (pi.currentSegment(coordinates)) { - case PathIterator.SEG_MOVETO: - if (curX != movX || curY != movY) { - appendLineTo(curX, curY, movX, movY); - curX = movX; - curY = movY; - } - newX = coordinates[0]; - newY = coordinates[1]; - if (curX != newX || curY != newY) { - savedPathEndPoints.add(new Point2D.Float(movX, movY)); - appendLineTo(curX, curY, newX, newY); - curX = movX = newX; - curY = movY = newY; - } - break; - case PathIterator.SEG_CLOSE: - if (curX != movX || curY != movY) { - appendLineTo(curX, curY, movX, movY); - curX = movX; - curY = movY; - } - break; - case PathIterator.SEG_LINETO: - newX = coordinates[0]; - newY = coordinates[1]; - appendLineTo(curX, curY, newX, newY); - curX = newX; - curY = newY; - break; - case PathIterator.SEG_QUADTO: - final float ctrlX = coordinates[0]; - final float ctrlY = coordinates[1]; - newX = coordinates[2]; - newY = coordinates[3]; - appendQuadTo(curX, curY, ctrlX, ctrlY, newX, newY); - curX = newX; - curY = newY; - break; - case PathIterator.SEG_CUBICTO: - newX = coordinates[4]; - newY = coordinates[5]; - appendCubicTo( - coordinates[0], coordinates[1], - coordinates[2], coordinates[3], - newX, newY); - curX = newX; - curY = newY; - break; - } - pi.next(); - } - // Add closing segment if either: - // - we only have initial move-to - expand it to an empty cubic - // - or we are not back to the starting point - if ((numCoordinates < 8) || curX != movX || curY != movY) { - appendLineTo(curX, curY, movX, movY); - curX = movX; - curY = movY; - } - // Now retrace our way back through all of the connecting - // inter-sub-path segments - for (int i = savedPathEndPoints.size() - 1; i >= 0; i--) { - final Point2D.Float p = savedPathEndPoints.get(i); - newX = p.x; - newY = p.y; - if (curX != newX || curY != newY) { - appendLineTo(curX, curY, newX, newY); - curX = newX; - curY = newY; - } - } - // Now find the segment endpoint with the smallest Y coordinate - int minPt = 0; - float minX = bezierCoordinates[0]; - float minY = bezierCoordinates[1]; - for (int ci = 6; ci < numCoordinates; ci += 6) { - float x = bezierCoordinates[ci]; - float y = bezierCoordinates[ci + 1]; - if (y < minY || (y == minY && x < minX)) { - minPt = ci; - minX = x; - minY = y; - } - } - // If the smallest Y coordinate is not the first coordinate, - // rotate the points so that it is... - if (minPt > 0) { - // Keep in mind that first 2 coordinates == last 2 coordinates - final float[] newCoordinates = new float[numCoordinates]; - // Copy all coordinates from minPt to the end of the - // array to the beginning of the new array - System.arraycopy(bezierCoordinates, minPt, - newCoordinates, 0, - numCoordinates - minPt); - // Now we do not want to copy 0,1 as they are duplicates - // of the last 2 coordinates which we just copied. So - // we start the source copy at index 2, but we still - // copy a full minPt coordinates which copies the two - // coordinates that were at minPt to the last two elements - // of the array, thus ensuring that thew new array starts - // and ends with the same pair of coordinates... - System.arraycopy(bezierCoordinates, 2, - newCoordinates, numCoordinates - minPt, - minPt); - bezierCoordinates = newCoordinates; - } - /* Clockwise enforcement: - * - This technique is based on the formula for calculating - * the area of a Polygon. The standard formula is: - * Area(Poly) = 1/2 * sum(x[i]*y[i+1] - x[i+1]y[i]) - * - The returned area is negative if the polygon is - * "mostly clockwise" and positive if the polygon is - * "mostly counter-clockwise". - * - One failure mode of the Area calculation is if the - * Polygon is self-intersecting. This is due to the - * fact that the areas on each side of the self-intersection - * are bounded by segments which have opposite winding - * direction. Thus, those areas will have opposite signs - * on the accumulation of their area summations and end - * up canceling each other out partially. - * - This failure mode of the algorithm in determining the - * exact magnitude of the area is not actually a big problem - * for our needs here since we are only using the sign of - * the resulting area to figure out the overall winding - * direction of the path. If self-intersections cause - * different parts of the path to disagree as to the - * local winding direction, that is no matter as we just - * wait for the final answer to tell us which winding - * direction had greater representation. If the final - * result is zero then the path was equal parts clockwise - * and counter-clockwise and we do not care about which - * way we order it as either way will require half of the - * path to unwind and re-wind itself. - */ - float area = 0; - // Note that first and last points are the same so we - // do not need to process coordinates[0,1] against coordinates[n-2,n-1] - curX = bezierCoordinates[0]; - curY = bezierCoordinates[1]; - for (int i = 2; i < numCoordinates; i += 2) { - newX = bezierCoordinates[i]; - newY = bezierCoordinates[i + 1]; - area += curX * newY - newX * curY; - curX = newX; - curY = newY; - } - if (area < 0) { - /* The area is negative so the shape was clockwise - * in a Euclidean sense. But, our screen coordinate - * systems have the origin in the upper left so they - * are flipped. Thus, this path "looks" ccw on the - * screen so we are flipping it to "look" clockwise. - * Note that the first and last points are the same - * so we do not need to swap them. - * (Not that it matters whether the paths end up cw - * or ccw in the end as long as all of them are the - * same, but above we called this section "Clockwise - * Enforcement", so we do not want to be liars. ;-) - */ - // Note that [0,1] do not need to be swapped with [n-2,n-1] - // So first pair to swap is [2,3] and [n-4,n-3] - int i = 2; - int j = numCoordinates - 4; - while (i < j) { - curX = bezierCoordinates[i]; - curY = bezierCoordinates[i + 1]; - bezierCoordinates[i] = bezierCoordinates[j]; - bezierCoordinates[i + 1] = bezierCoordinates[j + 1]; - bezierCoordinates[j] = curX; - bezierCoordinates[j + 1] = curY; - i += 2; - j -= 2; - } - } - } - - private void appendLineTo(float x0, float y0, - float x1, float y1) { - appendCubicTo(// A third of the way from xy0 to xy1: - interp(x0, x1, THIRD), - interp(y0, y1, THIRD), - // A third of the way from xy1 back to xy0: - interp(x1, x0, THIRD), - interp(y1, y0, THIRD), - x1, y1); - } - - private void appendQuadTo(float x0, float y0, - float ctrlX, float ctrlY, - float x1, float y1) { - appendCubicTo(// A third of the way from ctrl X/Y back to xy0: - interp(ctrlX, x0, THIRD), - interp(ctrlY, y0, THIRD), - // A third of the way from ctrl X/Y to xy1: - interp(ctrlX, x1, THIRD), - interp(ctrlY, y1, THIRD), - x1, y1); - } - - private void appendCubicTo(float ctrlX1, float ctrlY1, - float ctrlX2, float ctrlY2, - float x1, float y1) { - if (numCoordinates + 6 > bezierCoordinates.length) { - // Keep array size to a multiple of 6 plus 2 - int newsize = (numCoordinates - 2) * 2 + 2; - final float[] newCoordinates = new float[newsize]; - System.arraycopy(bezierCoordinates, 0, newCoordinates, 0, numCoordinates); - bezierCoordinates = newCoordinates; - } - bezierCoordinates[numCoordinates++] = ctrlX1; - bezierCoordinates[numCoordinates++] = ctrlY1; - bezierCoordinates[numCoordinates++] = ctrlX2; - bezierCoordinates[numCoordinates++] = ctrlY2; - bezierCoordinates[numCoordinates++] = x1; - bezierCoordinates[numCoordinates++] = y1; - } - - public int getWindingRule() { - return windingRule; - } - - public int getNumCoordinates() { - return numCoordinates; - } - - public float getCoordinate(int i) { - return bezierCoordinates[i]; - } - - public float[] getTVals() { - if (myTVals != null) { - return myTVals; - } - - // assert(numCoordinates >= 8); - // assert(((numCoordinates - 2) % 6) == 0); - final float[] tVals = new float[(numCoordinates - 2) / 6 + 1]; - - // First calculate total "length" of path - // Length of each segment is averaged between - // the length between the endpoints (a lower bound for a cubic) - // and the length of the control polygon (an upper bound) - float segX = bezierCoordinates[0]; - float segY = bezierCoordinates[1]; - float tLen = 0; - int ci = 2; - int ti = 0; - while (ci < numCoordinates) { - float prevX, prevY, newX, newY; - prevX = segX; - prevY = segY; - newX = bezierCoordinates[ci++]; - newY = bezierCoordinates[ci++]; - prevX -= newX; - prevY -= newY; - float len = (float) Math.sqrt(prevX * prevX + prevY * prevY); - prevX = newX; - prevY = newY; - newX = bezierCoordinates[ci++]; - newY = bezierCoordinates[ci++]; - prevX -= newX; - prevY -= newY; - len += (float) Math.sqrt(prevX * prevX + prevY * prevY); - prevX = newX; - prevY = newY; - newX = bezierCoordinates[ci++]; - newY = bezierCoordinates[ci++]; - prevX -= newX; - prevY -= newY; - len += (float) Math.sqrt(prevX * prevX + prevY * prevY); - // len is now the total length of the control polygon - segX -= newX; - segY -= newY; - len += (float) Math.sqrt(segX * segX + segY * segY); - // len is now sum of linear length and control polygon length - len /= 2; - // len is now average of the two lengths - - /* If the result is zero length then we will have problems - * below trying to do the math and bookkeeping to split - * the segment or pair it against the segments in the - * other shape. Since these lengths are just estimates - * to map the segments of the two shapes onto corresponding - * segments of "approximately the same length", we will - * simply modify the length of this segment to be at least - * a minimum value and it will simply grow from zero or - * near zero length to a non-trivial size as it morphs. - */ - if (len < MIN_LEN) { - len = MIN_LEN; - } - tLen += len; - tVals[ti++] = tLen; - segX = newX; - segY = newY; - } - - // Now set tVals for each segment to its proportional - // part of the length - float prevT = tVals[0]; - tVals[0] = 0; - for (ti = 1; ti < tVals.length - 1; ti++) { - final float nextT = tVals[ti]; - tVals[ti] = prevT / tLen; - prevT = nextT; - } - tVals[ti] = 1; - return (myTVals = tVals); - } - - public void setTVals(float[] newTVals) { - final float[] oldCoordinates = bezierCoordinates; - final float[] newCoordinates = new float[2 + (newTVals.length - 1) * 6]; - final float[] oldTVals = getTVals(); - int oldCi = 0; - float x0, xc0, xc1, x1; - float y0, yc0, yc1, y1; - x0 = xc0 = xc1 = x1 = oldCoordinates[oldCi++]; - y0 = yc0 = yc1 = y1 = oldCoordinates[oldCi++]; - int newCi = 0; - newCoordinates[newCi++] = x0; - newCoordinates[newCi++] = y0; - float t0 = 0; - float t1 = 0; - int oldTi = 1; - int newTi = 1; - while (newTi < newTVals.length) { - if (t0 >= t1) { - x0 = x1; - y0 = y1; - xc0 = oldCoordinates[oldCi++]; - yc0 = oldCoordinates[oldCi++]; - xc1 = oldCoordinates[oldCi++]; - yc1 = oldCoordinates[oldCi++]; - x1 = oldCoordinates[oldCi++]; - y1 = oldCoordinates[oldCi++]; - t1 = oldTVals[oldTi++]; - } - float nt = newTVals[newTi++]; - // assert(nt > t0); - if (nt < t1) { - // Make nt proportional to [t0 => t1] range - float relT = (nt - t0) / (t1 - t0); - newCoordinates[newCi++] = x0 = interp(x0, xc0, relT); - newCoordinates[newCi++] = y0 = interp(y0, yc0, relT); - xc0 = interp(xc0, xc1, relT); - yc0 = interp(yc0, yc1, relT); - xc1 = interp(xc1, x1, relT); - yc1 = interp(yc1, y1, relT); - newCoordinates[newCi++] = x0 = interp(x0, xc0, relT); - newCoordinates[newCi++] = y0 = interp(y0, yc0, relT); - xc0 = interp(xc0, xc1, relT); - yc0 = interp(yc0, yc1, relT); - newCoordinates[newCi++] = x0 = interp(x0, xc0, relT); - newCoordinates[newCi++] = y0 = interp(y0, yc0, relT); - } else { - newCoordinates[newCi++] = xc0; - newCoordinates[newCi++] = yc0; - newCoordinates[newCi++] = xc1; - newCoordinates[newCi++] = yc1; - newCoordinates[newCi++] = x1; - newCoordinates[newCi++] = y1; - } - t0 = nt; - } - bezierCoordinates = newCoordinates; - numCoordinates = newCoordinates.length; - myTVals = newTVals; - } - } - - private static class MorphedShape implements Shape { - final Geometry geom0; - final Geometry geom1; - final float t; - final boolean unionBounds; - - MorphedShape(Geometry geom0, Geometry geom1, float t, boolean unionBounds) { - this.geom0 = geom0; - this.geom1 = geom1; - this.t = t; - this.unionBounds = unionBounds; - } - - public Rectangle getBounds() { - return getBounds2D().getBounds(); - } - - public Rectangle2D getBounds2D() { - final int n = geom0.getNumCoordinates(); - float xMin, yMin, xMax, yMax; - - if (unionBounds) { - xMin = xMax = geom0.getCoordinate(0); - yMin = yMax = geom0.getCoordinate(1); - for (int i = 2; i < n; i += 2) { - final float x = geom0.getCoordinate(i); - final float y = geom0.getCoordinate(i + 1); - if (xMin > x) { - xMin = x; - } - if (yMin > y) { - yMin = y; - } - if (xMax < x) { - xMax = x; - } - if (yMax < y) { - yMax = y; - } - } - final int m = geom1.getNumCoordinates(); - for (int i = 0; i < m; i += 2) { - final float x = geom1.getCoordinate(i); - final float y = geom1.getCoordinate(i + 1); - if (xMin > x) { - xMin = x; - } - if (yMin > y) { - yMin = y; - } - if (xMax < x) { - xMax = x; - } - if (yMax < y) { - yMax = y; - } - } - } else { - xMin = xMax = interp(geom0.getCoordinate(0), geom1.getCoordinate(0), t); - yMin = yMax = interp(geom0.getCoordinate(1), geom1.getCoordinate(1), t); - for (int i = 2; i < n; i += 2) { - final float x = interp(geom0.getCoordinate(i), geom1.getCoordinate(i), t); - final float y = interp(geom0.getCoordinate(i + 1), geom1.getCoordinate(i + 1), t); - if (xMin > x) { - xMin = x; - } - if (yMin > y) { - yMin = y; - } - if (xMax < x) { - xMax = x; - } - if (yMax < y) { - yMax = y; - } - } - } - return new Rectangle2D.Float(xMin, yMin, xMax - xMin, yMax - yMin); - } - - public boolean contains(double x, double y) { - return Path2D.contains(getPathIterator(null), x, y); - } - - public boolean contains(Point2D p) { - return Path2D.contains(getPathIterator(null), p); - } - - public boolean intersects(double x, double y, double w, double h) { - return Path2D.intersects(getPathIterator(null), x, y, w, h); - } - - public boolean intersects(Rectangle2D r) { - return Path2D.intersects(getPathIterator(null), r); - } - - public boolean contains(double x, double y, double width, double height) { - return Path2D.contains(getPathIterator(null), x, y, width, height); - } - - public boolean contains(Rectangle2D r) { - return Path2D.contains(getPathIterator(null), r); - } - - public PathIterator getPathIterator(AffineTransform at) { - return new Iterator(at, geom0, geom1, t); - } - - public PathIterator getPathIterator(AffineTransform at, double flatness) { - return new FlatteningPathIterator(getPathIterator(at), flatness); - } - } - - private static class Iterator implements PathIterator { - AffineTransform at; - Geometry g0; - Geometry g1; - float t; - int cIndex; - - public Iterator(AffineTransform at, - Geometry g0, Geometry g1, - float t) { - this.at = at; - this.g0 = g0; - this.g1 = g1; - this.t = t; - } - - /** - * {@inheritDoc} - */ - public int getWindingRule() { - return (t < 0.5 ? g0.getWindingRule() : g1.getWindingRule()); - } - - /** - * {@inheritDoc} - */ - public boolean isDone() { - return (cIndex > g0.getNumCoordinates()); - } - - /** - * {@inheritDoc} - */ - public void next() { - if (cIndex == 0) { - cIndex = 2; - } else { - cIndex += 6; - } - } - - /** - * {@inheritDoc} - */ - public int currentSegment(float[] coordinates) { - int type; - int n; - if (cIndex == 0) { - type = SEG_MOVETO; - n = 2; - } else if (cIndex >= g0.getNumCoordinates()) { - type = SEG_CLOSE; - n = 0; - } else { - type = SEG_CUBICTO; - n = 6; - } - if (n > 0) { - for (int i = 0; i < n; i++) { - coordinates[i] = interp( - g0.getCoordinate(cIndex + i), - g1.getCoordinate(cIndex + i), - t); - } - if (at != null) { - at.transform(coordinates, 0, coordinates, 0, n / 2); - } - } - return type; - } - - public int currentSegment(double[] coordinates) { - final float[] temp = new float[6]; - final int res = currentSegment(temp); - for (int i = 0; i < 6; i++) { - coordinates[i] = temp[i]; - } - return res; - } - } -} diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/TextureUtil.java b/worldedit-core/src/main/java/com/boydti/fawe/util/TextureUtil.java index 84d3af4ad..36de2fbc3 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/TextureUtil.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/TextureUtil.java @@ -1,25 +1,19 @@ package com.boydti.fawe.util; import com.boydti.fawe.Fawe; -import com.boydti.fawe.FaweCache; import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.pattern.PatternExtent; import com.boydti.fawe.util.image.ImageUtil; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; - -import com.sk89q.worldedit.util.command.binding.Text; -import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.registry.BlockMaterial; -import com.sk89q.worldedit.world.registry.BundledBlockData; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.IntArraySet; @@ -27,12 +21,23 @@ import it.unimi.dsi.fastutil.longs.LongArrayList; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; -import java.io.*; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.lang.reflect.Type; import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.regex.Pattern; import java.util.zip.ZipEntry; @@ -107,60 +112,60 @@ public class TextureUtil implements TextureHolder { private BiomeColor[] biomes = new BiomeColor[] { // ID Name Temperature, rainfall, grass, foliage colors // - note: the colors here are just placeholders, they are computed in the program - new BiomeColor(0, "Ocean", 0.5f, 0.5f, 0x92BD59, 0x77AB2F), + new BiomeColor(0, "ocean", 0.5f, 0.5f, 0x92BD59, 0x77AB2F), // default values of temp and rain - new BiomeColor(1, "Plains", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(2, "Desert", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(3, "Extreme Hills", 0.2f, 0.3f, 0x92BD59, 0x77AB2F), - new BiomeColor(4, "Forest", 0.7f, 0.8f, 0x92BD59, 0x77AB2F), - new BiomeColor(5, "Taiga", 0.25f, 0.8f, 0x92BD59, 0x77AB2F), - new BiomeColor(6, "Swampland", 0.8f, 0.9f, 0x92BD59, 0x77AB2F), - new BiomeColor(7, "River", 0.5f, 0.5f, 0x92BD59, 0x77AB2F), + new BiomeColor(1, "plains", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(2, "desert", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(3, "mountains", 0.2f, 0.3f, 0x92BD59, 0x77AB2F), + new BiomeColor(4, "forest", 0.7f, 0.8f, 0x92BD59, 0x77AB2F), + new BiomeColor(5, "taiga", 0.25f, 0.8f, 0x92BD59, 0x77AB2F), + new BiomeColor(6, "swamp", 0.8f, 0.9f, 0x92BD59, 0x77AB2F), + new BiomeColor(7, "river", 0.5f, 0.5f, 0x92BD59, 0x77AB2F), // default values of temp and rain - new BiomeColor(8, "Nether", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(9, "End", 0.5f, 0.5f, 0x92BD59, 0x77AB2F), + new BiomeColor(8, "nether", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(9, "the_end", 0.5f, 0.5f, 0x92BD59, 0x77AB2F), // default values of temp and rain - new BiomeColor(10, "Frozen Ocean", 0.0f, 0.5f, 0x92BD59, 0x77AB2F), - new BiomeColor(11, "Frozen River", 0.0f, 0.5f, 0x92BD59, 0x77AB2F), - new BiomeColor(12, "Ice Plains", 0.0f, 0.5f, 0x92BD59, 0x77AB2F), - new BiomeColor(13, "Ice Mountains", 0.0f, 0.5f, 0x92BD59, 0x77AB2F), - new BiomeColor(14, "Mushroom Island", 0.9f, 1.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(15, "Mushroom Island Shore", 0.9f, 1.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(16, "Beach", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(17, "Desert Hills", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(18, "Forest Hills", 0.7f, 0.8f, 0x92BD59, 0x77AB2F), - new BiomeColor(19, "Taiga Hills", 0.25f, 0.8f, 0x92BD59, 0x77AB2F), - new BiomeColor(20, "Extreme Hills Edge", 0.2f, 0.3f, 0x92BD59, 0x77AB2F), - new BiomeColor(21, "Jungle", 0.95f, 0.9f, 0x92BD59, 0x77AB2F), - new BiomeColor(22, "Jungle Hills", 0.95f, 0.9f, 0x92BD59, 0x77AB2F), - new BiomeColor(23, "Jungle Edge", 0.95f, 0.8f, 0x92BD59, 0x77AB2F), - new BiomeColor(24, "Deep Ocean", 0.5f, 0.5f, 0x92BD59, 0x77AB2F), - new BiomeColor(25, "Stone Beach", 0.2f, 0.3f, 0x92BD59, 0x77AB2F), - new BiomeColor(26, "Cold Beach", 0.05f, 0.3f, 0x92BD59, 0x77AB2F), - new BiomeColor(27, "Birch Forest", 0.6f, 0.6f, 0x92BD59, 0x77AB2F), - new BiomeColor(28, "Birch Forest Hills", 0.6f, 0.6f, 0x92BD59, 0x77AB2F), - new BiomeColor(29, "Roofed Forest", 0.7f, 0.8f, 0x92BD59, 0x77AB2F), - new BiomeColor(30, "Cold Taiga", -0.5f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(31, "Cold Taiga Hills", -0.5f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(32, "Mega Taiga", 0.3f, 0.8f, 0x92BD59, 0x77AB2F), - new BiomeColor(33, "Mega Taiga Hills", 0.3f, 0.8f, 0x92BD59, 0x77AB2F), - new BiomeColor(34, "Extreme Hills+", 0.2f, 0.3f, 0x92BD59, 0x77AB2F), - new BiomeColor(35, "Savanna", 1.2f, 0.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(36, "Savanna Plateau", 1.0f, 0.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(37, "Mesa", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(38, "Mesa Plateau F", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(39, "Mesa Plateau", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(40, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(41, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(42, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(43, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(44, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(45, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(46, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(47, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(48, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(49, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(50, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(10, "frozen_ocean", 0.0f, 0.5f, 0x92BD59, 0x77AB2F), + new BiomeColor(11, "frozen_river", 0.0f, 0.5f, 0x92BD59, 0x77AB2F), + new BiomeColor(12, "snowy_tundra", 0.0f, 0.5f, 0x92BD59, 0x77AB2F), + new BiomeColor(13, "snowy_mountains", 0.0f, 0.5f, 0x92BD59, 0x77AB2F), + new BiomeColor(14, "mushroom_fields", 0.9f, 1.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(15, "mushroom_field_shore", 0.9f, 1.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(16, "beach", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(17, "desert_hills", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(18, "wooded_hills", 0.7f, 0.8f, 0x92BD59, 0x77AB2F), + new BiomeColor(19, "taiga_hills", 0.25f, 0.8f, 0x92BD59, 0x77AB2F), + new BiomeColor(20, "mountain_edge", 0.2f, 0.3f, 0x92BD59, 0x77AB2F), + new BiomeColor(21, "jungle", 0.95f, 0.9f, 0x92BD59, 0x77AB2F), + new BiomeColor(22, "jungle_hills", 0.95f, 0.9f, 0x92BD59, 0x77AB2F), + new BiomeColor(23, "jungle_edge", 0.95f, 0.8f, 0x92BD59, 0x77AB2F), + new BiomeColor(24, "deep_ocean", 0.5f, 0.5f, 0x92BD59, 0x77AB2F), + new BiomeColor(25, "stone_shore", 0.2f, 0.3f, 0x92BD59, 0x77AB2F), + new BiomeColor(26, "snowy_beach", 0.05f, 0.3f, 0x92BD59, 0x77AB2F), + new BiomeColor(27, "birch_forest", 0.6f, 0.6f, 0x92BD59, 0x77AB2F), + new BiomeColor(28, "birch_forest_hills", 0.6f, 0.6f, 0x92BD59, 0x77AB2F), + new BiomeColor(29, "dark_forest", 0.7f, 0.8f, 0x92BD59, 0x77AB2F), + new BiomeColor(30, "snowy_taiga", -0.5f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(31, "snowy_taiga_hills", -0.5f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(32, "giant_tree_taiga", 0.3f, 0.8f, 0x92BD59, 0x77AB2F), + new BiomeColor(33, "giant_tree_taiga_hills", 0.3f, 0.8f, 0x92BD59, 0x77AB2F), + new BiomeColor(34, "wooded_mountains", 0.2f, 0.3f, 0x92BD59, 0x77AB2F), + new BiomeColor(35, "savanna", 1.2f, 0.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(36, "savanna_plateau", 1.0f, 0.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(37, "badlands", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(38, "wooded_badlands_plateau", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(39, "badlands_plateau", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(40, "small_end_islands", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(41, "end_midlands", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(42, "end_highlands", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(43, "end_barrens", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(44, "warm_ocean", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(45, "lukewarm_ocean", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(46, "cold_ocean", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(47, "deep_warm_ocean", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(48, "deep_lukewarm_ocean", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(49, "deep_cold_ocean", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(50, "deep_frozen_ocean", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(51, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(52, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(53, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), @@ -237,21 +242,21 @@ public class TextureUtil implements TextureHolder { new BiomeColor(124, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(125, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(126, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(127, "The Void", 0.5f, 0.5f, 0x92BD59, 0x77AB2F), + new BiomeColor(127, "the_void", 0.5f, 0.5f, 0x92BD59, 0x77AB2F), // default values of temp and rain; also, no height differences new BiomeColor(128, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(129, "Sunflower Plains", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(130, "Desert M", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(131, "Extreme Hills M", 0.2f, 0.3f, 0x92BD59, 0x77AB2F), - new BiomeColor(132, "Flower Forest", 0.7f, 0.8f, 0x92BD59, 0x77AB2F), - new BiomeColor(133, "Taiga M", 0.25f, 0.8f, 0x92BD59, 0x77AB2F), - new BiomeColor(134, "Swampland M", 0.8f, 0.9f, 0x92BD59, 0x77AB2F), + new BiomeColor(129, "sunflower_plains", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(130, "desert_lakes", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(131, "gravelly_mountains", 0.2f, 0.3f, 0x92BD59, 0x77AB2F), + new BiomeColor(132, "flower_forest", 0.7f, 0.8f, 0x92BD59, 0x77AB2F), + new BiomeColor(133, "taiga_mountains", 0.25f, 0.8f, 0x92BD59, 0x77AB2F), + new BiomeColor(134, "swamp_hills", 0.8f, 0.9f, 0x92BD59, 0x77AB2F), new BiomeColor(135, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(136, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(137, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(138, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(139, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(140, "Ice Plains Spikes", 0.0f, 0.5f, 0x92BD59, 0x77AB2F), + new BiomeColor(140, "ice_spikes", 0.0f, 0.5f, 0x92BD59, 0x77AB2F), new BiomeColor(141, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(142, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(143, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), @@ -260,28 +265,28 @@ public class TextureUtil implements TextureHolder { new BiomeColor(146, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(147, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(148, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(149, "Jungle M", 0.95f, 0.9f, 0x92BD59, 0x77AB2F), + new BiomeColor(149, "modified_jungle", 0.95f, 0.9f, 0x92BD59, 0x77AB2F), new BiomeColor(150, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(151, "JungleEdge M", 0.95f, 0.8f, 0x92BD59, 0x77AB2F), + new BiomeColor(151, "modified_jungle_edge", 0.95f, 0.8f, 0x92BD59, 0x77AB2F), new BiomeColor(152, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(153, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(154, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(155, "Birch Forest M", 0.6f, 0.6f, 0x92BD59, 0x77AB2F), - new BiomeColor(156, "Birch Forest Hills M", 0.6f, 0.6f, 0x92BD59, 0x77AB2F), - new BiomeColor(157, "Roofed Forest M", 0.7f, 0.8f, 0x92BD59, 0x77AB2F), - new BiomeColor(158, "Cold Taiga M", -0.5f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(159, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(160, "Mega Spruce Taiga", 0.25f, 0.8f, 0x92BD59, 0x77AB2F), + new BiomeColor(155, "tall_birch_forest", 0.6f, 0.6f, 0x92BD59, 0x77AB2F), + new BiomeColor(156, "tall_birch_hills", 0.6f, 0.6f, 0x92BD59, 0x77AB2F), + new BiomeColor(157, "dark_forest_hills", 0.7f, 0.8f, 0x92BD59, 0x77AB2F), + new BiomeColor(158, "snowy_taiga_mountains", -0.5f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(159, "Unknown", -0.5f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(160, "giant_spruce_taiga", 0.25f, 0.8f, 0x92BD59, 0x77AB2F), // special exception, temperature not 0.3 - new BiomeColor(161, "Mega Spruce Taiga Hills", 0.25f, 0.8f, 0x92BD59, 0x77AB2F), - new BiomeColor(162, "Extreme Hills+ M", 0.2f, 0.3f, 0x92BD59, 0x77AB2F), - new BiomeColor(163, "Savanna M", 1.1f, 0.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(164, "Savanna Plateau M", 1.0f, 0.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(165, "Mesa (Bryce)", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(166, "Mesa Plateau F M", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(167, "Mesa Plateau M", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), - new BiomeColor(168, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), - new BiomeColor(169, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), + new BiomeColor(161, "giant_spruce_taiga_hills", 0.25f, 0.8f, 0x92BD59, 0x77AB2F), + new BiomeColor(162, "modified_gravelly_mountains", 0.2f, 0.3f, 0x92BD59, 0x77AB2F), + new BiomeColor(163, "shattered_savanna", 1.1f, 0.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(164, "shattered_savanna_plateau", 1.0f, 0.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(165, "eroded_badlands", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(166, "modified_wooded_badlands_plateau", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(167, "modified_badlands_plateau", 2.0f, 0.0f, 0x92BD59, 0x77AB2F), + new BiomeColor(168, "bamboo_jungle", 0.95f, 0.9f, 0x92BD59, 0x77AB2F), + new BiomeColor(169, "bamboo_jungle_hills", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(170, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(171, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), new BiomeColor(172, "Unknown Biome", 0.8f, 0.4f, 0x92BD59, 0x77AB2F), @@ -597,23 +602,21 @@ public class TextureUtil implements TextureHolder { // Get all the groups in the current jar // The vanilla textures are in `assets/minecraft` // A jar may contain textures for multiple mods + Enumeration entries = zipFile.entries(); Set mods = new HashSet<>(); - { - Enumeration entries = zipFile.entries(); - while (entries.hasMoreElements()) { - ZipEntry entry = entries.nextElement(); - String name = entry.getName(); - Path path = Paths.get(name); - if (path.startsWith("assets" + File.separator)) { - String[] split = - path.toString().split(Pattern.quote(File.separator)); - if (split.length > 1) { - String modId = split[1]; - mods.add(modId); - } + while (entries.hasMoreElements()) { + ZipEntry entry = entries.nextElement(); + String name = entry.getName(); + Path path = Paths.get(name); + if (path.startsWith("assets" + File.separator)) { + String[] split = + path.toString().split(Pattern.quote(File.separator)); + if (split.length > 1) { + String modId = split[1]; + mods.add(modId); } - continue; } + continue; } String modelsDir = "assets/%1$s/models/block/%2$s.json"; String texturesDir = "assets/%1$s/textures/%2$s.png"; @@ -632,153 +635,148 @@ public class TextureUtil implements TextureHolder { String nameSpace = split.length == 1 ? "minecraft" : split[0]; Map texturesMap = new ConcurrentHashMap<>(); - { // Read models - String modelFileName = String.format(modelsDir, nameSpace, name); - ZipEntry entry = getEntry(zipFile, modelFileName); - if (entry == null) { - System.out.println("Cannot find " + modelFileName + " in " + file); + // Read models + String modelFileName = String.format(modelsDir, nameSpace, name); + ZipEntry entry = getEntry(zipFile, modelFileName); + if (entry == null) { + System.out.println("Cannot find " + modelFileName + " in " + file); + continue; + } + + String textureFileName; + try (InputStream is = zipFile.getInputStream(entry)) { + JsonReader reader = new JsonReader( + new InputStreamReader(is, StandardCharsets.UTF_8)); + Map root = gson.fromJson(reader, typeToken); + Map textures = (Map) root.get("textures"); + + if (textures == null) { continue; } - - String textureFileName; - try (InputStream is = zipFile.getInputStream(entry)) { - JsonReader reader = new JsonReader( - new InputStreamReader(is, StandardCharsets.UTF_8)); - Map root = gson.fromJson(reader, typeToken); - Map textures = (Map) root.get("textures"); - - if (textures == null) { - continue; - } - Set models = new HashSet<>(); - // Get models - for (Map.Entry stringObjectEntry : textures - .entrySet()) { - Object value = stringObjectEntry.getValue(); - if (value instanceof String) { + Set models = new HashSet<>(); + // Get models + for (Map.Entry stringObjectEntry : textures + .entrySet()) { + Object value = stringObjectEntry.getValue(); + if (value instanceof String) { + models.add((String) value); + } else if (value instanceof Map) { + value = ((Map) value).get("model"); + if (value != null) { models.add((String) value); - } else if (value instanceof Map) { - value = ((Map) value).get("model"); - if (value != null) { - models.add((String) value); - } } } - if (models.size() != 1) { - continue; - } - - textureFileName = - String.format(texturesDir, nameSpace, models.iterator().next()); } - - BufferedImage image = readImage(zipFile, textureFileName); - if (image == null) { - System.out.println("Cannot find " + textureFileName); + if (models.size() != 1) { continue; } - int color = ImageUtil.getColor(image); - long distance = getDistance(image, color); - distanceMap.put(combined, (Long) distance); - colorMap.put(combined, (Integer) color); + + textureFileName = + String.format(texturesDir, nameSpace, models.iterator().next()); + } + + BufferedImage image = readImage(zipFile, textureFileName); + if (image == null) { + System.out.println("Cannot find " + textureFileName); + continue; + } + int color = ImageUtil.getColor(image); + long distance = getDistance(image, color); + distanceMap.put(combined, (Long) distance); + colorMap.put(combined, (Integer) color); + } + Integer grass = null; + { + String grassFileName = + String.format(texturesDir, "minecraft", "grass_block_top"); + BufferedImage image = readImage(zipFile, grassFileName); + if (image != null) { + grass = ImageUtil.getColor(image); } } - { - Integer grass = null; - { - String grassFileName = - String.format(texturesDir, "minecraft", "grass_block_top"); - BufferedImage image = readImage(zipFile, grassFileName); - if (image != null) { - grass = ImageUtil.getColor(image); - } - } - if (grass != null) { - // assets\minecraft\textures\colormap - ZipEntry grassEntry = getEntry(zipFile, - "assets/minecraft/textures/colormap/grass_block.png"); - if (grassEntry != null) { - try (InputStream is = zipFile.getInputStream(grassEntry)) { - BufferedImage image = ImageIO.read(is); - // Update biome colors - for (BiomeColor biome : biomes) { - float adjTemp = - MathMan.clamp(biome.temperature, 0.0f, 1.0f); - float adjRainfall = - MathMan.clamp(biome.rainfall, 0.0f, 1.0f) * adjTemp; - int x = (int) (255 - adjTemp * 255); - int z = (int) (255 - adjRainfall * 255); - biome.grass = image.getRGB(x, z); - } - } - // swampland: perlin - avoid - biomes[6].grass = 0; - biomes[134].grass = 0; - // roofed forest: averaged w/ 0x28340A - biomes[29].grass = - multiplyColor(biomes[29].grass, 0x28340A + (255 << 24)); - biomes[157].grass = - multiplyColor(biomes[157].grass, 0x28340A + (255 << 24)); - // mesa : 0x90814D - biomes[37].grass = 0x90814D + (255 << 24); - biomes[38].grass = 0x90814D + (255 << 24); - biomes[39].grass = 0x90814D + (255 << 24); - biomes[165].grass = 0x90814D + (255 << 24); - biomes[166].grass = 0x90814D + (255 << 24); - biomes[167].grass = 0x90814D + (255 << 24); - List valid = new ArrayList<>(); + if (grass != null) { + // assets\minecraft\textures\colormap + ZipEntry grassEntry = getEntry(zipFile, + "assets/minecraft/textures/colormap/grass_block.png"); + if (grassEntry != null) { + try (InputStream is = zipFile.getInputStream(grassEntry)) { + BufferedImage image = ImageIO.read(is); + // Update biome colors for (BiomeColor biome : biomes) { - // biome.grass = multiplyColor(biome.grass, grass); - if (biome.grass != 0 && !biome.name - .equalsIgnoreCase("Unknown Biome")) { - valid.add(biome); - } - biome.grassCombined = multiplyColor(grass, biome.grass); + float adjTemp = + MathMan.clamp(biome.temperature, 0.0f, 1.0f); + float adjRainfall = + MathMan.clamp(biome.rainfall, 0.0f, 1.0f) * adjTemp; + int x = (int) (255 - adjTemp * 255); + int z = (int) (255 - adjRainfall * 255); + biome.grass = image.getRGB(x, z); } - this.validBiomes = valid.toArray(new BiomeColor[valid.size()]); + } + // swampland: perlin - avoid + biomes[6].grass = 0; + biomes[134].grass = 0; + // roofed forest: averaged w/ 0x28340A + biomes[29].grass = + multiplyColor(biomes[29].grass, 0x28340A + (255 << 24)); + biomes[157].grass = + multiplyColor(biomes[157].grass, 0x28340A + (255 << 24)); + // mesa : 0x90814D + biomes[37].grass = 0x90814D + (255 << 24); + biomes[38].grass = 0x90814D + (255 << 24); + biomes[39].grass = 0x90814D + (255 << 24); + biomes[165].grass = 0x90814D + (255 << 24); + biomes[166].grass = 0x90814D + (255 << 24); + biomes[167].grass = 0x90814D + (255 << 24); + List valid = new ArrayList<>(); + for (BiomeColor biome : biomes) { + // biome.grass = multiplyColor(biome.grass, grass); + if (biome.grass != 0 && !biome.name + .equalsIgnoreCase("Unknown Biome")) { + valid.add(biome); + } + biome.grassCombined = multiplyColor(grass, biome.grass); + } + this.validBiomes = valid.toArray(new BiomeColor[0]); - { - ArrayList uniqueColors = new ArrayList<>(); - Set uniqueBiomesColors = new IntArraySet(); - for (BiomeColor color : validBiomes) { - if (uniqueBiomesColors.add(color.grass)) { - uniqueColors.add(color); + ArrayList uniqueColors = new ArrayList<>(); + Set uniqueBiomesColors = new IntArraySet(); + for (BiomeColor color : validBiomes) { + if (uniqueBiomesColors.add(color.grass)) { + uniqueColors.add(color); + } + } + int count = 0; + int count2 = 0; + uniqueBiomesColors.clear(); + + LongArrayList layerIds = new LongArrayList(); + LongArrayList layerColors = new LongArrayList(); + for (int i = 0; i < uniqueColors.size(); i++) { + for (int j = i; j < uniqueColors.size(); j++) { + for (int k = j; k < uniqueColors.size(); k++) { + BiomeColor c1 = uniqueColors.get(i); + BiomeColor c2 = uniqueColors.get(j); + BiomeColor c3 = uniqueColors.get(k); + int average = + averageColor(c1.grass, c2.grass, c3.grass); + if (uniqueBiomesColors.add(average)) { + count++; + layerColors.add((long) average); + layerIds.add( + (long) ((c1.id) + (c2.id << 8) + (c3.id + << 16))); } } - int count = 0; - int count2 = 0; - uniqueBiomesColors.clear(); - - LongArrayList layerIds = new LongArrayList(); - LongArrayList layerColors = new LongArrayList(); - for (int i = 0; i < uniqueColors.size(); i++) { - for (int j = i; j < uniqueColors.size(); j++) { - for (int k = j; k < uniqueColors.size(); k++) { - BiomeColor c1 = uniqueColors.get(i); - BiomeColor c2 = uniqueColors.get(j); - BiomeColor c3 = uniqueColors.get(k); - int average = - averageColor(c1.grass, c2.grass, c3.grass); - if (uniqueBiomesColors.add(average)) { - count++; - layerColors.add((long) average); - layerIds.add( - (long) ((c1.id) + (c2.id << 8) + (c3.id - << 16))); - } - } - } - } - - validMixBiomeColors = new int[layerColors.size()]; - for (int i = 0; i < layerColors.size(); i++) { - validMixBiomeColors[i] = (int) layerColors.getLong(i); - } - validMixBiomeIds = layerIds.toLongArray(); } } + validMixBiomeColors = new int[layerColors.size()]; + for (int i = 0; i < layerColors.size(); i++) { + validMixBiomeColors[i] = (int) layerColors.getLong(i); + } + validMixBiomeIds = layerIds.toLongArray(); } + } // Close the file zipFile.close(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/CuboidClipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/CuboidClipboard.java index af1392e4a..e27c6be2a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/CuboidClipboard.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/CuboidClipboard.java @@ -20,8 +20,6 @@ package com.sk89q.worldedit; import com.boydti.fawe.object.schematic.Schematic; -import com.boydti.fawe.util.MainUtil; - import com.sk89q.worldedit.command.ClipboardCommands; import com.sk89q.worldedit.command.FlattenedClipboardTransform; import com.sk89q.worldedit.command.SchematicCommands; @@ -97,7 +95,6 @@ public class CuboidClipboard { */ public CuboidClipboard(BlockVector3 size) { checkNotNull(size); - MainUtil.warnDeprecated(BlockArrayClipboard.class, ClipboardFormat.class); this.size = size; this.clipboard = this.init(BlockVector3.ZERO, BlockVector3.ZERO); } @@ -117,7 +114,6 @@ public class CuboidClipboard { public CuboidClipboard(BlockVector3 size, BlockVector3 origin) { checkNotNull(size); checkNotNull(origin); - MainUtil.warnDeprecated(BlockArrayClipboard.class, ClipboardFormat.class); this.size = size; this.clipboard = init(BlockVector3.ZERO, origin); } @@ -134,7 +130,6 @@ public class CuboidClipboard { checkNotNull(size); checkNotNull(origin); checkNotNull(offset); - MainUtil.warnDeprecated(BlockArrayClipboard.class, ClipboardFormat.class); this.size = size; this.clipboard = this.init(offset, origin); } @@ -479,4 +474,4 @@ public class CuboidClipboard { } return distribution; } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java index af8a13050..bfaf261b6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java @@ -477,7 +477,7 @@ public final class CommandManager { } } else { String message = e.getMessage(); - actor.printRaw(BBC.getPrefix() + (message != null ? message : "The command was not used properly (no more help available).")); + actor.printRaw((message != null ? message : "The command was not used properly (no more help available).")); BBC.COMMAND_SYNTAX.send(actor, e.getSimpleUsageString("/")); } } catch (CommandException e) { @@ -534,7 +534,11 @@ public final class CommandManager { return; } } - if (!fp.runAction(() -> handleCommandOnCurrentThread(finalEvent), false, true)) { + if (!fp.runAction(new Runnable() { + @Override public void run() { + CommandManager.this.handleCommandOnCurrentThread(finalEvent); + } + }, false, true)) { BBC.WORLDEDIT_COMMAND_LIMIT.send(fp); } finalEvent.setCancelled(true); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java index 1e5a2e8e3..e41cabb5c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java @@ -1,27 +1,21 @@ package com.sk89q.worldedit.function.mask; import com.boydti.fawe.object.collection.FastBitSet; -import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.StringMan; -import com.sk89q.worldedit.extent.NullExtent; -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.extent.NullExtent; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.AbstractProperty; import com.sk89q.worldedit.registry.state.Property; -import static com.google.common.base.Preconditions.checkNotNull; - -import com.sk89q.worldedit.math.BlockVector3; +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 com.sk89q.worldedit.world.block.BlockTypes; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; import javax.annotation.Nullable; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -41,14 +35,12 @@ public class BlockMask extends AbstractExtentMask { @Deprecated public BlockMask(Extent extent, Collection blocks) { super(extent); - MainUtil.warnDeprecated(BlockMaskBuilder.class); this.bitSets = new BlockMaskBuilder().addBlocks(blocks).optimize().getBits(); } @Deprecated public BlockMask(Extent extent, BaseBlock... blocks) { super(extent); - MainUtil.warnDeprecated(BlockMaskBuilder.class); this.bitSets = new BlockMaskBuilder().addBlocks(blocks).optimize().getBits(); } @@ -125,16 +117,14 @@ public class BlockMask extends AbstractExtentMask { } } BlockType type = BlockTypes.get(indexFound); - { - Mask mask = getOptimizedMask(type, bitSets[indexFound]); - if (mask == null) { // Try with inverse - long[] newBitSet = bitSets[indexFound]; - for (int i = 0; i < newBitSet.length; i++) newBitSet[i] = ~newBitSet[i]; - mask = getOptimizedMask(type, bitSets[indexFound]); - if (mask != null) mask = mask.inverse(); - } - return mask; + Mask mask = getOptimizedMask(type, bitSets[indexFound]); + if (mask == null) { // Try with inverse + long[] newBitSet = bitSets[indexFound]; + for (int i = 0; i < newBitSet.length; i++) newBitSet[i] = ~newBitSet[i]; + mask = getOptimizedMask(type, bitSets[indexFound]); + if (mask != null) mask = mask.inverse(); } + return mask; } private Mask getOptimizedMask(BlockType type, long[] bitSet) { @@ -247,4 +237,4 @@ public class BlockMask extends AbstractExtentMask { } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java index 54e08aa7e..334542a26 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java @@ -20,25 +20,23 @@ package com.sk89q.worldedit.regions; import com.boydti.fawe.config.Settings; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - import com.boydti.fawe.object.collection.BlockVectorSet; -import com.boydti.fawe.object.collection.LocalBlockVectorSet; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.MutableBlockVector3; import com.sk89q.worldedit.math.MutableBlockVector2; +import com.sk89q.worldedit.math.MutableBlockVector3; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.storage.ChunkStore; +import org.jetbrains.annotations.NotNull; import java.util.AbstractSet; -import java.util.HashSet; import java.util.Iterator; import java.util.NoSuchElementException; import java.util.Set; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; + /** * An axis-aligned cuboid. It can be defined using two corners of the cuboid. */ @@ -313,7 +311,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { final int size = (maxX - minX + 1) * (maxZ - minZ + 1); return new AbstractSet() { - @Override + @NotNull @Override public Iterator iterator() { return new Iterator() { private MutableBlockVector2 pos = new MutableBlockVector2().setComponents(maxX + 1, maxZ); @@ -403,7 +401,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { return position.containedWithin(min, max); } - @Override + @NotNull @Override public Iterator iterator() { if (Settings.IMP.HISTORY.COMPRESSION_LEVEL >= 9 || useOldIterator) { return iterator_old(); @@ -432,7 +430,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { int ctx = Math.min(tx, 15 + (cx << 4)); int ctz = Math.min(tz, 15 + (cz << 4)); - public boolean hasNext = true; + boolean hasNext = true; @Override @@ -535,49 +533,34 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { @Override public Iterable asFlatRegion() { - return new Iterable() { + return () -> new Iterator() { + private BlockVector3 min = getMinimumPoint(); + private BlockVector3 max = getMaximumPoint(); + private int nextX = min.getBlockX(); + private int nextZ = min.getBlockZ(); + @Override - public Iterator iterator() { - MutableBlockVector2 mutable = new MutableBlockVector2(); - return new Iterator() { - private BlockVector3 min = getMinimumPoint(); - private BlockVector3 max = getMaximumPoint(); - private int nextX = min.getBlockX(); - private int nextZ = min.getBlockZ(); + public boolean hasNext() { + return (nextZ != Integer.MAX_VALUE); + } - @Override - public boolean hasNext() { - return (nextZ != Integer.MAX_VALUE); + @Override + public BlockVector2 next() { + if (!hasNext()) throw new NoSuchElementException(); + BlockVector2 answer = BlockVector2.at(nextX, nextZ); + if (++nextX > max.getBlockX()) { + nextX = min.getBlockX(); + if (++nextZ > max.getBlockZ()) { + nextZ = Integer.MAX_VALUE; + nextX = Integer.MAX_VALUE; } + } + return answer; + } - @Override - public BlockVector2 next() { - if (!hasNext()) throw new java.util.NoSuchElementException(); -// BlockVector2 answer = mutable.setComponents(nextX, nextZ); - BlockVector2 answer = BlockVector2.at(nextX, nextZ); - if (++nextX > max.getBlockX()) { - nextX = min.getBlockX(); - if (++nextZ > max.getBlockZ()) { - if (nextZ == Integer.MIN_VALUE) { - throw new NoSuchElementException("End of iterator") { - @Override - public Throwable fillInStackTrace() { - return this; - } - }; - } - nextZ = Integer.MAX_VALUE; - nextX = Integer.MAX_VALUE; - } - } - return answer; - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - }; + @Override + public void remove() { + throw new UnsupportedOperationException(); } }; } @@ -625,4 +608,4 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/BindingMap.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/BindingMap.java index de1896397..7500d5afa 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/BindingMap.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/BindingMap.java @@ -1,7 +1,5 @@ package com.sk89q.worldedit.util.command.parametric; -import com.boydti.fawe.util.ArrayUtil; -import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.StringMan; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandException; @@ -10,13 +8,6 @@ import com.sk89q.worldedit.util.command.CommandMapping; import com.sk89q.worldedit.util.command.MissingParameterException; import com.sk89q.worldedit.util.command.SimpleDispatcher; import com.sk89q.worldedit.util.command.binding.Range; -import com.sk89q.worldedit.util.command.parametric.ArgumentStack; -import com.sk89q.worldedit.util.command.parametric.Binding; -import com.sk89q.worldedit.util.command.parametric.BindingBehavior; -import com.sk89q.worldedit.util.command.parametric.BindingMatch; -import com.sk89q.worldedit.util.command.parametric.ParameterData; -import com.sk89q.worldedit.util.command.parametric.ParameterException; -import com.sk89q.worldedit.util.command.parametric.ParametricBuilder; import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java index aeecbcd09..dcf1baba6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java @@ -913,31 +913,31 @@ public final class BlockTypes { return $NAMESPACES; } - public static final @Nullable BlockType get(final String id) { + public static @Nullable BlockType get(final String id) { return $REGISTRY.get(id); } - public static final @Nullable BlockType get(final CharSequence id) { + public static @Nullable BlockType get(final CharSequence id) { return $REGISTRY.get(id); } @Deprecated - public static final BlockType get(final int ordinal) { + public static BlockType get(final int ordinal) { return values[ordinal]; } @Deprecated - public static final BlockType getFromStateId(final int internalStateId) { + public static BlockType getFromStateId(final int internalStateId) { return values[internalStateId & BIT_MASK]; } @Deprecated - public static final BlockType getFromStateOrdinal(final int internalStateOrdinal) { + public static BlockType getFromStateOrdinal(final int internalStateOrdinal) { return states[internalStateOrdinal].getBlockType(); } public static int size() { return values.length; } - + }