Merge remote-tracking branch 'origin/breaking' into breaking

# Conflicts:
#	Core/src/main/java/com/github/intellectualsites/plotsquared/plot/listener/WEExtent.java
This commit is contained in:
matt 2019-02-21 21:18:03 -05:00
commit a9bebb10da
8 changed files with 32 additions and 28 deletions

View File

@ -154,7 +154,8 @@ public class NbtFactory {
* @return The decoded NBT compound. * @return The decoded NBT compound.
* @throws IOException If anything went wrong. * @throws IOException If anything went wrong.
*/ */
@SuppressWarnings({"IOResourceOpenedButNotSafelyClosed", "resource"}) public static NbtCompound fromStream(InputStream input, StreamOptions option) @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed", "resource"})
public static NbtCompound fromStream(InputStream input, StreamOptions option)
throws IOException { throws IOException {
DataInputStream data = null; DataInputStream data = null;
boolean suppress = true; boolean suppress = true;
@ -527,7 +528,9 @@ public class NbtFactory {
* *
* @author Kristian * @author Kristian
*/ */
public enum StreamOptions {NO_COMPRESSION, GZIP_COMPRESSION,} public enum StreamOptions {
NO_COMPRESSION, GZIP_COMPRESSION,
}
private enum NbtType { private enum NbtType {

View File

@ -2,8 +2,6 @@ package com.github.intellectualsites.plotsquared.commands;
import com.github.intellectualsites.plotsquared.plot.object.PlotId; import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import java.util.stream.Stream;
public abstract class Argument<T> { public abstract class Argument<T> {
public static final Argument<Integer> Integer = new Argument<Integer>("int", 16) { public static final Argument<Integer> Integer = new Argument<Integer>("int", 16) {
@ -19,9 +17,11 @@ public abstract class Argument<T> {
public static final Argument<Boolean> Boolean = new Argument<Boolean>("boolean", true) { public static final Argument<Boolean> Boolean = new Argument<Boolean>("boolean", true) {
@Override public Boolean parse(String in) { @Override public Boolean parse(String in) {
Boolean value = null; Boolean value = null;
if (Stream.of("true", "Yes", "1").anyMatch(in::equalsIgnoreCase)) { if (in.equalsIgnoreCase("true") || in.equalsIgnoreCase("Yes") || in
.equalsIgnoreCase("1")) {
value = true; value = true;
} else if (Stream.of("false", "No", "0").anyMatch(in::equalsIgnoreCase)) { } else if (in.equalsIgnoreCase("false") || in.equalsIgnoreCase("No") || in
.equalsIgnoreCase("0")) {
value = false; value = false;
} }
return value; return value;

View File

@ -9,7 +9,6 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Stream;
@CommandDeclaration(command = "setowner", permission = "plots.set.owner", @CommandDeclaration(command = "setowner", permission = "plots.set.owner",
description = "Set the plot owner", usage = "/plot setowner <player>", description = "Set the plot owner", usage = "/plot setowner <player>",
@ -32,7 +31,8 @@ import java.util.stream.Stream;
name = name == null ? value : name; name = name == null ? value : name;
} }
if (uuid == null || value.equalsIgnoreCase("-")) { if (uuid == null || value.equalsIgnoreCase("-")) {
if (Stream.of("none", "null", "-").anyMatch(value::equalsIgnoreCase)) { if (value.equalsIgnoreCase("none") || value.equalsIgnoreCase("null") || value
.equalsIgnoreCase("-")) {
if (!Permissions if (!Permissions
.hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SETOWNER.s(), true)) { .hasPermission(player, C.PERMISSION_ADMIN_COMMAND_SETOWNER.s(), true)) {
return false; return false;

View File

@ -42,22 +42,22 @@ public class WEExtent extends AbstractDelegateExtent {
return null; return null;
} }
@Override public BlockState getBlock(BlockVector3 position) {
if (WEManager.maskContains(this.mask, position.getX(), position.getY(), position.getZ())) {
return super.getBlock(position);
}
return AIRSTATE;
}
@Override public BaseBlock getFullBlock(BlockVector3 position) {
if (WEManager.maskContains(this.mask, position.getX(), position.getY(), position.getZ())) {
return super.getFullBlock(position);
}
return AIRBASE;
}
@Override public boolean setBiome(BlockVector2 position, BiomeType biome) { @Override public boolean setBiome(BlockVector2 position, BiomeType biome) {
return WEManager.maskContains(this.mask, position.getX(), position.getZ()) && super return WEManager.maskContains(this.mask, position.getX(), position.getZ()) && super
.setBiome(position, biome); .setBiome(position, biome);
} }
@Override public BlockState getBlock(BlockVector3 location) {
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
return super.getBlock(location);
}
return AIRSTATE;
}
@Override public BaseBlock getFullBlock(BlockVector3 location) {
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
return super.getFullBlock(location);
}
return AIRBASE;
}
} }

View File

@ -3,8 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.object;
public enum Direction { public enum Direction {
NORTH(0, "north"), EAST(1, "east"), SOUTH(2, "south"), WEST(3, "west"), NORTHEAST(4, NORTH(0, "north"), EAST(1, "east"), SOUTH(2, "south"), WEST(3, "west"), NORTHEAST(4,
"northeast"), SOUTHEAST(5, "southeast"), SOUTHWEST(6, "southwest"), NORTHWEST(7, "northeast"), SOUTHEAST(5, "southeast"), SOUTHWEST(6, "southwest"), NORTHWEST(7,
"northwest"), "northwest"),;
;
private int index; private int index;

View File

@ -33,7 +33,6 @@ import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream;
/** /**
* The plot class<br> * The plot class<br>
@ -516,7 +515,8 @@ public class Plot {
* @return true if this plot is merged, otherwise false * @return true if this plot is merged, otherwise false
*/ */
public boolean isMerged() { public boolean isMerged() {
return IntStream.of(0, 2, 1, 3).anyMatch(i -> getSettings().getMerged(i)); return getSettings().getMerged(0) || getSettings().getMerged(2) || getSettings()
.getMerged(1) || getSettings().getMerged(3);
} }
/** /**

View File

@ -5,7 +5,9 @@ import java.util.Arrays;
public class ArrayUtil { public class ArrayUtil {
public static final <T> T[] concatAll(T[] first, T[]... rest) { public static final <T> T[] concatAll(T[] first, T[]... rest) {
int totalLength = first.length; int totalLength = first.length;
totalLength += Arrays.stream(rest).mapToInt(array -> array.length).sum(); for (T[] array : rest) {
totalLength += array.length;
}
T[] result = Arrays.copyOf(first, totalLength); T[] result = Arrays.copyOf(first, totalLength);
int offset = first.length; int offset = first.length;
for (T[] array : rest) { for (T[] array : rest) {

View File

@ -32,7 +32,7 @@ ext {
date = git.head().getDate().format("yy.MM.dd") date = git.head().getDate().format("yy.MM.dd")
revision = "-${git.head().abbreviatedId}" revision = "-${git.head().abbreviatedId}"
parents = git.head().parentIds; parents = git.head().parentIds;
index = -2044; // Offset to match CI index = -2042; // Offset to match CI
for (; parents != null && !parents.isEmpty(); index++) { for (; parents != null && !parents.isEmpty(); index++) {
parents = git.getResolve().toCommit(parents.get(0)).getParentIds() parents = git.getResolve().toCommit(parents.get(0)).getParentIds()
} }