diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/VoxelBrushManager.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/VoxelBrushManager.java index 921bf10b..f9aa92c4 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/VoxelBrushManager.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/VoxelBrushManager.java @@ -1,9 +1,11 @@ package com.github.kevindagame; -import com.github.kevindagame.brush.MultiBlock.*; -import com.github.kevindagame.brush.Shell.*; -import com.google.common.base.Preconditions; import com.github.kevindagame.brush.*; +import com.github.kevindagame.brush.multiBlock.*; +import com.github.kevindagame.brush.shell.ShellBallBrush; +import com.github.kevindagame.brush.shell.ShellSetBrush; +import com.github.kevindagame.brush.shell.ShellVoxelBrush; +import com.google.common.base.Preconditions; import java.util.*; @@ -15,6 +17,7 @@ public class VoxelBrushManager { private static VoxelBrushManager instance = null; private final Map> brushes = new HashMap<>(); + public static VoxelBrushManager getInstance() { return instance; } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/VoxelProfileManager.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/VoxelProfileManager.java index 5e19cd7e..46def28a 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/VoxelProfileManager.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/VoxelProfileManager.java @@ -1,8 +1,8 @@ package com.github.kevindagame; -import com.google.common.collect.Maps; import com.github.kevindagame.snipe.Sniper; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; +import com.google.common.collect.Maps; import java.util.Map; import java.util.UUID; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/AbstractBrush.kt b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/AbstractBrush.kt index 34c9bf1c..682c9a5b 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/AbstractBrush.kt +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/AbstractBrush.kt @@ -52,7 +52,6 @@ abstract class AbstractBrush : IBrush { * Brush name. */ private var name = "Undefined" - protected var cancelled = false protected var snipeAction: SnipeAction? = null private fun preparePerform(v: SnipeData, clickedBlock: IBlock, clickedFace: BlockFace): Boolean { @@ -93,22 +92,27 @@ abstract class AbstractBrush : IBrush { protected fun performOperations(data: SnipeData): Boolean { if (operations.size == 0) return false - val event = PlayerSnipeEvent(data.owner().player, this, ImmutableList.copyOf(operations), operations.any { o -> o is CustomOperation }).callEvent() + val event = PlayerSnipeEvent( + data.owner().player, + this, + ImmutableList.copyOf(operations), + operations.any { o -> o is CustomOperation }).callEvent() if (!event.isCancelled) { val undo = Undo() var reloadArea = false if (event.isCustom && this is CustomBrush) { - this.perform(event.operations.stream().filter { o -> !o.isCancelled && o is CustomOperation }.map { o -> o as CustomOperation }.collect(ImmutableList.toImmutableList()), data, undo) + this.perform(event.operations.stream().filter { o -> !o.isCancelled && o is CustomOperation } + .map { o -> o as CustomOperation }.collect(ImmutableList.toImmutableList()), data, undo) } else { for (operation in event.operations) { if (!operation.isCancelled) { if (executeOperation(operation, undo)) { - reloadArea = true; + reloadArea = true } } } } - data.owner().storeUndo(undo); + data.owner().storeUndo(undo) if (reloadArea) { reloadBrushArea(data) } @@ -193,7 +197,7 @@ abstract class AbstractBrush : IBrush { val rangeBlockHelper: BlockHelper if (v.owner().getSnipeData(v.owner().currentToolId).isRanged) { rangeBlockHelper = BlockHelper( - v.owner().player, v.owner().getSnipeData(v.owner().currentToolId).range + v.owner().player, v.owner().getSnipeData(v.owner().currentToolId).range .toDouble() ) targetBlock = rangeBlockHelper.rangeBlock @@ -282,10 +286,6 @@ abstract class AbstractBrush : IBrush { } } - protected fun cancel() { - cancelled = true - } - companion object { protected const val CHUNK_SIZE = 16 } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BallBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BallBrush.java index 220573aa..8bd0b7ec 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BallBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BallBrush.java @@ -7,6 +7,7 @@ import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.block.IBlock; import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -62,6 +63,8 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); @@ -70,6 +73,7 @@ public List registerArguments() { arguments.addAll(super.registerArguments()); return arguments; } + @Override public String getPermissionNode() { return "voxelsniper.brush.ball"; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BiomeBallBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BiomeBallBrush.java index 3facf041..1f400978 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BiomeBallBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BiomeBallBrush.java @@ -1,11 +1,12 @@ package com.github.kevindagame.brush; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BiomeOperation; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.Shapes; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BiomeOperation; import com.github.kevindagame.voxelsniper.biome.VoxelBiome; +import org.jetbrains.annotations.NotNull; import java.util.List; @@ -16,10 +17,11 @@ */ public class BiomeBallBrush extends AbstractBrush { + private VoxelBiome selectedBiome = VoxelBiome.PLAINS; + public BiomeBallBrush() { this.setName("Biome ball"); } - private VoxelBiome selectedBiome = VoxelBiome.PLAINS; @Override public void info(VoxelMessage vm) { @@ -48,8 +50,9 @@ private void biome(final SnipeData v) { this.addOperations(Shapes.ball(this.getTargetBlock().getLocation(), v.getBrushSize(), true).stream().map(location -> new BiomeOperation(location, getWorld().getBiome(location), this.selectedBiome)).collect(toList())); } + @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.BIOMEBALL_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -63,6 +66,7 @@ public final void parseParameters(final String triggerHandle, final String[] par } } + @NotNull @Override public List registerArguments() { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BiomeBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BiomeBrush.java index f19e03c0..417d59e2 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BiomeBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BiomeBrush.java @@ -1,11 +1,12 @@ package com.github.kevindagame.brush; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BiomeOperation; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BiomeOperation; import com.github.kevindagame.voxelsniper.biome.VoxelBiome; import com.github.kevindagame.voxelsniper.location.BaseLocation; +import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.stream.Collectors; @@ -56,7 +57,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.BIOME_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -70,6 +71,7 @@ public final void parseParameters(final String triggerHandle, final String[] par } } + @NotNull @Override public List registerArguments() { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendBallBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendBallBrush.java index f4ab257e..3157ba45 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendBallBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendBallBrush.java @@ -1,10 +1,11 @@ package com.github.kevindagame.brush; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.Shapes; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; + /** * ... */ diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendBrushBase.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendBrushBase.java index 62b9a01b..38bbc8b0 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendBrushBase.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendBrushBase.java @@ -1,10 +1,11 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -19,10 +20,8 @@ public abstract class BlendBrushBase extends AbstractBrush { protected boolean excludeAir = true; protected boolean excludeWater = true; - /** - * @param v - */ protected abstract void blend(SnipeData v); + protected VoxelMaterial[][][] blend3D(int brushSize) { final int brushSizeDoubled = 2 * brushSize; // Array that holds the original materials plus a buffer @@ -184,7 +183,7 @@ public final void info(final VoxelMessage vm) { } @Override - public void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("water")) { if (params.length >= 2) { this.excludeWater = !Boolean.parseBoolean(params[1].toLowerCase()); @@ -198,11 +197,13 @@ public void parseParameters(final String triggerHandle, final String[] params, f v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { return new ArrayList<>(Lists.newArrayList("water")); } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendDiscBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendDiscBrush.java index 27ca87bd..fbf11bca 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendDiscBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendDiscBrush.java @@ -1,9 +1,9 @@ package com.github.kevindagame.brush; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.Shapes; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; /** @@ -24,7 +24,7 @@ protected final void blend(final SnipeData v) { var brushSize = v.getBrushSize(); var newMaterials = this.blend2D(brushSize); - for(var position : positions) { + for (var position : positions) { var material = newMaterials[position.getBlockX() - this.getTargetBlock().getX() + brushSize][position.getBlockZ() - this.getTargetBlock().getZ() + brushSize]; if (!(this.excludeAir && material.isAir()) && !(this.excludeWater && (material == VoxelMaterial.WATER))) { addOperation(new BlockOperation(position, position.getBlock().getBlockData(), material.createBlockData())); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendVoxelBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendVoxelBrush.java index 83ddba3b..3ad5a107 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendVoxelBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendVoxelBrush.java @@ -1,9 +1,9 @@ package com.github.kevindagame.brush; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.Shapes; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; /** diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendVoxelDiscBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendVoxelDiscBrush.java index dee15c16..5ecb5571 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendVoxelDiscBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlendVoxelDiscBrush.java @@ -1,9 +1,9 @@ package com.github.kevindagame.brush; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.Shapes; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; /** @@ -24,7 +24,7 @@ protected final void blend(final SnipeData v) { var brushSize = v.getBrushSize(); var newMaterials = this.blend2D(brushSize); - for(var position : positions) { + for (var position : positions) { var material = newMaterials[position.getBlockX() - this.getTargetBlock().getX() + brushSize][position.getBlockZ() - this.getTargetBlock().getZ() + brushSize]; if (!(this.excludeAir && material.isAir()) && !(this.excludeWater && (material == VoxelMaterial.WATER))) { addOperation(new BlockOperation(position, position.getBlock().getBlockData(), material.createBlockData())); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlobBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlobBrush.java index 06dc100d..062e779f 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlobBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlobBrush.java @@ -1,13 +1,17 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.voxelsniper.location.BaseLocation; -import com.google.common.collect.Lists; import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.voxelsniper.location.BaseLocation; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Random; /** * ... @@ -249,6 +253,7 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); @@ -258,6 +263,7 @@ public List registerArguments() { return arguments; } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlockResetBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlockResetBrush.java index 4fc39397..f889fd6e 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlockResetBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlockResetBrush.java @@ -1,9 +1,9 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Shapes; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlockResetSurfaceBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlockResetSurfaceBrush.java index c97a64e8..3d34b3c3 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlockResetSurfaceBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/BlockResetSurfaceBrush.java @@ -1,8 +1,8 @@ package com.github.kevindagame.brush; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; @@ -24,6 +24,7 @@ * be about 1.5x slower than the original brush. Savings increase for larger brushes. *
* ... + * * @author GavJenks */ public class BlockResetSurfaceBrush extends AbstractBrush { @@ -83,7 +84,7 @@ private void applyBrush(final SnipeData v) { boolean airFound; airFound = checkBlock(world, x + 1, y, z); - airFound = checkBlock(world, x -1, y, z) || airFound; + airFound = checkBlock(world, x - 1, y, z) || airFound; airFound = checkBlock(world, x, y + 1, z) || airFound; airFound = checkBlock(world, x, y - 1, z) || airFound; airFound = checkBlock(world, x, y, z + 1) || airFound; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CheckerVoxelDiscBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CheckerVoxelDiscBrush.java index 1ded991c..399812eb 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CheckerVoxelDiscBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CheckerVoxelDiscBrush.java @@ -1,12 +1,13 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.util.Actions; -import com.github.kevindagame.util.Shapes; -import com.google.common.collect.Lists; import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; +import com.github.kevindagame.util.Actions; import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.Shapes; import com.github.kevindagame.util.VoxelMessage; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -67,6 +68,7 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CleanSnowBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CleanSnowBrush.java index 2ce24ad4..0e6a0014 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CleanSnowBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CleanSnowBrush.java @@ -1,14 +1,15 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.util.brushOperation.BlockOperation; -import com.github.kevindagame.util.Shapes; -import com.github.kevindagame.voxelsniper.block.BlockFace; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.Shapes; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; +import com.github.kevindagame.voxelsniper.block.BlockFace; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -31,7 +32,7 @@ public CleanSnowBrush() { private void cleanSnow(final SnipeData v) { var positions = Shapes.ball(this.getTargetBlock().getLocation(), v.getBrushSize(), smoothSphere); - for(var position: positions) { + for (var position : positions) { IBlock b = position.getBlock(); IBlock blockDown = b.getRelative(BlockFace.DOWN); if ((b.getMaterial() == VoxelMaterial.SNOW) && ((blockDown.getMaterial() == VoxelMaterial.SNOW) || (blockDown.getMaterial().isAir()))) { @@ -57,7 +58,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.CLEAN_SNOW_BURSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -72,6 +73,7 @@ public final void parseParameters(final String triggerHandle, final String[] par v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java index 53b4eb53..f6822e20 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CloneStampBrush.java @@ -1,14 +1,14 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.snipe.SnipeAction; +import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.BlockWrapper; +import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.Shapes; +import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.location.VoxelLocation; import com.google.common.collect.Lists; -import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.Messages; -import com.github.kevindagame.util.VoxelMessage; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -46,7 +46,7 @@ private void clone(final SnipeData v) { this.clone.clear(); this.toStamp.clear(); this.sorted = false; - for(var p: positions) { + for (var p : positions) { this.clone.add(new BlockWrapper(p.getBlock(), p.getBlockX() - startingPoint.getBlockX(), p.getBlockY() - startingPoint.getBlockY(), p.getBlockZ() - startingPoint.getBlockZ(), getWorld())); } v.sendMessage(Messages.BLOCKS_COPIED_SUCCESSFULLY.replace("%amount%", String.valueOf(this.clone.size()))); @@ -84,7 +84,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.CLONE_STAMP_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -111,13 +111,12 @@ public final void parseParameters(final String triggerHandle, final String[] par return; } - /** - * TODO: Implement if (params[0].startsWith("centre")) { v.setcCen(Integer.parseInt(params[0].replace("c", ""))); v.sendMessage(ChatColor.BLUE + "Center - * set to " + v.getcCen()); return; } - */ + // TODO: Implement if (params[0].startsWith("centre")) { v.setcCen(Integer.parseInt(params[0].replace("c", ""))); v.sendMessage(ChatColor.BLUE + "Center + // set to " + v.getcCen()); return; } v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CometBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CometBrush.java index 8a48d370..2448d543 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CometBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CometBrush.java @@ -1,15 +1,15 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.snipe.Undo; -import com.github.kevindagame.util.brushOperation.CustomOperation; -import com.github.kevindagame.util.brushOperation.CustomOperationContext; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; +import com.github.kevindagame.snipe.Undo; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.CustomOperation; +import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.github.kevindagame.voxelsniper.entity.entitytype.VoxelEntityType; import com.github.kevindagame.voxelsniper.vector.VoxelVector; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -93,7 +93,7 @@ public String getPermissionNode() { @Override public boolean perform(ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { - if(operations.size() != 2) { + if (operations.size() != 2) { return false; } final var targetCoords = operations.stream().filter(operation -> operation.getContext() == CustomOperationContext.TARGETLOCATION).findFirst(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CylinderBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CylinderBrush.java index f582d70e..8d69c310 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CylinderBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/CylinderBrush.java @@ -1,12 +1,12 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.util.Shapes; -import com.google.common.collect.Lists; import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.Shapes; import com.github.kevindagame.util.VoxelMessage; -import com.github.kevindagame.voxelsniper.block.IBlock; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -86,6 +86,7 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); @@ -95,6 +96,7 @@ public List registerArguments() { return arguments; } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DiscBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DiscBrush.java index d6c8d990..5e23ab7f 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DiscBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DiscBrush.java @@ -1,13 +1,13 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.util.Shapes; -import com.google.common.collect.Lists; import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.Shapes; import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.block.IBlock; -import com.github.kevindagame.voxelsniper.vector.VoxelVector; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -35,7 +35,7 @@ public DiscBrush() { * @param v SnipeData */ private void disc(final SnipeData v, final IBlock targetBlock) { - this.positions = Shapes.disc(targetBlock.getLocation(), v.getBrushSize(), this.smoothCircle); + this.positions = Shapes.disc(targetBlock.getLocation(), v.getBrushSize(), this.smoothCircle); } @Override @@ -71,6 +71,7 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DiscFaceBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DiscFaceBrush.java index ea445803..c5735942 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DiscFaceBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DiscFaceBrush.java @@ -1,13 +1,12 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.util.Shapes; -import com.google.common.collect.Lists; import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.Shapes; import com.github.kevindagame.util.VoxelMessage; -import com.github.kevindagame.voxelsniper.block.BlockFace; -import com.github.kevindagame.voxelsniper.block.IBlock; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -31,7 +30,7 @@ public DiscFaceBrush() { this.setName("Disc Face"); } - private void discFace(final SnipeData v){ + private void discFace(final SnipeData v) { this.positions = Shapes.discFace(this.getTargetBlock().getLocation(), v.getBrushSize(), this.smoothCircle, this.getTargetBlock().getFace(this.getLastBlock())); } @@ -68,6 +67,7 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DomeBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DomeBrush.java index 6c0c27e8..043436c7 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DomeBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DomeBrush.java @@ -2,15 +2,9 @@ import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.snipe.Undo; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.Shapes; import com.github.kevindagame.util.VoxelMessage; -import com.github.kevindagame.voxelsniper.block.IBlock; -import com.github.kevindagame.voxelsniper.vector.VoxelVector; - -import java.util.HashSet; -import java.util.Set; /** * ... @@ -28,19 +22,18 @@ public DomeBrush() { } /** - * * @param v */ private void generateDome(final SnipeData v) { if (v.getVoxelHeight() == 0) { v.sendMessage(Messages.VOXEL_HEIGHT_MUST_NOT_BE_0); - this.cancel(); return; } this.positions = Shapes.dome(this.getTargetBlock().getLocation(), v.getBrushSize(), v.getVoxelHeight()); } + @Override public final void info(final VoxelMessage vm) { vm.brushName(this.getName()); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DrainBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DrainBrush.java index c29664b8..887b2be9 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DrainBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/DrainBrush.java @@ -1,12 +1,13 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.util.brushOperation.BlockOperation; -import com.github.kevindagame.util.Shapes; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.Shapes; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -59,7 +60,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.DRAIN_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -73,6 +74,7 @@ public final void parseParameters(final String triggerHandle, final String[] par v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipseBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipseBrush.java index 138eabf0..6d89e9c0 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipseBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipseBrush.java @@ -1,15 +1,17 @@ package com.github.kevindagame.brush; -import com.google.common.collect.Lists; import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.block.IBlock; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Objects; /** * ... @@ -44,7 +46,7 @@ private void ellipse(final SnipeData v, IBlock targetBlock) { final int x = (int) Math.round(this.xscl * Math.cos(steps)); final int y = (int) Math.round(this.yscl * Math.sin(steps)); - switch (getTargetBlock().getFace(this.getLastBlock())) { + switch (Objects.requireNonNull(getTargetBlock().getFace(this.getLastBlock()))) { case NORTH: case SOUTH: positions.add(targetBlock.getRelative(0, x, y).getLocation()); @@ -82,7 +84,7 @@ private void ellipsefill(final SnipeData v, IBlock targetBlock) { final int x = (int) Math.round(ix * Math.cos(steps)); final int y = (int) Math.round(iy * Math.sin(steps)); - switch (getTargetBlock().getFace(this.getLastBlock())) { + switch (Objects.requireNonNull(getTargetBlock().getFace(this.getLastBlock()))) { case NORTH: case SOUTH: positions.add(targetBlock.getRelative(0, x, y).getLocation()); @@ -110,7 +112,7 @@ private void ellipsefill(final SnipeData v, IBlock targetBlock) { final int x = (int) Math.round(ix * Math.cos(steps)); final int y = (int) Math.round(iy * Math.sin(steps)); - switch (getTargetBlock().getFace(this.getLastBlock())) { + switch (Objects.requireNonNull(getTargetBlock().getFace(this.getLastBlock()))) { case NORTH: case SOUTH: positions.add(targetBlock.getRelative(0, x, y).getLocation()); @@ -159,7 +161,7 @@ protected final void doPowder(final SnipeData v) { } @Override - public final void info(final VoxelMessage vm) { + public final void info(@NotNull final VoxelMessage vm) { if (this.xscl < SCL_MIN || this.xscl > SCL_MAX) { this.xscl = SCL_DEFAULT; } @@ -239,6 +241,7 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); @@ -248,6 +251,7 @@ public List registerArguments() { return arguments; } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipsoidBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipsoidBrush.java index 5ee7e57f..a04e21c3 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipsoidBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EllipsoidBrush.java @@ -1,11 +1,12 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.voxelsniper.location.BaseLocation; -import com.google.common.collect.Lists; import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.voxelsniper.location.BaseLocation; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -113,6 +114,7 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); @@ -122,6 +124,7 @@ public List registerArguments() { return arguments; } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EntityBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EntityBrush.java index 8ca3230f..7d6368bc 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EntityBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EntityBrush.java @@ -1,10 +1,11 @@ package com.github.kevindagame.brush; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.EntitySpawnOperation; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.EntitySpawnOperation; import com.github.kevindagame.voxelsniper.entity.entitytype.VoxelEntityType; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -52,7 +53,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.ENTITYBRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -74,6 +75,7 @@ public final void parseParameters(final String triggerHandle, final String[] par } } + @NotNull @Override public List registerArguments() { List entities = new ArrayList<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EntityRemovalBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EntityRemovalBrush.java index 0d79a9d8..1ba178ea 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EntityRemovalBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EntityRemovalBrush.java @@ -1,13 +1,14 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.util.brushOperation.EntityRemoveOperation; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.EntityRemoveOperation; import com.github.kevindagame.voxelsniper.chunk.IChunk; import com.github.kevindagame.voxelsniper.entity.IEntity; import com.github.kevindagame.voxelsniper.entity.entitytype.VoxelEntityType; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -110,7 +111,7 @@ public void info(VoxelMessage vm) { } @Override - public void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.ENTITY_REMOVAL_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -160,12 +161,14 @@ public void parseParameters(final String triggerHandle, final String[] params, f v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { return new ArrayList<>(Lists.newArrayList("+", "-", "reset", "clear", "list")); } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EraserBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EraserBrush.java index 1964bf1d..9f1b34f0 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EraserBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/EraserBrush.java @@ -2,9 +2,9 @@ import com.github.kevindagame.snipe.SnipeAction; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.Shapes; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; import java.util.Set; @@ -16,19 +16,10 @@ */ public class EraserBrush extends AbstractBrush { private static final Set EXCLUSIVE_MATERIALS = Set.of( - VoxelMaterial.AIR, VoxelMaterial.CAVE_AIR, VoxelMaterial.VOID_AIR, VoxelMaterial.STONE, VoxelMaterial.GRASS_BLOCK, VoxelMaterial.DIRT, VoxelMaterial.SAND, VoxelMaterial.GRAVEL, VoxelMaterial.SANDSTONE); + VoxelMaterial.AIR, VoxelMaterial.CAVE_AIR, VoxelMaterial.VOID_AIR, VoxelMaterial.STONE, VoxelMaterial.GRASS_BLOCK, VoxelMaterial.DIRT, VoxelMaterial.SAND, VoxelMaterial.GRAVEL, VoxelMaterial.SANDSTONE, VoxelMaterial.DEEPSLATE); private static final Set EXCLUSIVE_LIQUIDS = Set.of( VoxelMaterial.WATER, VoxelMaterial.LAVA); - static { - try { - // 1.17+ - EXCLUSIVE_MATERIALS.add(VoxelMaterial.DEEPSLATE); - } catch (Throwable ignore) { - // Don't add for older versions - } - } - /** * */ diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ErodeBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ErodeBrush.java index b8cfcb0e..90b74ac8 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ErodeBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ErodeBrush.java @@ -1,15 +1,16 @@ package com.github.kevindagame.brush; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; import com.github.kevindagame.voxelsniper.vector.VoxelVector; import com.github.kevindagame.voxelsniper.world.IWorld; import com.google.common.base.Objects; +import org.jetbrains.annotations.NotNull; import java.util.*; import java.util.stream.Collectors; @@ -57,7 +58,7 @@ private void erosion(final SnipeData v, final ErosionPreset erosionPreset) { for (int i = 0; i < erosionPreset.getFillRecursion(); ++i) { fillIteration(v, erosionPreset, blockChangeTracker, targetBlockVector); } - blockChangeTracker.getAll().forEach(block -> addOperation(new BlockOperation(block.block.getLocation(), block.block.getBlockData(), block.blockData ))); + blockChangeTracker.getAll().forEach(block -> addOperation(new BlockOperation(block.block.getLocation(), block.block.getBlockData(), block.blockData))); this.blockTracker = blockChangeTracker; } @@ -154,7 +155,7 @@ public final void info(final VoxelMessage vm) { @Override // TODO: Implement changing of individual variables | fill erode fillrecursion eroderecursion - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.ERODE_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -170,10 +171,11 @@ public final void parseParameters(final String triggerHandle, final String[] par } } + @NotNull @Override public List registerArguments() { - return new ArrayList<>(Arrays.stream(Preset.values()).map(e -> e.name()).collect(Collectors.toList())); + return Arrays.stream(Preset.values()).map(Enum::name).collect(Collectors.toList()); } @Override @@ -281,7 +283,6 @@ private static final class BlockWrapper { private final IBlock block; private final IBlockData blockData; - @SuppressWarnings("deprecation") public BlockWrapper(final IBlock block) { this.block = block; this.blockData = block.getBlockData(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/FillDownBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/FillDownBrush.java index 1e1593f6..1a30c0ae 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/FillDownBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/FillDownBrush.java @@ -1,11 +1,12 @@ package com.github.kevindagame.brush; -import com.google.common.collect.Lists; import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.block.IBlock; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -121,6 +122,7 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JaggedLineBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JaggedLineBrush.java index d8fc5866..1474c731 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JaggedLineBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JaggedLineBrush.java @@ -1,13 +1,14 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.voxelsniper.location.BaseLocation; -import com.google.common.collect.Lists; import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.block.IBlock; +import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.vector.VoxelVector; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.*; @@ -120,6 +121,7 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); @@ -129,6 +131,7 @@ public List registerArguments() { return arguments; } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JockeyBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JockeyBrush.java index 386ccc4a..be364da8 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JockeyBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/JockeyBrush.java @@ -2,10 +2,10 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Undo; -import com.github.kevindagame.util.brushOperation.CustomOperation; -import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.CustomOperation; +import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.github.kevindagame.voxelsniper.chunk.IChunk; import com.github.kevindagame.voxelsniper.entity.IEntity; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; @@ -132,7 +132,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.JOCKEY_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -151,6 +151,7 @@ public final void parseParameters(final String triggerHandle, final String[] par } } + @NotNull @Override public List registerArguments() { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/LightningBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/LightningBrush.java index 1e22ffb5..83aaef95 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/LightningBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/LightningBrush.java @@ -2,10 +2,10 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Undo; -import com.github.kevindagame.util.brushOperation.CustomOperation; -import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.CustomOperation; +import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.google.common.collect.ImmutableList; import org.jetbrains.annotations.NotNull; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/LineBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/LineBrush.java index 9a374229..c7ee9b3a 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/LineBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/LineBrush.java @@ -5,12 +5,9 @@ import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.Shapes; import com.github.kevindagame.util.VoxelMessage; -import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.vector.VoxelVector; import com.github.kevindagame.voxelsniper.world.IWorld; -import java.util.Iterator; - /** * ... * diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/OverlayBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/OverlayBrush.java index 0b82436e..dc296c12 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/OverlayBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/OverlayBrush.java @@ -1,13 +1,14 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.voxelsniper.location.BaseLocation; -import com.google.common.collect.Lists; import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelList; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -171,6 +172,7 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); @@ -180,6 +182,7 @@ public List registerArguments() { return arguments; } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/PaintingBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/PaintingBrush.java index 3f811885..11527710 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/PaintingBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/PaintingBrush.java @@ -3,9 +3,9 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Undo; import com.github.kevindagame.util.BlockHelper; +import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.util.brushOperation.CustomOperation; import com.github.kevindagame.util.brushOperation.CustomOperationContext; -import com.github.kevindagame.util.VoxelMessage; import com.google.common.collect.ImmutableList; import org.jetbrains.annotations.NotNull; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RegenerateChunkBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RegenerateChunkBrush.java index 48e250f3..9cc84da5 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RegenerateChunkBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RegenerateChunkBrush.java @@ -2,17 +2,15 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Undo; -import com.github.kevindagame.util.brushOperation.CustomOperation; -import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.CustomOperation; +import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.github.kevindagame.voxelsniper.chunk.IChunk; import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.google.common.collect.ImmutableList; import org.jetbrains.annotations.NotNull; -import java.util.List; - /** * Regenerates the target chunk. * ... diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RingBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RingBrush.java index 2518e2cd..f148b9a3 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RingBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RingBrush.java @@ -1,12 +1,13 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.util.Shapes; -import com.google.common.collect.Lists; import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.Shapes; import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.block.IBlock; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -34,7 +35,7 @@ public RingBrush() { } private void ring(final SnipeData v, IBlock targetBlock) { - this.positions = Shapes.ring(this.getTargetBlock().getLocation(), v.getBrushSize(), this.innerSize, this.smoothCircle); + this.positions = Shapes.ring(this.getTargetBlock().getLocation(), v.getBrushSize(), this.innerSize, this.smoothCircle); } @Override @@ -81,6 +82,7 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); @@ -90,6 +92,7 @@ public List registerArguments() { return arguments; } + @NotNull @Override public HashMap> registerArgumentValues() { // Number variables diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DBrush.java index 665754ea..bdaaca09 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DBrush.java @@ -1,15 +1,16 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.util.brushOperation.BlockOperation; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.BlockWrapper; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -154,7 +155,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.ROTATE_2D_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -169,6 +170,7 @@ public final void parseParameters(final String triggerHandle, final String[] par } } + @NotNull @Override public List registerArguments() { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DvertBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DvertBrush.java index 4e0af5f5..b699403c 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DvertBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot2DvertBrush.java @@ -1,6 +1,5 @@ package com.github.kevindagame.brush; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.BlockWrapper; import com.github.kevindagame.util.Messages; @@ -8,6 +7,8 @@ import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -152,7 +153,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.ROTATE_2D_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -167,6 +168,7 @@ public final void parseParameters(final String triggerHandle, final String[] par } } + @NotNull @Override public List registerArguments() { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot3DBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot3DBrush.java index 38c5c4db..05f460f3 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot3DBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Rot3DBrush.java @@ -1,6 +1,5 @@ package com.github.kevindagame.brush; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Undo; import com.github.kevindagame.util.BlockWrapper; @@ -9,6 +8,8 @@ import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -41,7 +42,7 @@ public final void info(final VoxelMessage vm) { // --> agreed. Do what erode does and store one snapshot with Block pointers and int id of what the block started with, afterwards simply go thru that // matrix and compare Block.getId with 'id' if different undo.add( new BlockWrapper ( Block, oldId ) ) @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { // which way is clockwise is less obvious for roll and pitch... should probably fix that / make it clear if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.ROTATION_3D_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); @@ -81,12 +82,14 @@ public final void parseParameters(final String triggerHandle, final String[] par v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { return new ArrayList<>(Lists.newArrayList("pitch", "roll", "yaw")); } + @NotNull @Override public HashMap> registerArgumentValues() { // Number variables diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RulerBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RulerBrush.java index 0ea6f1f5..1e49e8fa 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RulerBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/RulerBrush.java @@ -2,10 +2,10 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Undo; -import com.github.kevindagame.util.brushOperation.CustomOperation; -import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.CustomOperation; +import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.github.kevindagame.voxelsniper.vector.VoxelVector; import com.google.common.collect.ImmutableList; import org.jetbrains.annotations.NotNull; @@ -54,7 +54,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.RULER_BRUSH_USAGE); return; @@ -70,7 +70,7 @@ public String getPermissionNode() { @Override public boolean perform(ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { - if(operations.size() != 1){ + if (operations.size() != 1) { return false; } switch (Objects.requireNonNull(getSnipeAction())) { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ScannerBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ScannerBrush.java index 8b7f4a50..97e5a6e7 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ScannerBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ScannerBrush.java @@ -1,15 +1,15 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.snipe.Undo; -import com.github.kevindagame.util.brushOperation.CustomOperation; -import com.github.kevindagame.util.brushOperation.CustomOperationContext; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; +import com.github.kevindagame.snipe.Undo; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.CustomOperation; +import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.github.kevindagame.voxelsniper.block.BlockFace; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -73,7 +73,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.SCANNER_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -91,12 +91,14 @@ public final void parseParameters(final String triggerHandle, final String[] par v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { return new ArrayList<>(Lists.newArrayList("depth")); } + @NotNull @Override public HashMap> registerArgumentValues() { // Number variables @@ -114,7 +116,7 @@ public String getPermissionNode() { @Override public boolean perform(ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { - if(operations.size() != 1) { + if (operations.size() != 1) { return false; } this.scan(snipeData, this.getTargetBlock().getFace(this.getLastBlock())); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SignOverwriteBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SignOverwriteBrush.java index f28b4177..dafabbcf 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SignOverwriteBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SignOverwriteBrush.java @@ -3,11 +3,11 @@ import com.github.kevindagame.VoxelSniper; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Undo; +import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.util.brushOperation.BlockStateOperation; import com.github.kevindagame.util.brushOperation.CustomOperation; import com.github.kevindagame.util.brushOperation.CustomOperationContext; -import com.github.kevindagame.util.Messages; -import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.blockstate.IBlockState; import com.github.kevindagame.voxelsniper.blockstate.sign.ISign; import com.google.common.collect.ImmutableList; @@ -123,7 +123,7 @@ protected final void powder(final SnipeData v) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { boolean textChanged = false; for (int i = 0; i < params.length; i++) { @@ -382,7 +382,7 @@ public String getPermissionNode() { @Override public boolean perform(@NotNull ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { - switch(Objects.requireNonNull(getSnipeAction())) { + switch (Objects.requireNonNull(getSnipeAction())) { case ARROW -> { return false; } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBallBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBallBrush.java index 21d7a0b1..bfcd99c2 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBallBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBallBrush.java @@ -1,19 +1,14 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.snipe.Undo; -import com.github.kevindagame.util.Shapes; -import com.github.kevindagame.voxelsniper.material.VoxelMaterial; -import com.google.common.collect.Lists; -import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; -import com.github.kevindagame.util.VoxelMessage; -import com.github.kevindagame.voxelsniper.block.IBlock; +import com.github.kevindagame.util.Shapes; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Random; /** * ... @@ -50,18 +45,18 @@ protected final void doPowder(final SnipeData v) { @Override public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { - if(super.parseParams(triggerHandle, params, v)) return; + if (super.parseParams(triggerHandle, params, v)) return; if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.SPLATTER_BALL_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; } - v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); @@ -71,6 +66,7 @@ public List registerArguments() { return arguments; } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBrushBase.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBrushBase.java index 5d7b2a0e..e9c57c67 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBrushBase.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterBrushBase.java @@ -5,6 +5,7 @@ import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -193,7 +194,7 @@ protected int[][][] splatter3D(SnipeData v) { } @Override - public final void info(final VoxelMessage vm) { + public final void info(@NotNull final VoxelMessage vm) { if (this.seedPercent < SEED_PERCENT_MIN || this.seedPercent > SEED_PERCENT_MAX) { this.seedPercent = SEED_PERCENT_DEFAULT; } @@ -213,10 +214,10 @@ public final void info(final VoxelMessage vm) { protected void resetBrush(SnipeData v) { - this.seedPercent = SEED_PERCENT_DEFAULT; - this.growPercent = GROW_PERCENT_DEFAULT; - this.splatterRecursions = SPLATREC_PERCENT_DEFAULT; - v.sendMessage(Messages.BRUSH_RESET_DEFAULT); + this.seedPercent = SEED_PERCENT_DEFAULT; + this.growPercent = GROW_PERCENT_DEFAULT; + this.splatterRecursions = SPLATREC_PERCENT_DEFAULT; + v.sendMessage(Messages.BRUSH_RESET_DEFAULT); } @@ -269,6 +270,7 @@ public boolean parseParams(final String triggerHandle, final String[] params, fi return false; } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); @@ -278,6 +280,7 @@ public List registerArguments() { return arguments; } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterDiscBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterDiscBrush.java index 930d2f41..c0f55b75 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterDiscBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterDiscBrush.java @@ -1,17 +1,8 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.util.Shapes; -import com.google.common.collect.Lists; -import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; -import com.github.kevindagame.util.VoxelMessage; -import com.github.kevindagame.voxelsniper.block.IBlock; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Random; +import com.github.kevindagame.util.Shapes; /** * ... @@ -49,7 +40,7 @@ protected final void doPowder(final SnipeData v) { @Override public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { - if(super.parseParams(triggerHandle, params, v)) return; + if (super.parseParams(triggerHandle, params, v)) return; if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.SPLATTER_DISC_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterOverlayBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterOverlayBrush.java index a783c5d4..13dc3d52 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterOverlayBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterOverlayBrush.java @@ -1,11 +1,12 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.voxelsniper.location.BaseLocation; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelList; +import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -18,15 +19,14 @@ */ public class SplatterOverlayBrush extends SplatterBrushBase { - public SplatterOverlayBrush() { - this.setName("Splatter Overlay"); - } - private final boolean randomizeHeight = false; - private int depth = 3; private final int yOffset = 0; + private int depth = 3; private boolean allBlocks = false; private boolean useVoxelList = false; + public SplatterOverlayBrush() { + this.setName("Splatter Overlay"); + } private void sOverlay(final SnipeData v) { @@ -168,6 +168,7 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); @@ -177,6 +178,7 @@ public List registerArguments() { return arguments; } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterVoxelBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterVoxelBrush.java index 2d0da9c0..3a7cda35 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterVoxelBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterVoxelBrush.java @@ -1,18 +1,10 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.util.Shapes; -import com.google.common.collect.Lists; -import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; -import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.Shapes; import com.github.kevindagame.voxelsniper.block.IBlock; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Random; - /** * ... * @@ -48,7 +40,7 @@ protected final void doPowder(final SnipeData v) { @Override public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { - if(super.parseParams(triggerHandle, params, v)) return; + if (super.parseParams(triggerHandle, params, v)) return; if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.SPLATTER_FOXEL_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterVoxelDiscBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterVoxelDiscBrush.java index d963c32e..cf42049e 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterVoxelDiscBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplatterVoxelDiscBrush.java @@ -1,27 +1,16 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.util.Shapes; -import com.google.common.collect.Lists; -import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; -import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.Shapes; import com.github.kevindagame.voxelsniper.block.IBlock; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Random; - /** - * - * * @author Voxel */ public class SplatterVoxelDiscBrush extends SplatterBrushBase { - /** * */ @@ -53,7 +42,7 @@ protected final void doPowder(final SnipeData v) { @Override public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { - if(super.parseParams(triggerHandle, params, v)) return; + if (super.parseParams(triggerHandle, params, v)) return; if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.SPLATTER_VOXEL_DISC_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplineBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplineBrush.java index b341915d..342ae4a7 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplineBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/SplineBrush.java @@ -1,12 +1,13 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.voxelsniper.location.BaseLocation; -import com.google.common.collect.Lists; import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.block.IBlock; +import com.github.kevindagame.voxelsniper.location.BaseLocation; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -16,6 +17,7 @@ * FOR ANY BRUSH THAT USES A SPLINE, EXTEND THAT BRUSH FROM THIS BRUSH!!! That way, the spline calculations are already there. Also, the UI for the splines will * be included. * ... + * * @author psanker */ public class SplineBrush extends PerformerBrush { @@ -199,6 +201,7 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/StampBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/StampBrush.java index e66c6402..1724c9b8 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/StampBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/StampBrush.java @@ -2,11 +2,12 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.BlockWrapper; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import org.jetbrains.annotations.NotNull; import java.util.HashSet; @@ -133,7 +134,7 @@ protected void powder(final SnipeData v) { } @Override - public void info(final VoxelMessage vm) { + public void info(@NotNull final VoxelMessage vm) { throw new UnsupportedOperationException("Not supported yet."); } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ThreePointCircleBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ThreePointCircleBrush.java index 5c4af114..7509f897 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ThreePointCircleBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/ThreePointCircleBrush.java @@ -6,14 +6,15 @@ import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.vector.VoxelVector; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** - * * ... + * * @author Giltwist */ public class ThreePointCircleBrush extends PerformerBrush { @@ -165,6 +166,7 @@ public final void parseParameters(final String triggerHandle, final String[] par } } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/TreeSnipeBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/TreeSnipeBrush.java index 43ddab8d..1d4e8cc4 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/TreeSnipeBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/TreeSnipeBrush.java @@ -1,18 +1,16 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.VoxelSniper; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.block.BlockFace; import com.github.kevindagame.voxelsniper.block.IBlock; -import com.github.kevindagame.voxelsniper.blockstate.IBlockState; import com.github.kevindagame.voxelsniper.location.BaseLocation; -import com.github.kevindagame.voxelsniper.material.VoxelMaterial; import com.github.kevindagame.voxelsniper.treeType.VoxelTreeType; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.format.NamedTextColor; +import org.jetbrains.annotations.NotNull; import java.util.Arrays; import java.util.List; @@ -88,7 +86,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.TREESNIPE_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -105,6 +103,7 @@ public final void parseParameters(final String triggerHandle, final String[] par } } + @NotNull @Override public List registerArguments() { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/UnderlayBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/UnderlayBrush.java index 66441388..ccc40e1c 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/UnderlayBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/UnderlayBrush.java @@ -1,13 +1,14 @@ package com.github.kevindagame.brush; -import com.github.kevindagame.voxelsniper.location.BaseLocation; -import com.google.common.collect.Lists; import com.github.kevindagame.brush.perform.PerformerBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelList; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -159,6 +160,7 @@ public final void parseParameters(final String triggerHandle, final String[] par sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { List arguments = new ArrayList<>(); @@ -168,6 +170,7 @@ public List registerArguments() { return arguments; } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoltMeterBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoltMeterBrush.java index c1bcb6d4..3ca9c2c4 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoltMeterBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoltMeterBrush.java @@ -2,10 +2,10 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Undo; -import com.github.kevindagame.util.brushOperation.CustomOperation; -import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.CustomOperation; +import com.github.kevindagame.util.brushOperation.CustomOperationContext; import com.github.kevindagame.voxelsniper.block.BlockFace; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.blockdata.redstoneWire.IRedstoneWire; @@ -70,7 +70,7 @@ public String getPermissionNode() { } @Override - public boolean perform(ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { + public boolean perform(@NotNull ImmutableList operations, @NotNull SnipeData snipeData, @NotNull Undo undo) { switch (Objects.requireNonNull(this.getSnipeAction())) { case ARROW: volt(snipeData); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoxelDiscBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoxelDiscBrush.java index e050aa3f..94d78c76 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoxelDiscBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoxelDiscBrush.java @@ -4,7 +4,6 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Shapes; import com.github.kevindagame.util.VoxelMessage; -import com.github.kevindagame.voxelsniper.block.IBlock; /** * ... diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoxelDiscFaceBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoxelDiscFaceBrush.java index 306efee8..ff50aadf 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoxelDiscFaceBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/VoxelDiscFaceBrush.java @@ -4,8 +4,6 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Shapes; import com.github.kevindagame.util.VoxelMessage; -import com.github.kevindagame.voxelsniper.block.BlockFace; -import com.github.kevindagame.voxelsniper.block.IBlock; /** * ... diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/CanyonBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CanyonBrush.java similarity index 94% rename from VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/CanyonBrush.java rename to VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CanyonBrush.java index e27e9eec..63c77e46 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/CanyonBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CanyonBrush.java @@ -1,14 +1,15 @@ -package com.github.kevindagame.brush.MultiBlock; +package com.github.kevindagame.brush.multiBlock; import com.github.kevindagame.brush.AbstractBrush; -import com.github.kevindagame.util.brushOperation.BlockOperation; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.chunk.IChunk; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -79,7 +80,7 @@ public void info(final VoxelMessage vm) { } @Override - public final void parseParameters(String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.CANYON_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -107,11 +108,13 @@ public final void parseParameters(String triggerHandle, final String[] params, f v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { return new ArrayList<>(Lists.newArrayList("y")); } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/CanyonSelectionBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CanyonSelectionBrush.java similarity index 97% rename from VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/CanyonSelectionBrush.java rename to VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CanyonSelectionBrush.java index 01d4be29..a1b4878b 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/CanyonSelectionBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CanyonSelectionBrush.java @@ -1,4 +1,4 @@ -package com.github.kevindagame.brush.MultiBlock; +package com.github.kevindagame.brush.multiBlock; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Undo; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/CopyPastaBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CopyPastaBrush.java similarity index 97% rename from VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/CopyPastaBrush.java rename to VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CopyPastaBrush.java index 3122b93b..f648e199 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/CopyPastaBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/CopyPastaBrush.java @@ -1,14 +1,15 @@ -package com.github.kevindagame.brush.MultiBlock; +package com.github.kevindagame.brush.multiBlock; import com.github.kevindagame.brush.AbstractBrush; -import com.github.kevindagame.util.brushOperation.BlockOperation; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Undo; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -41,7 +42,6 @@ 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; @@ -69,7 +69,6 @@ private void doCopy(final SnipeData v) { } } - @SuppressWarnings("deprecation") private void doPasta(final SnipeData v) { final Undo undo = new Undo(); @@ -159,7 +158,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.COPYPASTA_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -183,12 +182,14 @@ public final void parseParameters(final String triggerHandle, final String[] par v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { return new ArrayList<>(Lists.newArrayList("rotate", "air")); } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/ExtrudeBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/ExtrudeBrush.java similarity index 96% rename from VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/ExtrudeBrush.java rename to VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/ExtrudeBrush.java index a6fa6ec2..215d36c2 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/ExtrudeBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/ExtrudeBrush.java @@ -1,13 +1,14 @@ -package com.github.kevindagame.brush.MultiBlock; +package com.github.kevindagame.brush.multiBlock; import com.github.kevindagame.brush.AbstractBrush; -import com.github.kevindagame.util.brushOperation.BlockOperation; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.BlockFace; import com.github.kevindagame.voxelsniper.block.IBlock; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -148,7 +149,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.EXTRUDE_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -163,6 +164,7 @@ public final void parseParameters(final String triggerHandle, final String[] par v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/FlatOceanBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/FlatOceanBrush.java similarity index 96% rename from VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/FlatOceanBrush.java rename to VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/FlatOceanBrush.java index f67bd738..b1090d60 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/FlatOceanBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/FlatOceanBrush.java @@ -1,14 +1,15 @@ -package com.github.kevindagame.brush.MultiBlock; +package com.github.kevindagame.brush.multiBlock; import com.github.kevindagame.brush.AbstractBrush; -import com.github.kevindagame.util.BlockWrapper; -import com.github.kevindagame.util.brushOperation.BlockOperation; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; +import com.github.kevindagame.util.BlockWrapper; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.chunk.IChunk; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -78,7 +79,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.FLAT_OCEAN_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); v.sendMessage(Messages.BRUSH_NO_UNDO); @@ -116,12 +117,14 @@ public final void parseParameters(final String triggerHandle, final String[] par v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { return new ArrayList<>(Lists.newArrayList("water", "floor")); } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/GenerateTreeBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/GenerateTreeBrush.java similarity index 97% rename from VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/GenerateTreeBrush.java rename to VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/GenerateTreeBrush.java index c1ab4b27..dac26877 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/GenerateTreeBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/GenerateTreeBrush.java @@ -1,15 +1,16 @@ -package com.github.kevindagame.brush.MultiBlock; +package com.github.kevindagame.brush.multiBlock; import com.github.kevindagame.brush.AbstractBrush; -import com.github.kevindagame.util.brushOperation.BlockOperation; -import com.github.kevindagame.voxelsniper.location.VoxelLocation; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.location.BaseLocation; +import com.github.kevindagame.voxelsniper.location.VoxelLocation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.*; @@ -75,7 +76,7 @@ private void branchCreate(BaseLocation origin, final int xDirection, final int z // Creates a branch block. addOperation(new BlockOperation(location, location.getBlock().getBlockData(), this.woodMaterial.createBlockData())); - this.branchBlocks.add(location.getClampedBlock()); + this.branchBlocks.add(location.getBlock()); } } @@ -167,7 +168,7 @@ private void rootCreate(BaseLocation origin, final int xDirection, final int zDi } List blocks = Arrays.asList(VoxelMaterial.WATER, VoxelMaterial.SNOW, VoxelMaterial.OAK_LOG, VoxelMaterial.BIRCH_LOG, VoxelMaterial.ACACIA_LOG, VoxelMaterial.DARK_OAK_LOG, VoxelMaterial.SPRUCE_LOG, VoxelMaterial.JUNGLE_LOG); // Checks is block below is solid - if (blocks.contains(location.getClampedBlock().getRelative(0, -1, 0).getMaterial())) { + if (blocks.contains(location.getBlock().getRelative(0, -1, 0).getMaterial())) { // Move down if solid. location.addY(-1); if (this.rootFloat) { @@ -187,7 +188,7 @@ private void rootCreate(BaseLocation origin, final int xDirection, final int zDi location.addZ(zDirection); } // Checks if new location is solid, if not then move down. - if (blocks.contains(location.getClampedBlock().getRelative(0, -1, 0).getMaterial())) { + if (blocks.contains(location.getBlock().getRelative(0, -1, 0).getMaterial())) { location.addY(-1); } } @@ -384,7 +385,7 @@ public boolean chance(int chance) { @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { if (params.length == 1 || params[1].equals("1")) { @@ -546,6 +547,7 @@ public final void parseParameters(final String triggerHandle, final String[] par v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { @@ -553,6 +555,7 @@ public List registerArguments() { "rootFloat", "info", "rootMin", "rootMax", "minHeight", "maxHeight", "leavesMin", "leavesMax", "default")); } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/MoveBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/MoveBrush.java similarity index 97% rename from VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/MoveBrush.java rename to VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/MoveBrush.java index 430c6abd..27586261 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/MoveBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/MoveBrush.java @@ -1,16 +1,16 @@ -package com.github.kevindagame.brush.MultiBlock; +package com.github.kevindagame.brush.multiBlock; import com.github.kevindagame.brush.AbstractBrush; -import com.github.kevindagame.util.BlockWrapper; -import com.github.kevindagame.util.brushOperation.BlockOperation; -import com.github.kevindagame.voxelsniper.location.VoxelLocation; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; +import com.github.kevindagame.util.BlockWrapper; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.location.BaseLocation; +import com.github.kevindagame.voxelsniper.location.VoxelLocation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; import com.github.kevindagame.voxelsniper.world.IWorld; +import com.google.common.collect.Lists; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.ComponentLike; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; @@ -35,6 +35,7 @@ public class MoveBrush extends AbstractBrush { * Saved selection. */ private Selection selection = null; + /** * */ @@ -118,7 +119,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.MOVE_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -157,12 +158,14 @@ public final void parseParameters(final String triggerHandle, final String[] par v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { return new ArrayList<>(Lists.newArrayList("reset", "x", "y", "z")); } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); @@ -192,7 +195,8 @@ public String getMessage() { } @Override - public @NotNull Component asComponent() { + public @NotNull + Component asComponent() { return component.asComponent(); } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/OceanBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/OceanBrush.java similarity index 97% rename from VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/OceanBrush.java rename to VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/OceanBrush.java index e74ddac8..28279b1a 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/OceanBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/OceanBrush.java @@ -1,15 +1,16 @@ -package com.github.kevindagame.brush.MultiBlock; +package com.github.kevindagame.brush.multiBlock; import com.github.kevindagame.brush.AbstractBrush; -import com.github.kevindagame.util.brushOperation.BlockOperation; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Undo; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; import com.github.kevindagame.voxelsniper.world.IWorld; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.HashMap; @@ -107,7 +108,6 @@ private int getHeight(final int bx, final int bz) { * @param v * @param undo */ - @SuppressWarnings("deprecation") protected final void oceanator(final SnipeData v, final Undo undo) { final IWorld world = this.getWorld(); @@ -164,7 +164,7 @@ protected final void powder(final SnipeData v) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.OCEAN_BRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -195,12 +195,14 @@ public final void parseParameters(final String triggerHandle, final String[] par v.sendMessage(Messages.BRUSH_INVALID_PARAM.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { return new ArrayList<>(Lists.newArrayList("water", "floor")); } + @NotNull @Override public HashMap> registerArgumentValues() { HashMap> argumentValues = new HashMap<>(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/PullBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/PullBrush.java similarity index 98% rename from VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/PullBrush.java rename to VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/PullBrush.java index 0183af56..d2417a45 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/MultiBlock/PullBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/multiBlock/PullBrush.java @@ -1,14 +1,15 @@ -package com.github.kevindagame.brush.MultiBlock; +package com.github.kevindagame.brush.multiBlock; import com.github.kevindagame.brush.AbstractBrush; -import com.github.kevindagame.util.brushOperation.BlockOperation; -import com.google.common.collect.Lists; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; import java.util.HashSet; import java.util.List; @@ -40,7 +41,7 @@ public final void info(final VoxelMessage vm) { } @Override - public final void parseParameters(final String triggerHandle, final String[] params, final SnipeData v) { + public final void parseParameters(@NotNull final String triggerHandle, final String[] params, @NotNull final SnipeData v) { if (params[0].equalsIgnoreCase("info")) { v.sendMessage(Messages.PULLBRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); return; @@ -75,6 +76,7 @@ public final void parseParameters(final String triggerHandle, final String[] par v.sendMessage(Messages.PULLBRUSH_USAGE.replace("%triggerHandle%", triggerHandle)); } + @NotNull @Override public List registerArguments() { return Lists.newArrayList("pinch", "bubble"); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/BasePerformer.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/BasePerformer.java index 87080563..fc2c7b64 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/BasePerformer.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/BasePerformer.java @@ -6,9 +6,9 @@ import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Undo; +import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.brushOperation.BrushOperation; -import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.world.IWorld; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/Performer.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/Performer.java index 6d57e227..964d79e0 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/Performer.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/Performer.java @@ -101,7 +101,7 @@ public enum Performer { private final Class pclass; private final String short_name; -// public static final Component performer_list_short; + // public static final Component performer_list_short; // public static final Component performer_list_long; private final String long_name; @@ -138,7 +138,7 @@ private BasePerformer getPerformer() { p = pclass.getConstructor().newInstance(); return p; } catch (InstantiationException | InvocationTargetException | IllegalArgumentException | - IllegalAccessException ex) { + IllegalAccessException ex) { Logger.getLogger(Performer.class.getName()).log(Level.SEVERE, null, ex); } } catch (NoSuchMethodException | SecurityException ex) { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/PerformerBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/PerformerBrush.java index 24fcc607..12cfaede 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/PerformerBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/PerformerBrush.java @@ -4,15 +4,18 @@ */ package com.github.kevindagame.brush.perform; -import com.github.kevindagame.voxelsniper.events.player.PlayerBrushChangedEvent; -import com.github.kevindagame.voxelsniper.location.BaseLocation; -import com.google.common.collect.Lists; import com.github.kevindagame.brush.AbstractBrush; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.voxelsniper.events.player.PlayerBrushChangedEvent; +import com.github.kevindagame.voxelsniper.location.BaseLocation; +import com.google.common.collect.Lists; +import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; /** * @author Voxel @@ -20,13 +23,12 @@ public abstract class PerformerBrush extends AbstractBrush implements IPerformerBrush { protected BasePerformer currentPerformer = new pMaterial(); + protected List positions = new ArrayList<>(); public BasePerformer getCurrentPerformer() { return currentPerformer; } - protected List positions = new ArrayList<>(); - public void sendPerformerMessage(String triggerHandle, SnipeData v) { v.sendMessage(Messages.PERFORMER_MESSAGE.replace("%triggerHandle%", triggerHandle)); } @@ -35,7 +37,7 @@ public void sendPerformerMessage(String triggerHandle, SnipeData v) { public final boolean parsePerformer(String performerHandle, SnipeData v) { BasePerformer newPerfomer = Performer.getPerformer(performerHandle); if (newPerfomer != null) { - if(!new PlayerBrushChangedEvent(v.owner().getPlayer(), v.owner().getCurrentToolId(), this, this).callEvent().isCancelled()) { + if (!new PlayerBrushChangedEvent(v.owner().getPlayer(), v.owner().getCurrentToolId(), this, this).callEvent().isCancelled()) { currentPerformer = newPerfomer; info(v.getVoxelMessage()); currentPerformer.info(v.getVoxelMessage()); @@ -57,18 +59,20 @@ public final void parsePerformer(String triggerHandle, String[] args, SnipeData } @Override - public void parseParameters(String triggerHandle, String[] params, SnipeData v) { + public void parseParameters(@NotNull String triggerHandle, @NotNull String[] params, @NotNull SnipeData v) { super.parseParameters(triggerHandle, params, v); sendPerformerMessage(triggerHandle, v); } + @NotNull @Override public List registerArguments() { return new ArrayList<>(Lists.newArrayList("p")); } + @NotNull @Override public HashMap> registerArgumentValues() { // Number variables HashMap> argumentValues = new HashMap<>(); @@ -89,7 +93,9 @@ public void showInfo(VoxelMessage vm) { } protected abstract void doArrow(SnipeData v); + protected abstract void doPowder(SnipeData v); + @Override protected final void arrow(SnipeData v) { doArrow(v); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pCombo.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pCombo.java index 38c2f216..43cd62f9 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pCombo.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pCombo.java @@ -5,8 +5,8 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboCombo.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboCombo.java index 5f4fd152..2181f8af 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboCombo.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboCombo.java @@ -5,8 +5,8 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboComboNoPhysics.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboComboNoPhysics.java index f1ac760a..ce3f02b0 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboComboNoPhysics.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboComboNoPhysics.java @@ -5,8 +5,8 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboMat.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboMat.java index 91b32097..0e1adb15 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboMat.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboMat.java @@ -5,8 +5,8 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboMatNoPhysics.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboMatNoPhysics.java index 97021ba7..2a605b8f 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboMatNoPhysics.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboMatNoPhysics.java @@ -5,8 +5,8 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboNoPhysics.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboNoPhysics.java index 7bc4ed8a..d10bd89b 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboNoPhysics.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pComboNoPhysics.java @@ -5,8 +5,8 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pExcludeCombo.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pExcludeCombo.java index 83114b47..37ccfc69 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pExcludeCombo.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pExcludeCombo.java @@ -5,9 +5,9 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelList; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pExcludeMat.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pExcludeMat.java index 06318363..6816a5fb 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pExcludeMat.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pExcludeMat.java @@ -5,9 +5,9 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelList; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pIncludeCombo.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pIncludeCombo.java index cc97d420..4fddbe29 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pIncludeCombo.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pIncludeCombo.java @@ -5,9 +5,9 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelList; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pIncludeMat.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pIncludeMat.java index eccab008..f7792326 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pIncludeMat.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pIncludeMat.java @@ -5,9 +5,9 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelList; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatCombo.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatCombo.java index a244f171..6662232b 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatCombo.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatCombo.java @@ -5,8 +5,8 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatComboNoPhysics.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatComboNoPhysics.java index e1b6f5eb..f9be2a47 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatComboNoPhysics.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatComboNoPhysics.java @@ -5,8 +5,8 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatMat.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatMat.java index dc5777e7..47effc7d 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatMat.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatMat.java @@ -5,8 +5,8 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatMatNoPhysics.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatMatNoPhysics.java index e1cc5ece..8f42eaf2 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatMatNoPhysics.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMatMatNoPhysics.java @@ -5,8 +5,8 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMaterial.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMaterial.java index 5cc226a5..49eb340f 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMaterial.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMaterial.java @@ -5,8 +5,8 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMaterialNoPhysics.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMaterialNoPhysics.java index 0b32c84d..51e74363 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMaterialNoPhysics.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/perform/pMaterialNoPhysics.java @@ -5,8 +5,8 @@ package com.github.kevindagame.brush.perform; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.VoxelMessage; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Shell/ShellBallBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/shell/ShellBallBrush.java similarity index 96% rename from VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Shell/ShellBallBrush.java rename to VoxelSniperCore/src/main/java/com/github/kevindagame/brush/shell/ShellBallBrush.java index ff883903..c6f73ce4 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Shell/ShellBallBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/shell/ShellBallBrush.java @@ -1,9 +1,9 @@ -package com.github.kevindagame.brush.Shell; +package com.github.kevindagame.brush.shell; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.Shapes; +import com.github.kevindagame.util.brushOperation.BlockOperation; /** * THIS BRUSH SHOULD NOT USE PERFORMERS. http://www.voxelwiki.com/minecraft/Voxelsniper#Shell_Brushes diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Shell/ShellBrushBase.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/shell/ShellBrushBase.java similarity index 96% rename from VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Shell/ShellBrushBase.java rename to VoxelSniperCore/src/main/java/com/github/kevindagame/brush/shell/ShellBrushBase.java index 4c230a4d..3db2e36c 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Shell/ShellBrushBase.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/shell/ShellBrushBase.java @@ -1,9 +1,7 @@ -package com.github.kevindagame.brush.Shell; +package com.github.kevindagame.brush.shell; import com.github.kevindagame.brush.AbstractBrush; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.snipe.Undo; -import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.VoxelMessage; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Shell/ShellSetBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/shell/ShellSetBrush.java similarity index 97% rename from VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Shell/ShellSetBrush.java rename to VoxelSniperCore/src/main/java/com/github/kevindagame/brush/shell/ShellSetBrush.java index 26a12eea..ee8f881c 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Shell/ShellSetBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/shell/ShellSetBrush.java @@ -1,9 +1,9 @@ -package com.github.kevindagame.brush.Shell; +package com.github.kevindagame.brush.shell; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.util.BlockWrapper; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.Messages; +import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.voxelsniper.block.IBlock; import java.util.ArrayList; @@ -16,8 +16,8 @@ public class ShellSetBrush extends ShellBrushBase { private static final int MAX_SIZE = 5000000; + private final ArrayList operations = new ArrayList<>(); private IBlock block = null; - private ArrayList operations = new ArrayList<>(); /** * diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Shell/ShellVoxelBrush.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/shell/ShellVoxelBrush.java similarity index 96% rename from VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Shell/ShellVoxelBrush.java rename to VoxelSniperCore/src/main/java/com/github/kevindagame/brush/shell/ShellVoxelBrush.java index 61b050d6..7ec96d0b 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/Shell/ShellVoxelBrush.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/brush/shell/ShellVoxelBrush.java @@ -1,9 +1,9 @@ -package com.github.kevindagame.brush.Shell; +package com.github.kevindagame.brush.shell; import com.github.kevindagame.snipe.SnipeData; -import com.github.kevindagame.util.brushOperation.BlockOperation; import com.github.kevindagame.util.Messages; import com.github.kevindagame.util.Shapes; +import com.github.kevindagame.util.brushOperation.BlockOperation; /** * THIS BRUSH SHOULD NOT USE PERFORMERS. ... diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/MaterialCommand.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/MaterialCommand.java index bc3b0083..f7c39d92 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/MaterialCommand.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/MaterialCommand.java @@ -1,8 +1,8 @@ package com.github.kevindagame.command; -import com.google.common.collect.Lists; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.List; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelBrushCommand.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelBrushCommand.java index 47373e72..954dfe38 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelBrushCommand.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelBrushCommand.java @@ -58,7 +58,7 @@ public boolean doCommand(IPlayer player, final String[] args) { try { int originalSize = snipeData.getBrushSize(); - if(!new PlayerBrushSizeChangedEvent(player, currentToolId, sniper.getBrush(currentToolId), originalSize, snipeData.getBrushSize()).callEvent().isCancelled()) { + if (!new PlayerBrushSizeChangedEvent(player, currentToolId, sniper.getBrush(currentToolId), originalSize, snipeData.getBrushSize()).callEvent().isCancelled()) { snipeData.setBrushSize(Integer.parseInt(args[0])); snipeData.getVoxelMessage().size(); return true; @@ -101,7 +101,7 @@ public boolean doCommand(IPlayer player, final String[] args) { } return true; } - if(!new PlayerBrushChangedEvent(player, currentToolId, oldBrush, newBrush).callEvent().isCancelled()) { + if (!new PlayerBrushChangedEvent(player, currentToolId, oldBrush, newBrush).callEvent().isCancelled()) { sniper.setBrush(currentToolId, brush); sniper.displayInfo(); } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelBrushToolCommand.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelBrushToolCommand.java index 4c567b89..904fe9aa 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelBrushToolCommand.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelBrushToolCommand.java @@ -1,12 +1,12 @@ package com.github.kevindagame.command; -import com.google.common.collect.Lists; import com.github.kevindagame.VoxelProfileManager; import com.github.kevindagame.snipe.SnipeAction; import com.github.kevindagame.snipe.Sniper; import com.github.kevindagame.util.Messages; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.Arrays; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelPerformerCommand.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelPerformerCommand.java index 2b09e48d..2939b7c0 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelPerformerCommand.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelPerformerCommand.java @@ -1,6 +1,5 @@ package com.github.kevindagame.command; -import com.google.common.collect.Lists; import com.github.kevindagame.VoxelProfileManager; import com.github.kevindagame.brush.IBrush; import com.github.kevindagame.brush.perform.IPerformerBrush; @@ -9,6 +8,7 @@ import com.github.kevindagame.snipe.Sniper; import com.github.kevindagame.util.Messages; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; +import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.List; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelSniperCommand.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelSniperCommand.java index 1b90da35..b4995ffc 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelSniperCommand.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelSniperCommand.java @@ -1,11 +1,11 @@ package com.github.kevindagame.command; -import com.google.common.collect.Lists; import com.github.kevindagame.VoxelProfileManager; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Sniper; import com.github.kevindagame.util.Messages; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; +import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.List; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVariablesCommand.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVariablesCommand.java index b9716b01..2aec6084 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVariablesCommand.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVariablesCommand.java @@ -1,12 +1,12 @@ package com.github.kevindagame.command; -import com.google.common.collect.Lists; import com.github.kevindagame.VoxelProfileManager; import com.github.kevindagame.snipe.SnipeData; import com.github.kevindagame.snipe.Sniper; import com.github.kevindagame.util.Messages; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.Arrays; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVoxCommand.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVoxCommand.java index f934d7e9..47664f34 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVoxCommand.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/command/VoxelVoxCommand.java @@ -1,10 +1,10 @@ package com.github.kevindagame.command; -import com.google.common.collect.Lists; import com.github.kevindagame.util.BlockHelper; import com.github.kevindagame.util.Messages; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; import com.github.kevindagame.voxelsniper.location.BaseLocation; +import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.List; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Sniper.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Sniper.java index 2c22510e..521a7335 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Sniper.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Sniper.java @@ -1,6 +1,5 @@ package com.github.kevindagame.snipe; -import com.google.common.collect.Maps; import com.github.kevindagame.VoxelSniper; import com.github.kevindagame.brush.IBrush; import com.github.kevindagame.brush.perform.IPerformerBrush; @@ -12,6 +11,7 @@ import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.Maps; import net.kyori.adventure.text.ComponentLike; import org.jetbrains.annotations.NotNull; @@ -127,8 +127,7 @@ private boolean handleRightClick(IBlock clickedBlock, SnipeTool sniperTool, Snip performerBrush.initP(snipeData); } - var success = sniperTool.getCurrentBrush().perform(snipeAction, snipeData, targetBlock, lastBlock); - return success; + return sniperTool.getCurrentBrush().perform(snipeAction, snipeData, targetBlock, lastBlock); } private boolean handleSneakLeftClick(String toolId, SnipeData snipeData, SnipeAction snipeAction, IBlock targetBlock) { @@ -243,7 +242,6 @@ public int undo(int amount) { } sendMessage(Messages.UNDO_SUCCESSFUL.replace("%changedBlocks%", String.valueOf(changedBlocks))); - ; } return changedBlocks; } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Undo.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Undo.java index 8e5cdb7d..cf958b09 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Undo.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/snipe/Undo.java @@ -1,10 +1,10 @@ package com.github.kevindagame.snipe; -import com.google.common.collect.Sets; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockstate.IBlockState; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; import com.github.kevindagame.voxelsniper.vector.VoxelVector; +import com.google.common.collect.Sets; import java.util.Arrays; import java.util.LinkedList; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Actions.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Actions.java index ba376229..f173b5a1 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Actions.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Actions.java @@ -3,16 +3,16 @@ import com.github.kevindagame.voxelsniper.location.BaseLocation; import java.util.List; -import java.util.Set; import java.util.stream.Collectors; public class Actions { /** * Returns the locations that are on a checker grid, according to their sum - * @param locations - * @param even - * @return + * + * @param locations A list of locations + * @param even whether the sum of x + y + z should be even or odd + * @return The locations of which the sum of x + y + z is even or odd */ public static List checker(List locations, boolean even) { return locations.stream().filter(location -> (location.getBlockX() + location.getBlockY() + location.getBlockZ()) % 2 != (even ? 0 : 1)).collect(Collectors.toList()); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/BlockHelper.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/BlockHelper.java index 262ff3e0..a3399be1 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/BlockHelper.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/BlockHelper.java @@ -3,8 +3,8 @@ import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.chunk.IChunk; import com.github.kevindagame.voxelsniper.entity.IEntity; -import com.github.kevindagame.voxelsniper.entity.Painting.IPainting; import com.github.kevindagame.voxelsniper.entity.entitytype.VoxelEntityType; +import com.github.kevindagame.voxelsniper.entity.painting.IPainting; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.location.VoxelLocation; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/BlockWrapper.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/BlockWrapper.java index c06699c5..bfbb7fe2 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/BlockWrapper.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/BlockWrapper.java @@ -69,14 +69,6 @@ public final BlockWrapper setBlockData(final IBlockData blockData) { return this; } - /** - * @param material the material to set - */ - public final BlockWrapper setMaterial(final VoxelMaterial material) { - setBlockData(material.createBlockData()); - return this; - } - /** * @return the id */ @@ -85,17 +77,18 @@ public final VoxelMaterial getMaterial() { } /** - * @return the world + * @param material the material to set */ - public final IWorld getWorld() { - return this.world; + public final BlockWrapper setMaterial(final VoxelMaterial material) { + setBlockData(material.createBlockData()); + return this; } /** - * @return the BaseLocation + * @return the world */ - public final BaseLocation getLocation() { - return new BaseLocation(this.world, this.x, this.y, this.z); + public final IWorld getWorld() { + return this.world; } /** @@ -106,6 +99,13 @@ public final BlockWrapper setWorld(final IWorld world) { return this; } + /** + * @return the BaseLocation + */ + public final BaseLocation getLocation() { + return new BaseLocation(this.world, this.x, this.y, this.z); + } + /** * @return the x */ diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Messages.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Messages.java index 0f819534..182c73e3 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Messages.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Messages.java @@ -358,7 +358,8 @@ public enum Messages implements ComponentLike { // - private @NotNull String message = this.name().toLowerCase(Locale.ROOT); + private @NotNull + String message = this.name().toLowerCase(Locale.ROOT); public static void load(IVoxelsniper voxelSniper) { File langFile = new File(voxelSniper.getFileHandler().getDataFolder(), "lang.yml"); @@ -415,7 +416,8 @@ public ComponentLike append(ComponentLike message) { } @Override - public @NotNull Component asComponent() { + public @NotNull + Component asComponent() { return MiniMessage.miniMessage().deserialize(this.message); } @@ -455,7 +457,8 @@ public Message append(String message) { } @Override - public @NotNull Component asComponent() { + public @NotNull + Component asComponent() { return MiniMessage.miniMessage().deserialize(this.message); } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Shapes.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Shapes.java index 4ad85b18..9bf28463 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Shapes.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/Shapes.java @@ -7,7 +7,9 @@ import com.github.kevindagame.voxelsniper.vector.VoxelVector; import com.github.kevindagame.voxelsniper.world.IWorld; -import java.util.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; public class Shapes { static double SMOOTH_CIRCLE_VALUE = 0.5; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/VoxelList.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/VoxelList.java index 0acb635a..42089056 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/VoxelList.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/VoxelList.java @@ -1,7 +1,7 @@ package com.github.kevindagame.util; -import com.google.common.collect.ImmutableList; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; +import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.List; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/VoxelMessage.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/VoxelMessage.java index 9b83db96..b3eadb97 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/VoxelMessage.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/VoxelMessage.java @@ -1,6 +1,7 @@ package com.github.kevindagame.util; import com.github.kevindagame.snipe.SnipeData; +import com.github.kevindagame.voxelsniper.material.VoxelMaterial; import net.kyori.adventure.text.ComponentLike; import java.util.stream.Collectors; @@ -113,7 +114,7 @@ public void toggleLightning() { /** * Display toggle printout message. */ - public final void togglePrintout() { + public void togglePrintout() { // TODO seems to do the same as toggleLightning() String state = ((snipeData.owner().getSnipeData(snipeData.owner().getCurrentToolId()).isLightningEnabled()) ? "on" : "off"); snipeData.sendMessage(Messages.TOGGLE_PRINTOUT.replace("%state%", state)); @@ -136,7 +137,7 @@ public void voxelList() { snipeData.sendMessage(Messages.VOXEL_LIST_EMPTY); } else { - String blocks = snipeData.getVoxelList().getList().stream().map(e -> e.getKey().toString()).collect(Collectors.joining(",")); + String blocks = snipeData.getVoxelList().getList().stream().map(VoxelMaterial::getKey).collect(Collectors.joining(",")); snipeData.sendMessage(Messages.VOXEL_LIST.replace("%blocks%", blocks)); } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/brushOperation/BlockStateOperation.kt b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/brushOperation/BlockStateOperation.kt index b9e56f7d..077da8a3 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/util/brushOperation/BlockStateOperation.kt +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/util/brushOperation/BlockStateOperation.kt @@ -4,16 +4,25 @@ import com.github.kevindagame.snipe.Undo import com.github.kevindagame.voxelsniper.blockstate.IBlockState import com.github.kevindagame.voxelsniper.location.BaseLocation -class BlockStateOperation(location: BaseLocation, val oldState: IBlockState, var newState: IBlockState) : BrushOperation(location) { +class BlockStateOperation(location: BaseLocation, val oldState: IBlockState, var newState: IBlockState) : + BrushOperation(location) { private var force = false private var applyPhysics = true + constructor(location: BaseLocation, oldState: IBlockState, newState: IBlockState, force: Boolean) : this( - location, oldState, newState + location, oldState, newState ) { this.force = force } - constructor(location: BaseLocation, oldState: IBlockState, newState: IBlockState, force: Boolean, applyPhysics: Boolean) : this( - location, oldState, newState, force + + constructor( + location: BaseLocation, + oldState: IBlockState, + newState: IBlockState, + force: Boolean, + applyPhysics: Boolean + ) : this( + location, oldState, newState, force ) { this.applyPhysics = applyPhysics } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/block/IBlock.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/block/IBlock.java index b1799033..51d9014a 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/block/IBlock.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/block/IBlock.java @@ -7,11 +7,10 @@ import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; import com.github.kevindagame.voxelsniper.world.IWorld; +import org.jetbrains.annotations.Nullable; import java.util.List; -import org.jetbrains.annotations.Nullable; - public interface IBlock { BaseLocation getLocation(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/entity/IEntity.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/entity/IEntity.java index 9d2d0e83..95863b68 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/entity/IEntity.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/entity/IEntity.java @@ -18,6 +18,7 @@ public interface IEntity { IWorld getWorld(); void addPassenger(IEntity entity); + List getPassengers(); BaseLocation getEyeLocation(); diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/entity/Painting/IPainting.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/entity/painting/IPainting.java similarity index 76% rename from VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/entity/Painting/IPainting.java rename to VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/entity/painting/IPainting.java index afc2bb21..a960985e 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/entity/Painting/IPainting.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/entity/painting/IPainting.java @@ -1,4 +1,4 @@ -package com.github.kevindagame.voxelsniper.entity.Painting; +package com.github.kevindagame.voxelsniper.entity.painting; import com.github.kevindagame.voxelsniper.entity.IEntity; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/Event.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/Event.java index 04e4b528..e493a10e 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/Event.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/Event.java @@ -2,12 +2,12 @@ /** * Abstract class for all events + * * @param The Event type this {@link HandlerList} is for */ public abstract class Event> { /** - * * @return the {@link HandlerList} for this event */ protected abstract HandlerList getHandlers(); @@ -16,7 +16,7 @@ public abstract class Event> { * Call the registered {@link EventListener}s for this event */ public final T callEvent() { - return getHandlers().callEvent((T)this); + return getHandlers().callEvent((T) this); } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/EventListener.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/EventListener.java index 6fbf486d..27c42597 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/EventListener.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/EventListener.java @@ -1,14 +1,16 @@ package com.github.kevindagame.voxelsniper.events; -import java.util.function.Consumer; - import org.jetbrains.annotations.NotNull; +import java.util.function.Consumer; + /** * Container to keep track of different settings for EventListeners + * * @param The {@link Event} type to listen for */ -public record EventListener>(EventPriority priority, Consumer handler) implements Consumer, Comparable> { +public record EventListener>(EventPriority priority, + Consumer handler) implements Consumer, Comparable> { @Override public void accept(T event) { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/HandlerList.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/HandlerList.java index 4e7d8323..14b30059 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/HandlerList.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/HandlerList.java @@ -7,38 +7,40 @@ /** * Keeps track of all the eventListeners for a specific {@link Event} + * * @param The {@link Event} type this HandlerList is for */ public class HandlerList> { - private final List> handlers = new ArrayList<>(); + private final List> handlers = new ArrayList<>(); - /** - * Registers an {@link EventListener} with a given {@link EventPriority} - * - * @param priority The {@link EventPriority} for this event - * @param handler The handler to register - */ - public void registerListener(EventPriority priority, Consumer handler) { - this.handlers.add(new EventListener<>(priority, handler)); - Collections.sort(this.handlers); - } + /** + * Registers an {@link EventListener} with a given {@link EventPriority} + * + * @param priority The {@link EventPriority} for this event + * @param handler The handler to register + */ + public void registerListener(EventPriority priority, Consumer handler) { + this.handlers.add(new EventListener<>(priority, handler)); + Collections.sort(this.handlers); + } - /** - * Registers an {@link EventListener} - * @param handler The handler to register - */ - public void registerListener(Consumer handler) { - this.registerListener(EventPriority.MEDIUM, handler); - } + /** + * Registers an {@link EventListener} + * + * @param handler The handler to register + */ + public void registerListener(Consumer handler) { + this.registerListener(EventPriority.MEDIUM, handler); + } - /** - * Call the registered {@link EventListener}s for this event - */ - public T callEvent(T ev) { - for(Consumer handler : handlers) { - handler.accept(ev); - } - return ev; - } + /** + * Call the registered {@link EventListener}s for this event + */ + public T callEvent(T ev) { + for (Consumer handler : handlers) { + handler.accept(ev); + } + return ev; + } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerBrushChangedEvent.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerBrushChangedEvent.java index 234d7c23..665a1712 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerBrushChangedEvent.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerBrushChangedEvent.java @@ -23,6 +23,14 @@ public PlayerBrushChangedEvent(IPlayer p, String toolId, IBrush oldBrush, IBrush this.toolId = toolId; } + public static void registerListener(Consumer handler) { + handlers.registerListener(handler); + } + + public static void registerListener(EventPriority priority, Consumer handler) { + handlers.registerListener(priority, handler); + } + public IBrush getOldBrush() { return oldBrush; } @@ -39,13 +47,6 @@ public String getToolId() { protected HandlerList getHandlers() { return handlers; } - public static void registerListener(Consumer handler) { - handlers.registerListener(handler); - } - - public static void registerListener(EventPriority priority, Consumer handler) { - handlers.registerListener(priority, handler); - } @Override public boolean isCancelled() { diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerBrushSizeChangedEvent.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerBrushSizeChangedEvent.java index 591666d1..ed17843e 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerBrushSizeChangedEvent.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerBrushSizeChangedEvent.java @@ -25,6 +25,14 @@ public PlayerBrushSizeChangedEvent(IPlayer p, String toolId, IBrush brush, int o this.brush = brush; } + public static void registerListener(Consumer handler) { + handlers.registerListener(handler); + } + + public static void registerListener(EventPriority priority, Consumer handler) { + handlers.registerListener(priority, handler); + } + public int getOldSize() { return oldSize; } @@ -46,14 +54,6 @@ protected HandlerList getHandlers() { return handlers; } - public static void registerListener(Consumer handler) { - handlers.registerListener(handler); - } - - public static void registerListener(EventPriority priority, Consumer handler) { - handlers.registerListener(priority, handler); - } - @Override public boolean isCancelled() { return status == EventResult.DENY; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerEvent.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerEvent.java index 333aedce..c7af973a 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerEvent.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerEvent.java @@ -4,13 +4,13 @@ import com.github.kevindagame.voxelsniper.events.Event; public abstract class PlayerEvent> extends Event { - private final IPlayer player; + private final IPlayer player; - public PlayerEvent(IPlayer p) { - this.player = p; - } + public PlayerEvent(IPlayer p) { + this.player = p; + } - public final IPlayer getPlayer() { - return player; - } + public final IPlayer getPlayer() { + return player; + } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerSnipeEvent.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerSnipeEvent.java index c844f070..0c3e891d 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerSnipeEvent.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/PlayerSnipeEvent.java @@ -70,6 +70,11 @@ public boolean isCancelled() { return status == EventResult.DENY || !hasNonCancelledOperation(); } + @Override + public void setCancelled(boolean cancel) { + status = cancel ? EventResult.DENY : EventResult.DEFAULT; + } + private boolean hasNonCancelledOperation() { for (var operation : getOperations()) { @@ -79,9 +84,4 @@ private boolean hasNonCancelledOperation() { } return false; } - - @Override - public void setCancelled(boolean cancel) { - status = cancel ? EventResult.DENY : EventResult.DEFAULT; - } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/materialChange/PlayerMaterialChangedEvent.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/materialChange/PlayerMaterialChangedEvent.java index fcd4e406..17ddcc39 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/materialChange/PlayerMaterialChangedEvent.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/materialChange/PlayerMaterialChangedEvent.java @@ -15,11 +15,6 @@ public PlayerMaterialChangedEvent(IPlayer p, IBlockData oldMaterial, IBlockData super(p, oldMaterial, newMaterial); } - @Override - protected HandlerList getHandlers() { - return handlers; - } - public static void registerListener(Consumer handler) { handlers.registerListener(handler); } @@ -27,4 +22,9 @@ public static void registerListener(Consumer handler public static void registerListener(EventPriority priority, Consumer handler) { handlers.registerListener(priority, handler); } + + @Override + protected HandlerList getHandlers() { + return handlers; + } } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/materialChange/PlayerReplaceMaterialChangedEvent.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/materialChange/PlayerReplaceMaterialChangedEvent.java index 220be074..1b67fa7a 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/materialChange/PlayerReplaceMaterialChangedEvent.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/events/player/materialChange/PlayerReplaceMaterialChangedEvent.java @@ -15,11 +15,6 @@ public PlayerReplaceMaterialChangedEvent(IPlayer p, IBlockData oldMaterial, IBlo super(p, oldMaterial, newMaterial); } - @Override - protected HandlerList getHandlers() { - return handlers; - } - public static void registerListener(Consumer handler) { handlers.registerListener(handler); } @@ -28,4 +23,9 @@ public static void registerListener(EventPriority priority, Consumer getHandlers() { + return handlers; + } + } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/fileHandler/VoxelSniperConfiguration.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/fileHandler/VoxelSniperConfiguration.java index 0b513d19..133772a0 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/fileHandler/VoxelSniperConfiguration.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/fileHandler/VoxelSniperConfiguration.java @@ -13,9 +13,9 @@ public class VoxelSniperConfiguration { public static final String CONFIG_IDENTIFIER_MESSAGE_ON_LOGIN_ENABLED = "message-on-login-enabled"; public static final int DEFAULT_UNDO_CACHE_SIZE = 20; public static final boolean DEFAULT_MESSAGE_ON_LOGIN_ENABLED = true; - private final YamlConfiguration configuration; private static final boolean DEFAULT_USE_PLOTSQUARED = false; private static final boolean DEFAULT_USE_WORLDGUARD = false; + private final YamlConfiguration configuration; /** * @param voxelSniper {@link IVoxelsniper} reference diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/location/BaseLocation.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/location/BaseLocation.java index e6915614..f381db1a 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/location/BaseLocation.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/location/BaseLocation.java @@ -85,16 +85,11 @@ public BaseLocation clone() { throw new Error(e); } } - + public VoxelLocation makeMutable() { return new VoxelLocation(world, x, y, z, yaw, pitch); } - @Deprecated - public final IBlock getClampedBlock() { - return getWorld().getBlock(getBlockX(), Math.max(Math.min(getBlockY(), getWorld().getMaxWorldHeight()), getWorld().getMinWorldHeight()), getBlockZ()); - } - public final IBlock getBlock() { return getWorld().getBlock(this); } diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/material/VoxelMaterial.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/material/VoxelMaterial.java index 0110b76b..42acd173 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/material/VoxelMaterial.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/material/VoxelMaterial.java @@ -968,6 +968,7 @@ public class VoxelMaterial implements IMaterial { private final String namespace; private final List tags; private IMaterial material = null; + public VoxelMaterial(String namespace, String key, Version version, Tags... tags) { this.namespace = namespace; this.key = key; diff --git a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/world/IWorld.java b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/world/IWorld.java index 71ad90c5..5f060357 100644 --- a/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/world/IWorld.java +++ b/VoxelSniperCore/src/main/java/com/github/kevindagame/voxelsniper/world/IWorld.java @@ -9,12 +9,11 @@ import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.treeType.VoxelTreeType; import com.github.kevindagame.voxelsniper.vector.VoxelVector; +import org.jetbrains.annotations.Nullable; import java.util.Iterator; import java.util.List; -import org.jetbrains.annotations.Nullable; - public interface IWorld { IBlock getBlock(BaseLocation location); @@ -46,11 +45,11 @@ default IChunk getChunkAtLocation(BaseLocation location) { * search bounding box. * * @param location The center of the bounding box - * @param x 1/2 the size of the box along x axis - * @param y 1/2 the size of the box along y axis - * @param z 1/2 the size of the box along z axis + * @param x 1/2 the size of the box along x axis + * @param y 1/2 the size of the box along y axis + * @param z 1/2 the size of the box along z axis * @return the collection of entities near location. This will always be a - * non-null collection. + * non-null collection. */ List getNearbyEntities(BaseLocation location, double x, double y, double z); diff --git a/VoxelSniperCore/src/test/java/com/github/kevindagame/util/BlockWrapperTest.java b/VoxelSniperCore/src/test/java/com/github/kevindagame/util/BlockWrapperTest.java index 076eb459..d15b58fd 100644 --- a/VoxelSniperCore/src/test/java/com/github/kevindagame/util/BlockWrapperTest.java +++ b/VoxelSniperCore/src/test/java/com/github/kevindagame/util/BlockWrapperTest.java @@ -1,11 +1,9 @@ package com.github.kevindagame.util; -import com.github.kevindagame.voxelsniper.IVoxelsniper; import com.github.kevindagame.voxelsniper.block.IBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; import junit.framework.TestCase; -import org.mockito.Mock; import org.mockito.Mockito; import static org.mockito.Mockito.when; diff --git a/VoxelSniperCore/src/test/java/com/github/kevindagame/voxelsniper/SniperManagerTest.java b/VoxelSniperCore/src/test/java/com/github/kevindagame/voxelsniper/SniperManagerTest.java index b9571555..b3eabbbc 100644 --- a/VoxelSniperCore/src/test/java/com/github/kevindagame/voxelsniper/SniperManagerTest.java +++ b/VoxelSniperCore/src/test/java/com/github/kevindagame/voxelsniper/SniperManagerTest.java @@ -3,7 +3,6 @@ import com.github.kevindagame.VoxelProfileManager; import com.github.kevindagame.VoxelSniper; import com.github.kevindagame.snipe.Sniper; -import com.github.kevindagame.voxelsniper.IVoxelsniper; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; import com.github.kevindagame.voxelsniper.material.IMaterial; diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotCommandHandler.java b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotCommandHandler.java index 06ec743a..2c0cab42 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotCommandHandler.java +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotCommandHandler.java @@ -7,6 +7,7 @@ import org.bukkit.command.TabExecutor; import org.bukkit.entity.Player; import org.bukkit.util.StringUtil; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -19,7 +20,7 @@ public SpigotCommandHandler(VoxelCommand command) { } @Override - public final boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + public final boolean onCommand(@NotNull CommandSender sender, Command command, @NotNull String label, @NotNull String[] args) { this.command.setActiveIdentifier(command.getLabel()); // This is the root command. this.command.setActiveAlias(label); // This is the alias that was executed. @@ -32,7 +33,7 @@ public final boolean onCommand(CommandSender sender, Command command, String lab } @Override - public final List onTabComplete(CommandSender sender, Command command, String alias, String[] args) { + public final List onTabComplete(@NotNull CommandSender sender, Command command, @NotNull String alias, @NotNull String[] args) { this.command.setActiveIdentifier(command.getLabel()); // This is the root command. this.command.setActiveAlias(alias); // This is the alias that was executed. diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotCommandManager.java b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotCommandManager.java index 15b5e227..e7ce4c3c 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotCommandManager.java +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotCommandManager.java @@ -27,9 +27,7 @@ public void registerCommand(VoxelCommand command) { SpigotCommandHandler executor = new SpigotCommandHandler(command); if (bukkitCommand != null) { bukkitCommand.setExecutor(executor); - bukkitCommand.getAliases().forEach(e -> { - argumentsMap.put(e, command.registerTabCompletion()); - }); + bukkitCommand.getAliases().forEach(e -> argumentsMap.put(e, command.registerTabCompletion())); } // Initializes command alternates that use the same executors @@ -39,9 +37,7 @@ public void registerCommand(VoxelCommand command) { if (bukkitCommandAlt != null) { bukkitCommandAlt.setExecutor(executor); - bukkitCommandAlt.getAliases().forEach(e -> { - argumentsMap.put(e, command.registerTabCompletion()); - }); + bukkitCommandAlt.getAliases().forEach(e -> argumentsMap.put(e, command.registerTabCompletion())); } }); } diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotVoxelSniper.java b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotVoxelSniper.java index 48ef3d6b..cc6d3a2f 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotVoxelSniper.java +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/SpigotVoxelSniper.java @@ -4,13 +4,13 @@ import com.github.kevindagame.VoxelProfileManager; import com.github.kevindagame.VoxelSniper; import com.github.kevindagame.util.Messages; -import com.github.kevindagame.voxelsniper.integration.bstats.BrushUsersCounter; import com.github.kevindagame.voxelsniper.entity.player.IPlayer; import com.github.kevindagame.voxelsniper.entity.player.SpigotPlayer; import com.github.kevindagame.voxelsniper.fileHandler.IFileHandler; import com.github.kevindagame.voxelsniper.fileHandler.SpigotFileHandler; import com.github.kevindagame.voxelsniper.fileHandler.VoxelSniperConfiguration; import com.github.kevindagame.voxelsniper.integration.bstats.BrushUsageCounter; +import com.github.kevindagame.voxelsniper.integration.bstats.BrushUsersCounter; import com.github.kevindagame.voxelsniper.integration.plotsquared.PlotSquaredIntegration; import com.github.kevindagame.voxelsniper.integration.worldguard.WorldGuardIntegration; import com.github.kevindagame.voxelsniper.material.IMaterial; diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/block/SpigotBlock.java b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/block/SpigotBlock.java index 1445c03f..3b02cba9 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/block/SpigotBlock.java +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/block/SpigotBlock.java @@ -1,10 +1,10 @@ package com.github.kevindagame.voxelsniper.block; import com.github.kevindagame.voxelsniper.SpigotVoxelSniper; -import com.github.kevindagame.voxelsniper.blockdata.SpigotBlockData; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; -import com.github.kevindagame.voxelsniper.blockstate.SpigotBlockState; +import com.github.kevindagame.voxelsniper.blockdata.SpigotBlockData; import com.github.kevindagame.voxelsniper.blockstate.IBlockState; +import com.github.kevindagame.voxelsniper.blockstate.SpigotBlockState; import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.material.SpigotMaterial; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/blockstate/SpigotBlockState.java b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/blockstate/SpigotBlockState.java index ddb987ac..3590b3f4 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/blockstate/SpigotBlockState.java +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/blockstate/SpigotBlockState.java @@ -1,9 +1,9 @@ package com.github.kevindagame.voxelsniper.blockstate; -import com.github.kevindagame.voxelsniper.block.SpigotBlock; import com.github.kevindagame.voxelsniper.block.IBlock; -import com.github.kevindagame.voxelsniper.blockdata.SpigotBlockData; +import com.github.kevindagame.voxelsniper.block.SpigotBlock; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; +import com.github.kevindagame.voxelsniper.blockdata.SpigotBlockData; import com.github.kevindagame.voxelsniper.blockstate.sign.SpigotSign; import com.github.kevindagame.voxelsniper.material.SpigotMaterial; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/chunk/SpigotChunk.java b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/chunk/SpigotChunk.java index 6f00c644..dad7c06d 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/chunk/SpigotChunk.java +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/chunk/SpigotChunk.java @@ -1,10 +1,9 @@ package com.github.kevindagame.voxelsniper.chunk; import com.github.kevindagame.voxelsniper.SpigotVoxelSniper; -import com.github.kevindagame.voxelsniper.entity.SpigotEntity; import com.github.kevindagame.voxelsniper.entity.IEntity; +import com.github.kevindagame.voxelsniper.entity.SpigotEntity; import com.github.kevindagame.voxelsniper.world.IWorld; - import org.bukkit.Chunk; import java.util.Arrays; diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/entity/SpigotEntity.java b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/entity/SpigotEntity.java index 4ff151a7..50423f4b 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/entity/SpigotEntity.java +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/entity/SpigotEntity.java @@ -1,8 +1,8 @@ package com.github.kevindagame.voxelsniper.entity; import com.github.kevindagame.voxelsniper.SpigotVoxelSniper; -import com.github.kevindagame.voxelsniper.entity.Painting.SpigotPainting; import com.github.kevindagame.voxelsniper.entity.entitytype.VoxelEntityType; +import com.github.kevindagame.voxelsniper.entity.painting.SpigotPainting; import com.github.kevindagame.voxelsniper.location.BaseLocation; import com.github.kevindagame.voxelsniper.world.IWorld; import org.bukkit.Location; @@ -70,7 +70,7 @@ public List getPassengers() { @Override public boolean teleport(IEntity other) { - return this.entity.teleport(((SpigotEntity)other).getEntity()); + return this.entity.teleport(((SpigotEntity) other).getEntity()); } @Override diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/entity/Painting/SpigotPainting.java b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/entity/painting/SpigotPainting.java similarity index 92% rename from VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/entity/Painting/SpigotPainting.java rename to VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/entity/painting/SpigotPainting.java index 3e04601c..93da453f 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/entity/Painting/SpigotPainting.java +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/entity/painting/SpigotPainting.java @@ -1,4 +1,4 @@ -package com.github.kevindagame.voxelsniper.entity.Painting; +package com.github.kevindagame.voxelsniper.entity.painting; import com.github.kevindagame.voxelsniper.entity.SpigotEntity; import org.bukkit.Art; diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/entity/player/SpigotPlayer.java b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/entity/player/SpigotPlayer.java index db1dc58f..f04d5623 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/entity/player/SpigotPlayer.java +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/entity/player/SpigotPlayer.java @@ -1,13 +1,13 @@ package com.github.kevindagame.voxelsniper.entity.player; import com.github.kevindagame.voxelsniper.SpigotVoxelSniper; -import com.github.kevindagame.voxelsniper.block.SpigotBlock; import com.github.kevindagame.voxelsniper.block.IBlock; -import com.github.kevindagame.voxelsniper.entity.SpigotEntity; +import com.github.kevindagame.voxelsniper.block.SpigotBlock; import com.github.kevindagame.voxelsniper.entity.IEntity; +import com.github.kevindagame.voxelsniper.entity.SpigotEntity; import com.github.kevindagame.voxelsniper.entity.entitytype.VoxelEntityType; -import com.github.kevindagame.voxelsniper.location.SpigotLocation; import com.github.kevindagame.voxelsniper.location.BaseLocation; +import com.github.kevindagame.voxelsniper.location.SpigotLocation; import com.github.kevindagame.voxelsniper.material.SpigotMaterial; import com.github.kevindagame.voxelsniper.material.VoxelMaterial; import com.github.kevindagame.voxelsniper.vector.VoxelVector; diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/integration/bstats/BrushUsageCounter.java b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/integration/bstats/BrushUsageCounter.java index b58a2160..d48736f8 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/integration/bstats/BrushUsageCounter.java +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/integration/bstats/BrushUsageCounter.java @@ -3,29 +3,20 @@ import com.github.kevindagame.voxelsniper.events.player.PlayerSnipeEvent; public class BrushUsageCounter { -// private static final Map perBrushCounter = new HashMap<>(); private static int counter = 0; + public static int getTotalBrushUses() { + var val = counter; + counter = 0; + return val; + } + public void registerListeners() { PlayerSnipeEvent.registerListener(this::onBrushUse); } private void onBrushUse(PlayerSnipeEvent event) { - if(event.isCancelled()) return; -// String brushName = event.getBrush().getName(); -// perBrushCounter.put(brushName, perBrushCounter.getOrDefault(brushName, 0) + 1); + if (event.isCancelled()) return; counter++; } - - public static int getTotalBrushUses() { - var val = counter; - counter = 0; - return val; - } - -// public static Map getUsagePerBrush() { -// var map = new HashMap<>(perBrushCounter); -// perBrushCounter.clear(); -// return map; -// } } diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/integration/bstats/BrushUsersCounter.kt b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/integration/bstats/BrushUsersCounter.kt index e98cb678..764373aa 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/integration/bstats/BrushUsersCounter.kt +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/integration/bstats/BrushUsersCounter.kt @@ -5,7 +5,7 @@ import java.util.* class BrushUsersCounter { fun registerListeners() { - PlayerSnipeEvent.registerListener(this::onBrushUse ) + PlayerSnipeEvent.registerListener(this::onBrushUse) } private fun onBrushUse(event: PlayerSnipeEvent) { @@ -16,9 +16,9 @@ class BrushUsersCounter { companion object { private val users: MutableSet = HashSet() fun getTotalBrushUses(): Int { - val brushUsers = users.size - users.clear() - return brushUsers - } + val brushUsers = users.size + users.clear() + return brushUsers + } } } \ No newline at end of file diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/integration/plotsquared/PlotSquaredIntegration.kt b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/integration/plotsquared/PlotSquaredIntegration.kt index 37671ad2..f9ff90de 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/integration/plotsquared/PlotSquaredIntegration.kt +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/integration/plotsquared/PlotSquaredIntegration.kt @@ -34,7 +34,7 @@ class PlotSquaredIntegration { DBFunc.EVERYONE ) ) { - continue; + continue } } operation.isCancelled = true diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/material/SpigotMaterial.java b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/material/SpigotMaterial.java index b6df38b3..0a92e738 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/material/SpigotMaterial.java +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/material/SpigotMaterial.java @@ -1,7 +1,7 @@ package com.github.kevindagame.voxelsniper.material; -import com.github.kevindagame.voxelsniper.blockdata.SpigotBlockData; import com.github.kevindagame.voxelsniper.blockdata.IBlockData; +import com.github.kevindagame.voxelsniper.blockdata.SpigotBlockData; import org.bukkit.Material; public record SpigotMaterial(Material material) implements IMaterial { diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/world/SpigotBlockLogger.java b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/world/SpigotBlockLogger.java index 7abeff90..3327b2e4 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/world/SpigotBlockLogger.java +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/world/SpigotBlockLogger.java @@ -6,26 +6,25 @@ import com.github.kevindagame.voxelsniper.blockdata.SpigotBlockData; import com.github.kevindagame.voxelsniper.blockstate.SpigotBlockState; import com.github.kevindagame.voxelsniper.location.BaseLocation; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Predicate; - import org.bukkit.BlockChangeDelegate; import org.bukkit.World; import org.bukkit.block.BlockState; import org.bukkit.block.data.BlockData; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Predicate; + /** * */ public class SpigotBlockLogger implements BlockChangeDelegate, Predicate { - private final IWorld world; - private final World targetWorld; final List operations = new ArrayList<>(); final boolean updateBlocks; + private final IWorld world; + private final World targetWorld; public SpigotBlockLogger(SpigotWorld targetWorld, boolean updateBlocks) { this.world = targetWorld; diff --git a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/world/SpigotWorld.java b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/world/SpigotWorld.java index f478f3ae..1bffd95b 100644 --- a/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/world/SpigotWorld.java +++ b/VoxelSniperSpigot/src/main/java/com/github/kevindagame/voxelsniper/world/SpigotWorld.java @@ -2,18 +2,17 @@ import com.github.kevindagame.util.brushOperation.BrushOperation; import com.github.kevindagame.voxelsniper.biome.VoxelBiome; -import com.github.kevindagame.voxelsniper.block.SpigotBlock; import com.github.kevindagame.voxelsniper.block.IBlock; -import com.github.kevindagame.voxelsniper.chunk.SpigotChunk; +import com.github.kevindagame.voxelsniper.block.SpigotBlock; import com.github.kevindagame.voxelsniper.chunk.IChunk; -import com.github.kevindagame.voxelsniper.entity.SpigotEntity; +import com.github.kevindagame.voxelsniper.chunk.SpigotChunk; import com.github.kevindagame.voxelsniper.entity.IEntity; +import com.github.kevindagame.voxelsniper.entity.SpigotEntity; import com.github.kevindagame.voxelsniper.entity.entitytype.VoxelEntityType; -import com.github.kevindagame.voxelsniper.location.SpigotLocation; import com.github.kevindagame.voxelsniper.location.BaseLocation; +import com.github.kevindagame.voxelsniper.location.SpigotLocation; import com.github.kevindagame.voxelsniper.treeType.VoxelTreeType; import com.github.kevindagame.voxelsniper.vector.VoxelVector; - import org.bukkit.TreeType; import org.bukkit.World; import org.bukkit.block.Biome; @@ -84,6 +83,7 @@ public void spawn(BaseLocation location, VoxelEntityType entity) { public void setBiome(int x, int z, VoxelBiome selectedBiome) { world.setBiome(x, z, Biome.valueOf(selectedBiome.key().toUpperCase())); } + @Override public void setBiome(int x, int y, int z, VoxelBiome selectedBiome) { world.setBiome(x, y, z, Biome.valueOf(selectedBiome.key().toUpperCase())); diff --git a/VoxelSniperSpigot/src/main/resources/plugin.yml b/VoxelSniperSpigot/src/main/resources/plugin.yml index abbda9e7..2267b4aa 100644 --- a/VoxelSniperSpigot/src/main/resources/plugin.yml +++ b/VoxelSniperSpigot/src/main/resources/plugin.yml @@ -3,34 +3,34 @@ main: com.github.kevindagame.voxelsniper.SpigotVoxelSniper version: ${version} api-version: 1.15 website: https://github.com/KevinDaGame/VoxelSniper-Reimagined -authors: [przerwap, MikeMatrix, Gavjenks, giltwist, psanker, Deamon5550, DivineRage, KevDaDev, Lennart99] +authors: [ przerwap, MikeMatrix, Gavjenks, giltwist, psanker, Deamon5550, DivineRage, KevDaDev, Lennart99 ] description: The premier long-distance brush editor for Minecraft, reimagined! -softdepend: [WorldGuard, PlotSquared] +softdepend: [ WorldGuard, PlotSquared ] commands: u: description: Undo changes made by yourself or other players. permission: voxelsniper.sniper - aliases: [undo] + aliases: [ undo ] usage: Invalid syntax. Use / help to see valid syntax. uu: description: Undo changes made by other players. permission: voxelsniper.sniper - aliases: [undouser] + aliases: [ undouser ] usage: Invalid syntax. Use / help to see valid syntax. d: description: Reverts all values back to defaults. permission: voxelsniper.sniper - alias: [default] + alias: [ default ] usage: Invalid syntax. Use / help to see valid syntax. p: description: Change the currently active performer for the performer brush. permission: voxelsniper.sniper - aliases: [perf, performer] + aliases: [ perf, performer ] usage: Invalid syntax. Use / help to see valid syntax. sniper: description: View and change settings related to VoxelSniper. permission: voxelsniper.sniper - aliases: [voxelsniper, vs] + aliases: [ voxelsniper, vs ] usage: Invalid syntax. Use / help to see valid syntax. vi: description: Changes the data value of the currently active voxel material. @@ -59,12 +59,12 @@ commands: vox: description: Multi-purpose command to perform various utility functions. permission: voxelsniper.sniper - aliases: [painting, vchunk, goto] + aliases: [ painting, vchunk, goto ] usage: Invalid syntax. Use / help to see valid syntax. vv: description: Changes various variables related to voxel brushes. permission: voxelsniper.sniper - aliases: [vl, vc, vh, vvariables, vvar, variables] + aliases: [ vl, vc, vh, vvariables, vvar, variables ] usage: Invalid syntax. Use / help to see valid syntax. permissions: voxelsniper.*: diff --git a/VoxelSniperSpigot/src/test/java/com/github/kevindagame/voxelsniper/biome/material/VoxelMaterialTest.java b/VoxelSniperSpigot/src/test/java/com/github/kevindagame/voxelsniper/biome/material/VoxelMaterialTest.java deleted file mode 100644 index 866cccbf..00000000 --- a/VoxelSniperSpigot/src/test/java/com/github/kevindagame/voxelsniper/biome/material/VoxelMaterialTest.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.github.kevindagame.voxelsniper.biome.material; - -import junit.framework.TestCase; - -public class VoxelMaterialTest extends TestCase { - - public void testGetMaterial() { - } - - public void testTestGetMaterial() { - } -} \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index eaa6c67e..5590892f 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -12,14 +12,14 @@ dependencies { } tasks { - compileJava { - options.encoding = Charsets.UTF_8.name() - options.release.set(17) - } + compileJava { + options.encoding = Charsets.UTF_8.name() + options.release.set(17) + } - compileKotlin { - kotlinOptions { - jvmTarget = "17" + compileKotlin { + kotlinOptions { + jvmTarget = "17" + } } - } } diff --git a/buildSrc/src/main/kotlin/voxel-core.gradle.kts b/buildSrc/src/main/kotlin/voxel-core.gradle.kts index 8a0faf7f..9dd43aed 100644 --- a/buildSrc/src/main/kotlin/voxel-core.gradle.kts +++ b/buildSrc/src/main/kotlin/voxel-core.gradle.kts @@ -51,7 +51,7 @@ group = "com.github.kevindagame" version = "8.4.0" //java.sourceCompatibility = JavaVersion.VERSION_16 -tasks.withType() { +tasks.withType { options.encoding = "UTF-8" } val compileKotlin: KotlinCompile by tasks