mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Cleanup deprecated methods (#3980)
This commit is contained in:
parent
d455d1fcd7
commit
9cd0ee9b49
@ -185,41 +185,6 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
|||||||
world.setWaterAnimalSpawnLimit(limit);
|
world.setWaterAnimalSpawnLimit(limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The entire method is deprecated, but kept for compatibility with versions lower than or equal to 1.16.2.
|
|
||||||
* The method will be removed in future versions, because WorldEdit and FastAsyncWorldEdit only support the latest point
|
|
||||||
* release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.0")
|
|
||||||
@Override
|
|
||||||
public void generateNoise(
|
|
||||||
@NotNull final WorldInfo worldInfo,
|
|
||||||
@NotNull final Random random,
|
|
||||||
final int chunkX,
|
|
||||||
final int chunkZ,
|
|
||||||
@NotNull final ChunkData chunkData
|
|
||||||
) {
|
|
||||||
if (this.platformGenerator != this) {
|
|
||||||
this.platformGenerator.generateNoise(worldInfo, random, chunkX, chunkZ, chunkData);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int minY = chunkData.getMinHeight();
|
|
||||||
int maxY = chunkData.getMaxHeight();
|
|
||||||
GenChunk result = new GenChunk(minY, maxY);
|
|
||||||
// Set the chunk location
|
|
||||||
result.setChunk(new ChunkWrapper(worldInfo.getName(), chunkX, chunkZ));
|
|
||||||
// Set the result data
|
|
||||||
result.setChunkData(chunkData);
|
|
||||||
result.result = null;
|
|
||||||
|
|
||||||
// Catch any exceptions (as exceptions usually thrown)
|
|
||||||
try {
|
|
||||||
generate(BlockVector2.at(chunkX, chunkZ), worldInfo.getName(), result, false);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
LOGGER.error("Error attempting to generate chunk.", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateSurface(
|
public void generateSurface(
|
||||||
@NotNull final WorldInfo worldInfo,
|
@NotNull final WorldInfo worldInfo,
|
||||||
|
@ -42,34 +42,6 @@ public class Config {
|
|||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + Config.class.getSimpleName());
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + Config.class.getSimpleName());
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the value for a node<br>
|
|
||||||
* Probably throws some error if you try to get a non existent key
|
|
||||||
*
|
|
||||||
* @param key configuration key
|
|
||||||
* @param root configuration class
|
|
||||||
* @param <T> value type
|
|
||||||
* @return value
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static <T> T get(String key, Class<?> root) {
|
|
||||||
String[] split = key.split("\\.");
|
|
||||||
Object instance = getInstance(split, root);
|
|
||||||
if (instance != null) {
|
|
||||||
Field field = getField(split, instance);
|
|
||||||
if (field != null) {
|
|
||||||
try {
|
|
||||||
return (T) field.get(instance);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of a specific node<br>
|
* Set the value of a specific node<br>
|
||||||
* Probably throws some error if you supply non existing keys or invalid values
|
* Probably throws some error if you supply non existing keys or invalid values
|
||||||
@ -261,7 +233,6 @@ public class Config {
|
|||||||
*
|
*
|
||||||
* @param split the node (split by period)
|
* @param split the node (split by period)
|
||||||
* @param instance the instance
|
* @param instance the instance
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
private static Field getField(String[] split, Object instance) {
|
private static Field getField(String[] split, Object instance) {
|
||||||
try {
|
try {
|
||||||
@ -447,14 +418,6 @@ public class Config {
|
|||||||
return INSTANCES.values();
|
return INSTANCES.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public Collection<String> getSections() {
|
|
||||||
return INSTANCES.keySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, T> getRaw() {
|
private Map<String, T> getRaw() {
|
||||||
return INSTANCES;
|
return INSTANCES;
|
||||||
}
|
}
|
||||||
|
@ -544,14 +544,6 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
return schem1PopulationNeeded || schem2PopulationNeeded || schem3PopulationNeeded;
|
return schem1PopulationNeeded || schem2PopulationNeeded || schem3PopulationNeeded;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated in favour of {@link HybridPlotWorld#getSchematicRoot()}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.9.0")
|
|
||||||
public File getRoot() {
|
|
||||||
return this.root;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the root folder for this world's generation schematics. May be null if schematics not initialised via
|
* Get the root folder for this world's generation schematics. May be null if schematics not initialised via
|
||||||
* {@link HybridPlotWorld#setupSchematics()}
|
* {@link HybridPlotWorld#setupSchematics()}
|
||||||
|
@ -63,7 +63,6 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -380,26 +379,6 @@ public class HybridUtils {
|
|||||||
run.run();
|
run.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally and poor implementation. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public int checkModified(QueueCoordinator queue, int x1, int x2, int y1, int y2, int z1, int z2, BlockState[] blocks) {
|
|
||||||
int count = 0;
|
|
||||||
for (int y = y1; y <= y2; y++) {
|
|
||||||
for (int x = x1; x <= x2; x++) {
|
|
||||||
for (int z = z1; z <= z2; z++) {
|
|
||||||
BlockState block = queue.getBlock(x, y, z);
|
|
||||||
boolean same = Arrays.stream(blocks).anyMatch(p -> this.worldUtil.isBlockSame(block, p));
|
|
||||||
if (!same) {
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final ArrayList<BlockVector2> getChunks(BlockVector2 region) {
|
public final ArrayList<BlockVector2> getChunks(BlockVector2 region) {
|
||||||
ArrayList<BlockVector2> chunks = new ArrayList<>();
|
ArrayList<BlockVector2> chunks = new ArrayList<>();
|
||||||
int sx = region.getX() << 5;
|
int sx = region.getX() << 5;
|
||||||
|
@ -79,18 +79,6 @@ public class PlotSettings {
|
|||||||
this.ratings = ratings;
|
this.ratings = ratings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release. Use {@link PlotSettings#setMerged(Direction, boolean)}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public boolean setMerged(int direction, boolean merged) {
|
|
||||||
if (this.merged[direction] != merged) {
|
|
||||||
this.merged[direction] = merged;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean setMerged(Direction direction, boolean merged) {
|
public boolean setMerged(Direction direction, boolean merged) {
|
||||||
if (Direction.ALL == direction) {
|
if (Direction.ALL == direction) {
|
||||||
throw new IllegalArgumentException("You cannot use Direction.ALL in this method!");
|
throw new IllegalArgumentException("You cannot use Direction.ALL in this method!");
|
||||||
|
@ -31,8 +31,6 @@ import com.sk89q.worldedit.world.registry.LegacyMapper;
|
|||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link BlockState} related utility methods
|
* {@link BlockState} related utility methods
|
||||||
*/
|
*/
|
||||||
@ -109,38 +107,4 @@ public final class BlockUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse a comma delimited list of block states
|
|
||||||
*
|
|
||||||
* @param commaDelimited List of block states
|
|
||||||
* @return Parsed block states
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static @NonNull BlockState[] parse(final @NonNull String commaDelimited) {
|
|
||||||
final String[] split = commaDelimited.split(",(?![^\\(\\[]*[\\]\\)])");
|
|
||||||
final BlockState[] result = new BlockState[split.length];
|
|
||||||
for (int i = 0; i < split.length; i++) {
|
|
||||||
result[i] = get(split[i]);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deserialize a serialized {@link BlockState}
|
|
||||||
*
|
|
||||||
* @param map Serialized block state
|
|
||||||
* @return Deserialized block state, or {@code null} if the map is
|
|
||||||
* not a properly serialized block state
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static @Nullable BlockState deserialize(final @NonNull Map<String, Object> map) {
|
|
||||||
if (map.containsKey("material")) {
|
|
||||||
final Object object = map.get("material");
|
|
||||||
return get(object.toString());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.core.util;
|
package com.plotsquared.core.util;
|
||||||
|
|
||||||
import com.plotsquared.core.location.Location;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This cache is used for world generation and just saves a bit of calculation time when checking if something is in the plot area.
|
* This cache is used for world generation and just saves a bit of calculation time when checking if something is in the plot area.
|
||||||
*/
|
*/
|
||||||
@ -107,24 +103,4 @@ public class ChunkUtil {
|
|||||||
return z_loc[j];
|
return z_loc[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the region pos1-pos2 contains the chunk
|
|
||||||
*
|
|
||||||
* @param pos1 Region minimum point
|
|
||||||
* @param pos2 Region maximum point
|
|
||||||
* @param chunk BlockVector2 of chunk coordinates
|
|
||||||
* @return {@code true} if the region pos1-pos2 contains the chunk
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static boolean isWholeChunk(@NonNull Location pos1, @NonNull Location pos2, @NonNull BlockVector2 chunk) {
|
|
||||||
int x1 = pos1.getX();
|
|
||||||
int z1 = pos1.getZ();
|
|
||||||
int x2 = pos2.getX();
|
|
||||||
int z2 = pos2.getZ();
|
|
||||||
int cx = chunk.getX() << 4;
|
|
||||||
int cz = chunk.getZ() << 4;
|
|
||||||
return cx > x1 && cz > z1 && cx < x2 && cz < z2;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -70,135 +70,6 @@ public class MathMan {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static long pairInt(int x, int y) {
|
|
||||||
return (((long) x) << 32) | (y & 0xffffffffL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static int unpairIntX(long pair) {
|
|
||||||
return (int) (pair >> 32);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static int unpairIntY(long pair) {
|
|
||||||
return (int) pair;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static byte pair16(byte x, byte y) {
|
|
||||||
return (byte) (x + (y << 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static byte unpair16x(byte value) {
|
|
||||||
return (byte) (value & 0xF);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static byte unpair16y(byte value) {
|
|
||||||
return (byte) ((value >> 4) & 0xF);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static long inverseRound(double val) {
|
|
||||||
long round = Math.round(val);
|
|
||||||
return (long) (round + Math.signum(val - round));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static int sqrt(int x) {
|
|
||||||
int xn;
|
|
||||||
|
|
||||||
if (x >= 0x10000) {
|
|
||||||
if (x >= 0x1000000) {
|
|
||||||
if (x >= 0x10000000) {
|
|
||||||
if (x >= 0x40000000) {
|
|
||||||
xn = table[x >> 24] << 8;
|
|
||||||
} else {
|
|
||||||
xn = table[x >> 22] << 7;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (x >= 0x4000000) {
|
|
||||||
xn = table[x >> 20] << 6;
|
|
||||||
} else {
|
|
||||||
xn = table[x >> 18] << 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
xn = (xn + 1 + (x / xn)) >> 1;
|
|
||||||
xn = (xn + 1 + (x / xn)) >> 1;
|
|
||||||
return ((xn * xn) > x) ? --xn : xn;
|
|
||||||
} else {
|
|
||||||
if (x >= 0x100000) {
|
|
||||||
if (x >= 0x400000) {
|
|
||||||
xn = table[x >> 16] << 4;
|
|
||||||
} else {
|
|
||||||
xn = table[x >> 14] << 3;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (x >= 0x40000) {
|
|
||||||
xn = table[x >> 12] << 2;
|
|
||||||
} else {
|
|
||||||
xn = table[x >> 10] << 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
xn = (xn + 1 + (x / xn)) >> 1;
|
|
||||||
|
|
||||||
return ((xn * xn) > x) ? --xn : xn;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (x >= 0x100) {
|
|
||||||
if (x >= 0x1000) {
|
|
||||||
if (x >= 0x4000) {
|
|
||||||
xn = (table[x >> 8]) + 1;
|
|
||||||
} else {
|
|
||||||
xn = (table[x >> 6] >> 1) + 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (x >= 0x400) {
|
|
||||||
xn = (table[x >> 4] >> 2) + 1;
|
|
||||||
} else {
|
|
||||||
xn = (table[x >> 2] >> 3) + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ((xn * xn) > x) ? --xn : xn;
|
|
||||||
} else {
|
|
||||||
if (x >= 0) {
|
|
||||||
return table[x] >> 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new IllegalArgumentException("Invalid number:" + x);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static double getMean(int[] array) {
|
public static double getMean(int[] array) {
|
||||||
double count = 0;
|
double count = 0;
|
||||||
for (int i : array) {
|
for (int i : array) {
|
||||||
@ -207,18 +78,6 @@ public class MathMan {
|
|||||||
return count / array.length;
|
return count / array.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static double getMean(double[] array) {
|
|
||||||
double count = 0;
|
|
||||||
for (double i : array) {
|
|
||||||
count += i;
|
|
||||||
}
|
|
||||||
return count / array.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int pair(short x, short y) {
|
public static int pair(short x, short y) {
|
||||||
return (x << 16) | (y & 0xFFFF);
|
return (x << 16) | (y & 0xFFFF);
|
||||||
}
|
}
|
||||||
@ -227,139 +86,10 @@ public class MathMan {
|
|||||||
return (a & b) + (a ^ b) / 2;
|
return (a & b) + (a ^ b) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static short unpairX(int hash) {
|
|
||||||
return (short) (hash >> 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static short unpairY(int hash) {
|
|
||||||
return (short) (hash & 0xFFFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the x,y,z unit vector from pitch and yaw specified
|
|
||||||
*
|
|
||||||
* @param yaw yaw
|
|
||||||
* @param pitch pitch
|
|
||||||
* @return x, y, z unit vector
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static float[] getDirection(float yaw, float pitch) {
|
|
||||||
double pitch_sin = Math.sin(pitch);
|
|
||||||
return new float[]{(float) (pitch_sin * Math.cos(yaw)),
|
|
||||||
(float) (pitch_sin * Math.sin(yaw)), (float) Math.cos(pitch)};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static int floorMod(int x, int y) {
|
|
||||||
int i = x % y;
|
|
||||||
if (i < 0) {
|
|
||||||
i += y;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int roundInt(double value) {
|
public static int roundInt(double value) {
|
||||||
return (int) (value < 0 ? (value == (int) value) ? value : value - 1 : value);
|
return (int) (value < 0 ? (value == (int) value) ? value : value - 1 : value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns [ pitch, yaw ]
|
|
||||||
*
|
|
||||||
* @param x x
|
|
||||||
* @param y y
|
|
||||||
* @param z z
|
|
||||||
* @return pitch and yaw of x,y,z from 0,0,0
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static float[] getPitchAndYaw(float x, float y, float z) {
|
|
||||||
float distance = sqrtApprox((z * z) + (x * x));
|
|
||||||
return new float[]{atan2(y, distance), atan2(x, z)};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static final float atan2(float y, float x) {
|
|
||||||
float add;
|
|
||||||
float mul;
|
|
||||||
|
|
||||||
if (x < 0.0f) {
|
|
||||||
if (y < 0.0f) {
|
|
||||||
x = -x;
|
|
||||||
y = -y;
|
|
||||||
|
|
||||||
mul = 1.0f;
|
|
||||||
} else {
|
|
||||||
x = -x;
|
|
||||||
mul = -1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
add = -3.141592653f;
|
|
||||||
} else {
|
|
||||||
if (y < 0.0f) {
|
|
||||||
y = -y;
|
|
||||||
mul = -1.0f;
|
|
||||||
} else {
|
|
||||||
mul = 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
add = 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
float invDiv = 1.0f / (((x < y) ? y : x) * INV_ATAN2_DIM_MINUS_1);
|
|
||||||
|
|
||||||
int xi = (int) (x * invDiv);
|
|
||||||
int yi = (int) (y * invDiv);
|
|
||||||
|
|
||||||
return (atan2[(yi * ATAN2_DIM) + xi] + add) * mul;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static float sqrtApprox(float f) {
|
|
||||||
return f * Float.intBitsToFloat(0x5f375a86 - (Float.floatToIntBits(f) >> 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static double sqrtApprox(double d) {
|
|
||||||
return Double
|
|
||||||
.longBitsToDouble(((Double.doubleToLongBits(d) - (1L << 52)) >> 1) + (1L << 61));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static float invSqrt(float x) {
|
|
||||||
float xhalf = 0.5f * x;
|
|
||||||
int i = Float.floatToIntBits(x);
|
|
||||||
i = 0x5f3759df - (i >> 1);
|
|
||||||
x = Float.intBitsToFloat(i);
|
|
||||||
x = x * (1.5f - (xhalf * x * x));
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getPositiveId(int i) {
|
public static int getPositiveId(int i) {
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
return (-i * 2) - 1;
|
return (-i * 2) - 1;
|
||||||
@ -391,18 +121,6 @@ public class MathMan {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static double getSD(double[] array, double av) {
|
|
||||||
double sd = 0;
|
|
||||||
for (double element : array) {
|
|
||||||
sd += Math.pow(Math.abs(element - av), 2);
|
|
||||||
}
|
|
||||||
return Math.sqrt(sd / array.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getSD(int[] array, double av) {
|
public static double getSD(int[] array, double av) {
|
||||||
double sd = 0;
|
double sd = 0;
|
||||||
for (int element : array) {
|
for (int element : array) {
|
||||||
@ -411,34 +129,4 @@ public class MathMan {
|
|||||||
return Math.sqrt(sd / array.length);
|
return Math.sqrt(sd / array.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static int mod(int x, int y) {
|
|
||||||
if (isPowerOfTwo(y)) {
|
|
||||||
return x & (y - 1);
|
|
||||||
}
|
|
||||||
return x % y;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static int unsignedmod(int x, int y) {
|
|
||||||
if (isPowerOfTwo(y)) {
|
|
||||||
return x & (y - 1);
|
|
||||||
}
|
|
||||||
return x % y;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static boolean isPowerOfTwo(int number) {
|
|
||||||
return (number & (number - 1)) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,10 @@
|
|||||||
package com.plotsquared.core.util;
|
package com.plotsquared.core.util;
|
||||||
|
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import java.awt.geom.Rectangle2D;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
@ -90,16 +88,6 @@ public class RegionUtil {
|
|||||||
.getY() && y <= max.getY();
|
.getY() && y <= max.getY();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static @NonNull Rectangle2D toRectangle(final @NonNull CuboidRegion region) {
|
|
||||||
final BlockVector2 min = region.getMinimumPoint().toBlockVector2();
|
|
||||||
final BlockVector2 max = region.getMaximumPoint().toBlockVector2();
|
|
||||||
return new Rectangle2D.Double(min.getX(), min.getZ(), max.getX(), max.getZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Because WorldEdit (not FastAsyncWorldEdit) lack this for CuboidRegion
|
// Because WorldEdit (not FastAsyncWorldEdit) lack this for CuboidRegion
|
||||||
public static boolean intersects(CuboidRegion region, CuboidRegion other) {
|
public static boolean intersects(CuboidRegion region, CuboidRegion other) {
|
||||||
BlockVector3 regionMin = region.getMinimumPoint();
|
BlockVector3 regionMin = region.getMinimumPoint();
|
||||||
|
@ -18,19 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.core.util;
|
package com.plotsquared.core.util;
|
||||||
|
|
||||||
import com.plotsquared.core.PlotSquared;
|
|
||||||
import com.plotsquared.core.configuration.caption.Caption;
|
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -39,31 +33,6 @@ public class StringMan {
|
|||||||
// Stolen from https://stackoverflow.com/a/366532/12620913 | Debug: https://regex101.com/r/DudJLb/1
|
// Stolen from https://stackoverflow.com/a/366532/12620913 | Debug: https://regex101.com/r/DudJLb/1
|
||||||
private static final Pattern STRING_SPLIT_PATTERN = Pattern.compile("[^\\s\"]+|\"([^\"]*)\"");
|
private static final Pattern STRING_SPLIT_PATTERN = Pattern.compile("[^\\s\"]+|\"([^\"]*)\"");
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static String replaceFromMap(String string, Map<String, String> replacements) {
|
|
||||||
StringBuilder sb = new StringBuilder(string);
|
|
||||||
int size = string.length();
|
|
||||||
for (Entry<String, String> entry : replacements.entrySet()) {
|
|
||||||
if (size == 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
String key = entry.getKey();
|
|
||||||
String value = entry.getValue();
|
|
||||||
int start = sb.indexOf(key, 0);
|
|
||||||
while (start > -1) {
|
|
||||||
int end = start + key.length();
|
|
||||||
int nextSearchStart = start + value.length();
|
|
||||||
sb.replace(start, end, value);
|
|
||||||
size -= end - start;
|
|
||||||
start = sb.indexOf(key, nextSearchStart);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int intersection(Set<String> options, String[] toCheck) {
|
public static int intersection(Set<String> options, String[] toCheck) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (String check : toCheck) {
|
for (String check : toCheck) {
|
||||||
@ -74,107 +43,6 @@ public class StringMan {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static String getString(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return "null";
|
|
||||||
}
|
|
||||||
if (obj instanceof String) {
|
|
||||||
return (String) obj;
|
|
||||||
}
|
|
||||||
if (obj instanceof Caption) {
|
|
||||||
return ((Caption) obj).getComponent(PlotSquared.platform());
|
|
||||||
}
|
|
||||||
if (obj.getClass().isArray()) {
|
|
||||||
StringBuilder result = new StringBuilder();
|
|
||||||
String prefix = "";
|
|
||||||
|
|
||||||
for (int i = 0; i < Array.getLength(obj); i++) {
|
|
||||||
result.append(prefix).append(getString(Array.get(obj, i)));
|
|
||||||
prefix = ",";
|
|
||||||
}
|
|
||||||
return "( " + result + " )";
|
|
||||||
} else if (obj instanceof Collection<?>) {
|
|
||||||
StringBuilder result = new StringBuilder();
|
|
||||||
String prefix = "";
|
|
||||||
for (Object element : (Collection<?>) obj) {
|
|
||||||
result.append(prefix).append(getString(element));
|
|
||||||
prefix = ",";
|
|
||||||
}
|
|
||||||
return "[ " + result + " ]";
|
|
||||||
} else {
|
|
||||||
return obj.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static String replaceFirst(char c, String s) {
|
|
||||||
if (s == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if (s.isEmpty()) {
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
char[] chars = s.toCharArray();
|
|
||||||
char[] newChars = new char[chars.length];
|
|
||||||
int used = 0;
|
|
||||||
boolean found = false;
|
|
||||||
for (char cc : chars) {
|
|
||||||
if (!found && (c == cc)) {
|
|
||||||
found = true;
|
|
||||||
} else {
|
|
||||||
newChars[used++] = cc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (found) {
|
|
||||||
chars = new char[newChars.length - 1];
|
|
||||||
System.arraycopy(newChars, 0, chars, 0, chars.length);
|
|
||||||
return String.valueOf(chars);
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static String replaceAll(String string, Object... pairs) {
|
|
||||||
StringBuilder sb = new StringBuilder(string);
|
|
||||||
for (int i = 0; i < pairs.length; i += 2) {
|
|
||||||
String key = pairs[i] + "";
|
|
||||||
String value = pairs[i + 1] + "";
|
|
||||||
int start = sb.indexOf(key, 0);
|
|
||||||
while (start > -1) {
|
|
||||||
int end = start + key.length();
|
|
||||||
int nextSearchStart = start + value.length();
|
|
||||||
sb.replace(start, end, value);
|
|
||||||
start = sb.indexOf(key, nextSearchStart);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static boolean isAlphanumeric(String str) {
|
|
||||||
for (int i = 0; i < str.length(); i++) {
|
|
||||||
char c = str.charAt(i);
|
|
||||||
if ((c < 0x30) || ((c >= 0x3a) && (c <= 0x40)) || ((c > 0x5a) && (c <= 0x60)) || (c
|
|
||||||
> 0x7a)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isAlphanumericUnd(String str) {
|
public static boolean isAlphanumericUnd(String str) {
|
||||||
for (int i = 0; i < str.length(); i++) {
|
for (int i = 0; i < str.length(); i++) {
|
||||||
char c = str.charAt(i);
|
char c = str.charAt(i);
|
||||||
@ -185,20 +53,6 @@ public class StringMan {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static boolean isAlpha(String str) {
|
|
||||||
for (int i = 0; i < str.length(); i++) {
|
|
||||||
char c = str.charAt(i);
|
|
||||||
if ((c <= 0x40) || ((c > 0x5a) && (c <= 0x60)) || (c > 0x7a)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String join(Collection<?> collection, String delimiter) {
|
public static String join(Collection<?> collection, String delimiter) {
|
||||||
return join(collection.toArray(), delimiter);
|
return join(collection.toArray(), delimiter);
|
||||||
}
|
}
|
||||||
@ -209,35 +63,6 @@ public class StringMan {
|
|||||||
return join(array, delimiter);
|
return join(array, delimiter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static String join(Collection<?> collection, char delimiter) {
|
|
||||||
return join(collection.toArray(), delimiter + "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static boolean isAsciiPrintable(char c) {
|
|
||||||
return (c >= ' ') && (c < '');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static boolean isAsciiPrintable(String s) {
|
|
||||||
for (char c : s.toCharArray()) {
|
|
||||||
if (!isAsciiPrintable(c)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getLevenshteinDistance(String s, String t) {
|
public static int getLevenshteinDistance(String s, String t) {
|
||||||
int n = s.length();
|
int n = s.length();
|
||||||
int m = t.length();
|
int m = t.length();
|
||||||
@ -285,31 +110,6 @@ public class StringMan {
|
|||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static String join(int[] array, String delimiter) {
|
|
||||||
Integer[] wrapped = new Integer[array.length];
|
|
||||||
for (int i = 0; i < array.length; i++) {
|
|
||||||
wrapped[i] = array[i];
|
|
||||||
}
|
|
||||||
return join(wrapped, delimiter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static boolean isEqualToAny(String a, String... args) {
|
|
||||||
for (String arg : args) {
|
|
||||||
if (StringMan.isEqual(a, arg)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isEqualIgnoreCaseToAny(@NonNull String a, String... args) {
|
public static boolean isEqualIgnoreCaseToAny(@NonNull String a, String... args) {
|
||||||
for (String arg : args) {
|
for (String arg : args) {
|
||||||
if (a.equalsIgnoreCase(arg)) {
|
if (a.equalsIgnoreCase(arg)) {
|
||||||
@ -328,53 +128,12 @@ public class StringMan {
|
|||||||
return a.equals(b);
|
return a.equals(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static boolean isEqualIgnoreCase(String a, String b) {
|
|
||||||
return a.equals(b) || ((a != null) && (b != null) && (a.length() == b.length()) && a
|
|
||||||
.equalsIgnoreCase(b));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String repeat(String s, int n) {
|
public static String repeat(String s, int n) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(String.valueOf(s).repeat(Math.max(0, n)));
|
sb.append(String.valueOf(s).repeat(Math.max(0, n)));
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static boolean contains(String name, char c) {
|
|
||||||
for (char current : name.toCharArray()) {
|
|
||||||
if (c == current) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public <T> Collection<T> match(Collection<T> col, String startsWith) {
|
|
||||||
if (col == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
startsWith = startsWith.toLowerCase();
|
|
||||||
Iterator<?> iterator = col.iterator();
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
Object item = iterator.next();
|
|
||||||
if (item == null || !item.toString().toLowerCase().startsWith(startsWith)) {
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return col;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param message an input string
|
* @param message an input string
|
||||||
* @return a list of strings
|
* @return a list of strings
|
||||||
|
@ -58,37 +58,6 @@ public class WEManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static boolean maskContains(Set<CuboidRegion> mask, double dx, double dy, double dz) {
|
|
||||||
int x = Math.toIntExact(Math.round(dx >= 0 ? dx - 0.5 : dx + 0.5));
|
|
||||||
int y = Math.toIntExact(Math.round(dy - 0.5));
|
|
||||||
int z = Math.toIntExact(Math.round(dz >= 0 ? dz - 0.5 : dz + 0.5));
|
|
||||||
for (CuboidRegion region : mask) {
|
|
||||||
if (RegionUtil.contains(region, x, y, z)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static boolean maskContains(Set<CuboidRegion> mask, double dx, double dz) {
|
|
||||||
int x = Math.toIntExact(Math.round(dx >= 0 ? dx - 0.5 : dx + 0.5));
|
|
||||||
int z = Math.toIntExact(Math.round(dz >= 0 ? dz - 0.5 : dz + 0.5));
|
|
||||||
for (CuboidRegion region : mask) {
|
|
||||||
if (RegionUtil.contains(region, x, z)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HashSet<CuboidRegion> getMask(PlotPlayer<?> player) {
|
public static HashSet<CuboidRegion> getMask(PlotPlayer<?> player) {
|
||||||
HashSet<CuboidRegion> regions = new HashSet<>();
|
HashSet<CuboidRegion> regions = new HashSet<>();
|
||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
@ -124,25 +93,4 @@ public class WEManager {
|
|||||||
return regions;
|
return regions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static boolean intersects(CuboidRegion region1, CuboidRegion region2) {
|
|
||||||
return RegionUtil.intersects(region1, region2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Unused internally. Scheduled for removal in next major release.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "6.11.1")
|
|
||||||
public static boolean regionContains(CuboidRegion selection, HashSet<CuboidRegion> mask) {
|
|
||||||
for (CuboidRegion region : mask) {
|
|
||||||
if (intersects(region, selection)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user