diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java index 72c570df5..a039f7206 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/block/GenChunk.java @@ -22,6 +22,7 @@ import org.bukkit.generator.ChunkGenerator.BiomeGrid; import org.bukkit.generator.ChunkGenerator.ChunkData; import java.util.Arrays; +import org.jetbrains.annotations.NotNull; public class GenChunk extends ScopedLocalBlockQueue { @@ -107,7 +108,7 @@ public class GenChunk extends ScopedLocalBlockQueue { return false; } - @Override public boolean setBlock(int x, int y, int z, Pattern pattern) { + @Override public boolean setBlock(int x, int y, int z, @NotNull Pattern pattern) { return setBlock(x, y, z, PatternUtil.apply(pattern, x, y, z)); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java index c1970f969..ce9a6d3a5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Debug.java @@ -14,12 +14,14 @@ import java.util.Map; public class Debug extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { - if ((args.length > 0) && "player".equalsIgnoreCase(args[1])) { - for (Map.Entry meta : player.getMeta().entrySet()) { - MainUtil.sendMessage(player, - "Key: " + meta.getKey() + " Value: " + meta.getValue().toString() + " , "); + if (args.length > 0) { + if ("player".equalsIgnoreCase(args[0])) { + for (Map.Entry meta : player.getMeta().entrySet()) { + MainUtil.sendMessage(player, + "Key: " + meta.getKey() + " Value: " + meta.getValue().toString() + " , "); + } + ; } - ; } if ((args.length > 0) && args[0].equalsIgnoreCase("msg")) { StringBuilder msg = new StringBuilder(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java index 447ef0142..138ac2d6c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/BlockBucket.java @@ -108,6 +108,7 @@ public final class BlockBucket implements ConfigurationSerializable { if (matcher.find()) { String chanceStr = matcher.group("chance"); String block = matcher.group("block"); + //noinspection PointlessNullCheck if (chanceStr != null && block != null && !MathMan.isInteger(block) && MathMan.isInteger(chanceStr)) { String namespace = matcher.group("namespace"); string = (namespace == null ? "" : namespace + ":") + block; @@ -123,6 +124,7 @@ public final class BlockBucket implements ConfigurationSerializable { Matcher matcher = regex.matcher(entry); if (matcher.find()) { String chanceStr = matcher.group("chance"); + //noinspection PointlessNullCheck if (chanceStr != null && MathMan.isInteger(chanceStr)) { String[] parts = entry.split(":"); parts = Arrays.copyOf(parts, parts.length - 1); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java index 72b6252a3..1c166850c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/BasicLocalBlockQueue.java @@ -88,7 +88,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue { this.modified = modified; } - @Override public boolean setBlock(int x, int y, int z, Pattern pattern) { + @Override public boolean setBlock(int x, int y, int z, @NotNull Pattern pattern) { return setBlock(x, y, z, PatternUtil.apply(pattern, x, y, z)); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/LocalBlockQueue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/LocalBlockQueue.java index 4778a1cae..5474067b2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/LocalBlockQueue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/block/LocalBlockQueue.java @@ -15,6 +15,7 @@ import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import java.util.Map; +import org.jetbrains.annotations.NotNull; public abstract class LocalBlockQueue { @@ -59,7 +60,7 @@ public abstract class LocalBlockQueue { public abstract boolean setBlock(final int x, final int y, final int z, final BaseBlock id); - public boolean setBlock(final int x, final int y, final int z, final Pattern pattern) { + public boolean setBlock(final int x, final int y, final int z, @NotNull final Pattern pattern) { return setBlock(x, y, z, PatternUtil.apply(pattern, x, y, z)); } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/PatternUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/PatternUtil.java index 4d3107eb0..d281cc4d8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/PatternUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/world/PatternUtil.java @@ -15,9 +15,10 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; +import org.jetbrains.annotations.NotNull; public class PatternUtil { - public static BaseBlock apply(Pattern pattern, int x, int y, int z) { + public static BaseBlock apply(@NotNull Pattern pattern, int x, int y, int z) { if (pattern instanceof BlockPattern || pattern instanceof RandomPattern || pattern instanceof BlockState @@ -44,9 +45,7 @@ public class PatternUtil { context.setPreferringWildcard(false); context.setTryLegacy(true); try { - Pattern pattern = - WorldEdit.getInstance().getPatternFactory().parseFromInput(input, context); - return pattern; + return WorldEdit.getInstance().getPatternFactory().parseFromInput(input, context); } catch (InputParseException e) { throw new Command.CommandException(Captions.NOT_VALID_BLOCK, e.getMessage()); }