mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Start making locations immutable
This commit is contained in:
parent
c36e311520
commit
cf1b027db9
@ -31,6 +31,7 @@ import com.plotsquared.core.configuration.Captions;
|
|||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.plot.PlotManager;
|
import com.plotsquared.core.plot.PlotManager;
|
||||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||||
import com.plotsquared.core.util.MainUtil;
|
import com.plotsquared.core.util.MainUtil;
|
||||||
@ -75,7 +76,12 @@ public class Set extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean set(PlotPlayer player, final Plot plot, String value) {
|
@Override public boolean set(PlotPlayer player, final Plot plot, String value) {
|
||||||
PlotManager manager = player.getLocation().getPlotManager();
|
final PlotArea plotArea = player.getLocation().getPlotArea();
|
||||||
|
if (plotArea == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final PlotManager manager = plotArea.getPlotManager();
|
||||||
|
|
||||||
String[] components = manager.getPlotComponents(plot.getId());
|
String[] components = manager.getPlotComponents(plot.getId());
|
||||||
|
|
||||||
String[] args = value.split(" ");
|
String[] args = value.split(" ");
|
||||||
|
@ -66,9 +66,8 @@ public class WESubscriber {
|
|||||||
if (plotPlayer == null) {
|
if (plotPlayer == null) {
|
||||||
Player player = (Player) actor;
|
Player player = (Player) actor;
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
com.plotsquared.core.location.Location pLoc =
|
com.plotsquared.core.location.Location pLoc = com.plotsquared.core.location.Location.at(player.getWorld().getName(),
|
||||||
new com.plotsquared.core.location.Location(player.getWorld().getName(),
|
location.toVector().toBlockPoint());
|
||||||
location.getBlockX(), location.getBlockX(), location.getBlockZ());
|
|
||||||
Plot plot = pLoc.getPlot();
|
Plot plot = pLoc.getPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
event.setExtent(new NullExtent());
|
event.setExtent(new NullExtent());
|
||||||
|
@ -25,91 +25,137 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.core.location;
|
package com.plotsquared.core.location;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.plotsquared.core.plot.PlotManager;
|
|
||||||
import com.plotsquared.core.util.MathMan;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.khelekore.prtree.MBR;
|
import org.khelekore.prtree.MBR;
|
||||||
import org.khelekore.prtree.SimpleMBR;
|
import org.khelekore.prtree.SimpleMBR;
|
||||||
|
|
||||||
public class Location implements Cloneable, Comparable<Location> {
|
/**
|
||||||
|
* An unmodifiable 6-tuple (world,x,y,z,yaw,pitch)
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public final class Location implements Comparable<Location> {
|
||||||
|
|
||||||
private int x;
|
@Getter private final float yaw;
|
||||||
private int y;
|
@Getter private final float pitch;
|
||||||
private int z;
|
@Getter private final String world;
|
||||||
@Getter @Setter private float yaw;
|
@Getter private final BlockVector3 blockVector3;
|
||||||
@Getter @Setter private float pitch;
|
|
||||||
@Getter @Setter private String world;
|
|
||||||
@Getter private BlockVector3 blockVector3;
|
|
||||||
|
|
||||||
public Location(String world, int x, int y, int z, float yaw, float pitch) {
|
private Location(@NotNull final String world, @NotNull final BlockVector3 blockVector3,
|
||||||
this.world = world;
|
final float yaw, final float pitch) {
|
||||||
this.x = x;
|
this.world = Preconditions.checkNotNull(world, "World may not be null");
|
||||||
this.y = y;
|
this.blockVector3 = Preconditions.checkNotNull(blockVector3, "Vector may not be null");
|
||||||
this.z = z;
|
|
||||||
this.yaw = yaw;
|
this.yaw = yaw;
|
||||||
this.pitch = pitch;
|
this.pitch = pitch;
|
||||||
this.blockVector3 = BlockVector3.at(x, y, z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location(String world, int x, int y, int z) {
|
/**
|
||||||
this(world, x, y, z, 0f, 0f);
|
* Construct a new location
|
||||||
|
*
|
||||||
|
* @param world World
|
||||||
|
* @param blockVector3 (x,y,z) vector
|
||||||
|
* @param yaw yaw
|
||||||
|
* @param pitch pitch
|
||||||
|
* @return New location
|
||||||
|
*/
|
||||||
|
@NotNull public static Location at(@NotNull final String world,
|
||||||
|
@NotNull final BlockVector3 blockVector3, final float yaw, final float pitch) {
|
||||||
|
return new Location(world, blockVector3, yaw, pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new location with yaw and pitch equal to 0
|
||||||
|
*
|
||||||
|
* @param world World
|
||||||
|
* @param blockVector3 (x,y,z) vector
|
||||||
|
* @return New location
|
||||||
|
*/
|
||||||
|
@NotNull public static Location at(@NotNull final String world,
|
||||||
|
@NotNull final BlockVector3 blockVector3) {
|
||||||
|
return at(world, blockVector3, 0f, 0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new location
|
||||||
|
*
|
||||||
|
* @param world World
|
||||||
|
* @param x X coordinate
|
||||||
|
* @param y Y coordinate
|
||||||
|
* @param z Z coordinate
|
||||||
|
* @param yaw Yaw
|
||||||
|
* @param pitch Pitch
|
||||||
|
* @return New location
|
||||||
|
*/
|
||||||
|
@NotNull public static Location at(@NotNull final String world, final int x, final int y,
|
||||||
|
final int z, final float yaw, final float pitch) {
|
||||||
|
return at(world, BlockVector3.at(x, y, z), yaw, pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new location with yaw and pitch equal to 0
|
||||||
|
*
|
||||||
|
* @param world World
|
||||||
|
* @param x X coordinate
|
||||||
|
* @param y Y coordinate
|
||||||
|
* @param z Z coordinate
|
||||||
|
* @return New location
|
||||||
|
*/
|
||||||
|
@NotNull public static Location at(@NotNull final String world, final int x, final int y,
|
||||||
|
final int z) {
|
||||||
|
return at(world, BlockVector3.at(x, y, z));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the X coordinate
|
||||||
|
*
|
||||||
|
* @return X coordinate
|
||||||
|
*/
|
||||||
public int getX() {
|
public int getX() {
|
||||||
return this.x;
|
return this.blockVector3.getBlockX();
|
||||||
}
|
|
||||||
|
|
||||||
public void setX(int x) {
|
|
||||||
this.x = x;
|
|
||||||
this.blockVector3 = BlockVector3.at(x, y, z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Y coordinate
|
||||||
|
*
|
||||||
|
* @return Y coordinate
|
||||||
|
*/
|
||||||
public int getY() {
|
public int getY() {
|
||||||
return this.y;
|
return this.blockVector3.getY();
|
||||||
}
|
|
||||||
|
|
||||||
public void setY(int y) {
|
|
||||||
this.y = y;
|
|
||||||
this.blockVector3 = BlockVector3.at(x, y, z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Z coordinate
|
||||||
|
*
|
||||||
|
* @return Z coordinate
|
||||||
|
*/
|
||||||
public int getZ() {
|
public int getZ() {
|
||||||
return this.z;
|
return this.blockVector3.getZ();
|
||||||
}
|
|
||||||
|
|
||||||
public void setZ(int z) {
|
|
||||||
this.z = z;
|
|
||||||
this.blockVector3 = BlockVector3.at(x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBlockVector3(BlockVector3 blockVector3) {
|
|
||||||
this.blockVector3 = blockVector3;
|
|
||||||
this.x = blockVector3.getX();
|
|
||||||
this.y = blockVector3.getY();
|
|
||||||
this.z = blockVector3.getZ();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Location clone() {
|
|
||||||
try {
|
|
||||||
return (Location) super.clone();
|
|
||||||
} catch (CloneNotSupportedException e) {
|
|
||||||
throw new AssertionError(); //can't happen
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the {@link PlotArea}, if any, that contains this location
|
||||||
|
*
|
||||||
|
* @return Plot area containing the location, or {@code null}
|
||||||
|
*/
|
||||||
@Nullable public PlotArea getPlotArea() {
|
@Nullable public PlotArea getPlotArea() {
|
||||||
return PlotSquared.get().getPlotAreaManager().getPlotArea(this);
|
return PlotSquared.get().getPlotAreaManager().getPlotArea(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plot getOwnedPlot() {
|
/**
|
||||||
PlotArea area = getPlotArea();
|
* Get the owned {@link Plot}, if any, that contains this location
|
||||||
|
*
|
||||||
|
* @return Plot containing the location, or {@code null}
|
||||||
|
*/
|
||||||
|
@Nullable public Plot getOwnedPlot() {
|
||||||
|
final PlotArea area = this.getPlotArea();
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
return area.getOwnedPlot(this);
|
return area.getOwnedPlot(this);
|
||||||
} else {
|
} else {
|
||||||
@ -117,8 +163,13 @@ public class Location implements Cloneable, Comparable<Location> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plot getOwnedPlotAbs() {
|
/**
|
||||||
PlotArea area = getPlotArea();
|
* Get the (absolute) owned {@link Plot}, if any, that contains this location
|
||||||
|
*
|
||||||
|
* @return (Absolute) plot containing the location, or {@code null}
|
||||||
|
*/
|
||||||
|
@Nullable public Plot getOwnedPlotAbs() {
|
||||||
|
final PlotArea area = this.getPlotArea();
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
return area.getOwnedPlotAbs(this);
|
return area.getOwnedPlotAbs(this);
|
||||||
} else {
|
} else {
|
||||||
@ -126,36 +177,42 @@ public class Location implements Cloneable, Comparable<Location> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether or not the location belongs to a plot area
|
||||||
|
*
|
||||||
|
* @return {@code true} if the location belongs to a plot area, else {@link false}
|
||||||
|
*/
|
||||||
public boolean isPlotArea() {
|
public boolean isPlotArea() {
|
||||||
return getPlotArea() != null;
|
return this.getPlotArea() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether or not the location belongs to a plot road
|
||||||
|
*
|
||||||
|
* @return {@code true} if the location belongs to a plot road, else {@link false}
|
||||||
|
*/
|
||||||
public boolean isPlotRoad() {
|
public boolean isPlotRoad() {
|
||||||
PlotArea area = getPlotArea();
|
final PlotArea area = this.getPlotArea();
|
||||||
return area != null && area.getPlotAbs(this) == null;
|
return area != null && area.getPlotAbs(this) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if anyone owns a plot at the current location.
|
* Checks if anyone owns a plot at the current location.
|
||||||
*
|
*
|
||||||
* @return true if the location is a road, not a plot area, or if the plot is unclaimed.
|
* @return {@link true} if the location is a road, not a plot area, or if the plot is unclaimed.
|
||||||
*/
|
*/
|
||||||
public boolean isUnownedPlotArea() {
|
public boolean isUnownedPlotArea() {
|
||||||
PlotArea area = getPlotArea();
|
final PlotArea area = this.getPlotArea();
|
||||||
return area != null && area.getOwnedPlotAbs(this) == null;
|
return area != null && area.getOwnedPlotAbs(this) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotManager getPlotManager() {
|
/**
|
||||||
PlotArea pa = getPlotArea();
|
* Get the absolute {@link Plot}, if any, that contains this location
|
||||||
if (pa != null) {
|
*
|
||||||
return pa.getPlotManager();
|
* @return (Absolute) plot containing the location, or {code null}
|
||||||
} else {
|
*/
|
||||||
return null;
|
@Nullable public Plot getPlotAbs() {
|
||||||
}
|
final PlotArea area = this.getPlotArea();
|
||||||
}
|
|
||||||
|
|
||||||
public Plot getPlotAbs() {
|
|
||||||
PlotArea area = getPlotArea();
|
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
return area.getPlotAbs(this);
|
return area.getPlotAbs(this);
|
||||||
} else {
|
} else {
|
||||||
@ -163,8 +220,13 @@ public class Location implements Cloneable, Comparable<Location> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plot getPlot() {
|
/**
|
||||||
PlotArea area = getPlotArea();
|
* Get the {@link Plot}, if any, that contains this location
|
||||||
|
*
|
||||||
|
* @return plot containing the location, or {code null}
|
||||||
|
*/
|
||||||
|
@Nullable public Plot getPlot() {
|
||||||
|
final PlotArea area = this.getPlotArea();
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
return area.getPlot(this);
|
return area.getPlot(this);
|
||||||
} else {
|
} else {
|
||||||
@ -172,87 +234,133 @@ public class Location implements Cloneable, Comparable<Location> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockVector2 getBlockVector2() {
|
/**
|
||||||
return BlockVector2.at(this.x >> 4, this.z >> 4);
|
* Get the coordinates of the chunk that contains this location
|
||||||
|
*
|
||||||
|
* @return Chunk coordinates
|
||||||
|
*/
|
||||||
|
@NotNull public BlockVector2 getChunkLocation() {
|
||||||
|
return BlockVector2.at(this.getX() >> 4, this.getZ() >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location add(int x, int y, int z) {
|
/**
|
||||||
this.x += x;
|
* Return a new location offset by the given coordinates
|
||||||
this.y += y;
|
*
|
||||||
this.z += z;
|
* @param x X offset
|
||||||
return this;
|
* @param y Y offset
|
||||||
|
* @param z Z offset
|
||||||
|
* @return New location
|
||||||
|
*/
|
||||||
|
@NotNull public Location add(final int x, final int y, final int z) {
|
||||||
|
return new Location(this.world, this.blockVector3.add(x, y, z), this.yaw, this.pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getEuclideanDistanceSquared(Location l2) {
|
/**
|
||||||
|
* Return a new location using the given X coordinate
|
||||||
|
*
|
||||||
|
* @param x New X coordinate
|
||||||
|
* @return New location
|
||||||
|
*/
|
||||||
|
@NotNull public Location withX(final int x) {
|
||||||
|
return new Location(this.world, this.blockVector3.withX(x), this.yaw, this.pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a new location using the given Y coordinate
|
||||||
|
*
|
||||||
|
* @param y New Y coordinate
|
||||||
|
* @return New location
|
||||||
|
*/
|
||||||
|
@NotNull public Location withY(final int y) {
|
||||||
|
return new Location(this.world, this.blockVector3.withY(y), this.yaw, this.pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a new location using the given Z coordinate
|
||||||
|
*
|
||||||
|
* @param z New Z coordinate
|
||||||
|
* @return New location
|
||||||
|
*/
|
||||||
|
@NotNull public Location withZ(final int z) {
|
||||||
|
return new Location(this.world, this.blockVector3.withZ(z), this.yaw, this.pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a new location using the given yaw
|
||||||
|
*
|
||||||
|
* @param yaw New yaw
|
||||||
|
* @return New location
|
||||||
|
*/
|
||||||
|
@NotNull public Location withYaw(final float yaw) {
|
||||||
|
return new Location(this.world, this.blockVector3, yaw, this.pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a new location using the given pitch
|
||||||
|
*
|
||||||
|
* @param pitch New pitch
|
||||||
|
* @return New location
|
||||||
|
*/
|
||||||
|
@NotNull public Location withPitch(final float pitch) {
|
||||||
|
return new Location(this.world, this.blockVector3, this.yaw, pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a new location using the given world
|
||||||
|
*
|
||||||
|
* @param world New world
|
||||||
|
* @return New location
|
||||||
|
*/
|
||||||
|
@NotNull public Location withWorld(@NotNull final String world) {
|
||||||
|
return new Location(world, this.blockVector3, this.yaw, this.pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getEuclideanDistanceSquared(@NotNull final Location l2) {
|
||||||
double x = getX() - l2.getX();
|
double x = getX() - l2.getX();
|
||||||
double y = getY() - l2.getY();
|
double y = getY() - l2.getY();
|
||||||
double z = getZ() - l2.getZ();
|
double z = getZ() - l2.getZ();
|
||||||
return x * x + y * y + z * z;
|
return x * x + y * y + z * z;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getEuclideanDistance(Location l2) {
|
public double getEuclideanDistance(@NotNull final Location l2) {
|
||||||
return Math.sqrt(getEuclideanDistanceSquared(l2));
|
return Math.sqrt(getEuclideanDistanceSquared(l2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInSphere(Location origin, int radius) {
|
/**
|
||||||
return getEuclideanDistanceSquared(origin) < radius * radius;
|
* Return a new location offset by (-) the given coordinates
|
||||||
|
*
|
||||||
|
* @param x X offset
|
||||||
|
* @param y Y offset
|
||||||
|
* @param z Z offset
|
||||||
|
* @return New location
|
||||||
|
*/
|
||||||
|
@NotNull public Location subtract(int x, int y, int z) {
|
||||||
|
return this.add(-x, -y, -z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode() {
|
/**
|
||||||
return MathMan.pair((short) this.x, (short) this.z) * 17 + this.y;
|
* Get a minimum bounding rectangle that contains this location only
|
||||||
|
*
|
||||||
|
* @return Minimum bounding rectangle
|
||||||
|
*/
|
||||||
|
@NotNull public MBR toMBR() {
|
||||||
|
return new SimpleMBR(this.getX(), this.getX(), this.getY(), this.getY(), this.getZ(),
|
||||||
|
this.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInAABB(Location min, Location max) {
|
@Override public int compareTo(@NotNull final Location o) {
|
||||||
return this.x >= min.getX() && this.x <= max.getX() && this.y >= min.getY() && this.y <= max
|
if (this.getX() == o.getX() && this.getY() == o.getY() || this.getZ() == o.getZ()) {
|
||||||
.getY() && this.z >= min.getX() && this.z < max.getZ();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void lookTowards(int x, int y) {
|
|
||||||
double l = this.x - x;
|
|
||||||
double c = Math.sqrt(l * l + 0.0);
|
|
||||||
if (Math.asin(0 / c) / Math.PI * 180 > 90) {
|
|
||||||
setYaw((float) (180 - -Math.asin(l / c) / Math.PI * 180));
|
|
||||||
} else {
|
|
||||||
setYaw((float) (-Math.asin(l / c) / Math.PI * 180));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location subtract(int x, int y, int z) {
|
|
||||||
this.x -= x;
|
|
||||||
this.y -= y;
|
|
||||||
this.z -= z;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MBR toMBR() {
|
|
||||||
return new SimpleMBR(this.getX(), this.getX(), this.getY(), this.getY(), this.getZ(), this.getZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean equals(Object o) {
|
|
||||||
if (o == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!(o instanceof Location)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Location l = (Location) o;
|
|
||||||
return this.x == l.getX() && this.y == l.getY() && this.z == l.getZ() && this.world
|
|
||||||
.equals(l.getWorld()) && this.yaw == l.getYaw() && this.pitch == l.getPitch();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public int compareTo(Location o) {
|
|
||||||
if (this.x == o.getX() && this.y == o.getY() || this.z == o.getZ()) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (this.x < o.getX() && this.y < o.getY() && this.z < o.getZ()) {
|
if (this.getX() < o.getX() && this.getY() < o.getY() && this.getZ() < o.getZ()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String toString() {
|
@Override public String toString() {
|
||||||
return "\"plotsquaredlocation\":{\"x\":" + this.x + ",\"y\":" + this.y + ",\"z\":" + this.z
|
return "\"plotsquaredlocation\":{\"x\":" + this.getX() + ",\"y\":" + this.getY() + ",\"z\":"
|
||||||
+ ",\"yaw\":" + this.yaw + ",\"pitch\":" + this.pitch + ",\"world\":\"" + this.world
|
+ this.getZ() + ",\"yaw\":" + this.yaw + ",\"pitch\":" + this.pitch + ",\"world\":\""
|
||||||
+ "\"}";
|
+ this.world + "\"}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -673,7 +673,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Location location = new Location(plot.getWorldName(), x, y, z);
|
final Location location = Location.at(plot.getWorldName(), x, y, z);
|
||||||
if (plot.isLoaded()) {
|
if (plot.isLoaded()) {
|
||||||
TaskManager.runTask(() -> {
|
TaskManager.runTask(() -> {
|
||||||
if (getMeta("teleportOnLogin", true)) {
|
if (getMeta("teleportOnLogin", true)) {
|
||||||
|
@ -1359,8 +1359,7 @@ public class Plot {
|
|||||||
Location[] corners = getCorners();
|
Location[] corners = getCorners();
|
||||||
Location top = corners[0];
|
Location top = corners[0];
|
||||||
Location bot = corners[1];
|
Location bot = corners[1];
|
||||||
Location location =
|
Location location = Location.at(this.getWorldName(), MathMan.average(bot.getX(), top.getX()),
|
||||||
new Location(this.getWorldName(), MathMan.average(bot.getX(), top.getX()),
|
|
||||||
MathMan.average(bot.getY(), top.getY()), MathMan.average(bot.getZ(), top.getZ()));
|
MathMan.average(bot.getY(), top.getY()), MathMan.average(bot.getZ(), top.getZ()));
|
||||||
if (!isLoaded()) {
|
if (!isLoaded()) {
|
||||||
result.accept(location);
|
result.accept(location);
|
||||||
@ -1371,8 +1370,7 @@ public class Plot {
|
|||||||
if (area.allowSigns()) {
|
if (area.allowSigns()) {
|
||||||
height = Math.max(y, getManager().getSignLoc(this).getY());
|
height = Math.max(y, getManager().getSignLoc(this).getY());
|
||||||
}
|
}
|
||||||
location.setY(1 + height);
|
result.accept(location.withY(1 + height));
|
||||||
result.accept(location);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1383,9 +1381,8 @@ public class Plot {
|
|||||||
Location[] corners = getCorners();
|
Location[] corners = getCorners();
|
||||||
Location top = corners[0];
|
Location top = corners[0];
|
||||||
Location bot = corners[1];
|
Location bot = corners[1];
|
||||||
Location location =
|
Location location = Location.at(this.getWorldName(), MathMan.average(bot.getX(), top.getX()),
|
||||||
new Location(this.getWorldName(), MathMan.average(bot.getX(), top.getX()),
|
MathMan.average(bot.getY(), top.getY()), MathMan.average(bot.getZ(), top.getZ()));
|
||||||
MathMan.average(bot.getY(), top.getY()), MathMan.average(bot.getZ(), top.getZ()));
|
|
||||||
if (!isLoaded()) {
|
if (!isLoaded()) {
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
@ -1394,8 +1391,7 @@ public class Plot {
|
|||||||
if (area.allowSigns()) {
|
if (area.allowSigns()) {
|
||||||
y = Math.max(y, getManager().getSignLoc(this).getY());
|
y = Math.max(y, getManager().getSignLoc(this).getY());
|
||||||
}
|
}
|
||||||
location.setY(1 + y);
|
return location.withY(1 + y);
|
||||||
return location;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1411,7 +1407,7 @@ public class Plot {
|
|||||||
if (area.allowSigns() && (y <= 0 || y >= 255)) {
|
if (area.allowSigns() && (y <= 0 || y >= 255)) {
|
||||||
y = Math.max(y, manager.getSignLoc(this).getY() - 1);
|
y = Math.max(y, manager.getSignLoc(this).getY() - 1);
|
||||||
}
|
}
|
||||||
return new Location(getWorldName(), x, y + 1, z);
|
return Location.at(getWorldName(), x, y + 1, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getSide(Consumer<Location> result) {
|
public void getSide(Consumer<Location> result) {
|
||||||
@ -1426,14 +1422,14 @@ public class Plot {
|
|||||||
if (area.allowSigns() && (y <= 0 || y >= 255)) {
|
if (area.allowSigns() && (y <= 0 || y >= 255)) {
|
||||||
height = Math.max(y, manager.getSignLoc(this).getY() - 1);
|
height = Math.max(y, manager.getSignLoc(this).getY() - 1);
|
||||||
}
|
}
|
||||||
result.accept(new Location(getWorldName(), x, height + 1, z));
|
result.accept(Location.at(getWorldName(), x, height + 1, z));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
int y = 62;
|
int y = 62;
|
||||||
if (area.allowSigns()) {
|
if (area.allowSigns()) {
|
||||||
y = Math.max(y, manager.getSignLoc(this).getY() - 1);
|
y = Math.max(y, manager.getSignLoc(this).getY() - 1);
|
||||||
}
|
}
|
||||||
result.accept(new Location(getWorldName(), x, y + 1, z));
|
result.accept(Location.at(getWorldName(), x, y + 1, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1446,14 +1442,14 @@ public class Plot {
|
|||||||
return this.getDefaultHomeSynchronous(true);
|
return this.getDefaultHomeSynchronous(true);
|
||||||
} else {
|
} else {
|
||||||
Location bottom = this.getBottomAbs();
|
Location bottom = this.getBottomAbs();
|
||||||
Location location = new Location(bottom.getWorld(), bottom.getX() + home.getX(),
|
Location location = Location.at(bottom.getWorld(), bottom.getX() + home.getX(),
|
||||||
bottom.getY() + home.getY(), bottom.getZ() + home.getZ(), home.getYaw(),
|
bottom.getY() + home.getY(), bottom.getZ() + home.getZ(), home.getYaw(),
|
||||||
home.getPitch());
|
home.getPitch());
|
||||||
if (!isLoaded()) {
|
if (!isLoaded()) {
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
if (!WorldUtil.IMP.getBlockSynchronous(location).getBlockType().getMaterial().isAir()) {
|
if (!WorldUtil.IMP.getBlockSynchronous(location).getBlockType().getMaterial().isAir()) {
|
||||||
location.setY(Math.max(1 + WorldUtil.IMP
|
location = location.withY(Math.max(1 + WorldUtil.IMP
|
||||||
.getHighestBlockSynchronous(this.getWorldName(), location.getX(),
|
.getHighestBlockSynchronous(this.getWorldName(), location.getX(),
|
||||||
location.getZ()), bottom.getY()));
|
location.getZ()), bottom.getY()));
|
||||||
}
|
}
|
||||||
@ -1470,7 +1466,7 @@ public class Plot {
|
|||||||
this.getDefaultHome(result);
|
this.getDefaultHome(result);
|
||||||
} else {
|
} else {
|
||||||
Location bottom = this.getBottomAbs();
|
Location bottom = this.getBottomAbs();
|
||||||
Location location = new Location(bottom.getWorld(), bottom.getX() + home.getX(),
|
Location location = Location.at(bottom.getWorld(), bottom.getX() + home.getX(),
|
||||||
bottom.getY() + home.getY(), bottom.getZ() + home.getZ(), home.getYaw(),
|
bottom.getY() + home.getY(), bottom.getZ() + home.getZ(), home.getYaw(),
|
||||||
home.getPitch());
|
home.getPitch());
|
||||||
if (!isLoaded()) {
|
if (!isLoaded()) {
|
||||||
@ -1481,10 +1477,7 @@ public class Plot {
|
|||||||
if (!block.getBlockType().getMaterial().isAir()) {
|
if (!block.getBlockType().getMaterial().isAir()) {
|
||||||
WorldUtil.IMP
|
WorldUtil.IMP
|
||||||
.getHighestBlock(this.getWorldName(), location.getX(), location.getZ(),
|
.getHighestBlock(this.getWorldName(), location.getX(), location.getZ(),
|
||||||
y -> {
|
y -> result.accept(location.withY(Math.max(1 + y, bottom.getY()))));
|
||||||
location.setY(Math.max(1 + y, bottom.getY()));
|
|
||||||
result.accept(location);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
result.accept(location);
|
result.accept(location);
|
||||||
}
|
}
|
||||||
@ -1545,7 +1538,7 @@ public class Plot {
|
|||||||
WorldUtil.IMP.getHighestBlockSynchronous(plot.getWorldName(), x, z) + 1 :
|
WorldUtil.IMP.getHighestBlockSynchronous(plot.getWorldName(), x, z) + 1 :
|
||||||
63) :
|
63) :
|
||||||
loc.getY();
|
loc.getY();
|
||||||
return new Location(plot.getWorldName(), x, y, z);
|
return Location.at(plot.getWorldName(), x, y, z);
|
||||||
}
|
}
|
||||||
// Side
|
// Side
|
||||||
return plot.getSideSynchronous();
|
return plot.getSideSynchronous();
|
||||||
@ -1573,12 +1566,12 @@ public class Plot {
|
|||||||
if (loc.getY() < 1) {
|
if (loc.getY() < 1) {
|
||||||
if (isLoaded()) {
|
if (isLoaded()) {
|
||||||
WorldUtil.IMP.getHighestBlock(plot.getWorldName(), x, z,
|
WorldUtil.IMP.getHighestBlock(plot.getWorldName(), x, z,
|
||||||
y -> result.accept(new Location(plot.getWorldName(), x, y + 1, z)));
|
y -> result.accept(Location.at(plot.getWorldName(), x, y + 1, z)));
|
||||||
} else {
|
} else {
|
||||||
result.accept(new Location(plot.getWorldName(), x, 63, z));
|
result.accept(Location.at(plot.getWorldName(), x, 63, z));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result.accept(new Location(plot.getWorldName(), x, loc.getY(), z));
|
result.accept(Location.at(plot.getWorldName(), x, loc.getY(), z));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1875,9 +1868,7 @@ public class Plot {
|
|||||||
* Returns the top location for the plot.
|
* Returns the top location for the plot.
|
||||||
*/
|
*/
|
||||||
public Location getTopAbs() {
|
public Location getTopAbs() {
|
||||||
Location top = getManager().getPlotTopLocAbs(this.id);
|
return this.getManager().getPlotTopLocAbs(this.id).withWorld(this.getWorldName());
|
||||||
top.setWorld(getWorldName());
|
|
||||||
return top;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO Better documentation needed.
|
//TODO Better documentation needed.
|
||||||
@ -1886,9 +1877,7 @@ public class Plot {
|
|||||||
* Returns the bottom location for the plot.
|
* Returns the bottom location for the plot.
|
||||||
*/
|
*/
|
||||||
public Location getBottomAbs() {
|
public Location getBottomAbs() {
|
||||||
Location location = getManager().getPlotBottomLocAbs(this.id);
|
return this.getManager().getPlotBottomLocAbs(this.id).withWorld(this.getWorldName());
|
||||||
location.setWorld(getWorldName());
|
|
||||||
return location;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1965,10 +1954,10 @@ public class Plot {
|
|||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
if (this.getMerged(Direction.SOUTH)) {
|
if (this.getMerged(Direction.SOUTH)) {
|
||||||
top.setZ(this.getRelative(Direction.SOUTH).getBottomAbs().getZ() - 1);
|
top = top.withZ(this.getRelative(Direction.SOUTH).getBottomAbs().getZ() - 1);
|
||||||
}
|
}
|
||||||
if (this.getMerged(Direction.EAST)) {
|
if (this.getMerged(Direction.EAST)) {
|
||||||
top.setX(this.getRelative(Direction.EAST).getBottomAbs().getX() - 1);
|
top = top.withX(this.getRelative(Direction.EAST).getBottomAbs().getX() - 1);
|
||||||
}
|
}
|
||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
@ -1986,10 +1975,10 @@ public class Plot {
|
|||||||
return bot;
|
return bot;
|
||||||
}
|
}
|
||||||
if (this.getMerged(Direction.NORTH)) {
|
if (this.getMerged(Direction.NORTH)) {
|
||||||
bot.setZ(this.getRelative(Direction.NORTH).getTopAbs().getZ() + 1);
|
bot = bot.withZ(this.getRelative(Direction.NORTH).getTopAbs().getZ() + 1);
|
||||||
}
|
}
|
||||||
if (this.getMerged(Direction.WEST)) {
|
if (this.getMerged(Direction.WEST)) {
|
||||||
bot.setX(this.getRelative(Direction.WEST).getTopAbs().getX() + 1);
|
bot = bot.withX(this.getRelative(Direction.WEST).getTopAbs().getX() + 1);
|
||||||
}
|
}
|
||||||
return bot;
|
return bot;
|
||||||
}
|
}
|
||||||
@ -2019,8 +2008,8 @@ public class Plot {
|
|||||||
Plot other = this.getRelative(Direction.EAST);
|
Plot other = this.getRelative(Direction.EAST);
|
||||||
Location bot = other.getBottomAbs();
|
Location bot = other.getBottomAbs();
|
||||||
Location top = this.getTopAbs();
|
Location top = this.getTopAbs();
|
||||||
Location pos1 = new Location(this.getWorldName(), top.getX(), 0, bot.getZ());
|
Location pos1 = Location.at(this.getWorldName(), top.getX(), 0, bot.getZ());
|
||||||
Location pos2 = new Location(this.getWorldName(), bot.getX(), MAX_HEIGHT, top.getZ());
|
Location pos2 = Location.at(this.getWorldName(), bot.getX(), MAX_HEIGHT, top.getZ());
|
||||||
RegionManager.manager.regenerateRegion(pos1, pos2, true, null);
|
RegionManager.manager.regenerateRegion(pos1, pos2, true, null);
|
||||||
} else if (this.area.getTerrain()
|
} else if (this.area.getTerrain()
|
||||||
!= PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
!= PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
||||||
@ -2391,8 +2380,8 @@ public class Plot {
|
|||||||
Plot other = this.getRelative(Direction.SOUTH);
|
Plot other = this.getRelative(Direction.SOUTH);
|
||||||
Location bot = other.getBottomAbs();
|
Location bot = other.getBottomAbs();
|
||||||
Location top = this.getTopAbs();
|
Location top = this.getTopAbs();
|
||||||
Location pos1 = new Location(this.getWorldName(), bot.getX(), 0, top.getZ());
|
Location pos1 = Location.at(this.getWorldName(), bot.getX(), 0, top.getZ());
|
||||||
Location pos2 = new Location(this.getWorldName(), top.getX(), MAX_HEIGHT, bot.getZ());
|
Location pos2 = Location.at(this.getWorldName(), top.getX(), MAX_HEIGHT, bot.getZ());
|
||||||
RegionManager.manager.regenerateRegion(pos1, pos2, true, null);
|
RegionManager.manager.regenerateRegion(pos1, pos2, true, null);
|
||||||
} else if (this.area.getTerrain()
|
} else if (this.area.getTerrain()
|
||||||
!= PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
!= PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
||||||
@ -2567,10 +2556,8 @@ public class Plot {
|
|||||||
if (this.area.getType() != PlotAreaType.NORMAL
|
if (this.area.getType() != PlotAreaType.NORMAL
|
||||||
&& this.area.getTerrain() == PlotAreaTerrainType.ROAD) {
|
&& this.area.getTerrain() == PlotAreaTerrainType.ROAD) {
|
||||||
Plot other = this.getRelative(1, 1);
|
Plot other = this.getRelative(1, 1);
|
||||||
Location pos1 = this.getTopAbs().add(1, 0, 1);
|
Location pos1 = this.getTopAbs().add(1, 0, 1).withY(0);
|
||||||
Location pos2 = other.getBottomAbs().subtract(1, 0, 1);
|
Location pos2 = other.getBottomAbs().subtract(1, 0, 1).withY(MAX_HEIGHT);
|
||||||
pos1.setY(0);
|
|
||||||
pos2.setY(MAX_HEIGHT);
|
|
||||||
RegionManager.manager.regenerateRegion(pos1, pos2, true, null);
|
RegionManager.manager.regenerateRegion(pos1, pos2, true, null);
|
||||||
} else if (this.area.getTerrain()
|
} else if (this.area.getTerrain()
|
||||||
!= PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
!= PlotAreaTerrainType.ALL) { // no road generated => no road to remove
|
||||||
@ -2963,7 +2950,7 @@ public class Plot {
|
|||||||
int x = (int) MathMan.inverseRound(coords[0]);
|
int x = (int) MathMan.inverseRound(coords[0]);
|
||||||
int z = (int) MathMan.inverseRound(coords[1]);
|
int z = (int) MathMan.inverseRound(coords[1]);
|
||||||
if (type != 4) {
|
if (type != 4) {
|
||||||
locs.add(new Location(this.getWorldName(), x, 0, z));
|
locs.add(Location.at(this.getWorldName(), x, 0, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return locs;
|
return locs;
|
||||||
@ -3229,10 +3216,8 @@ public class Plot {
|
|||||||
Location[] corners = MainUtil.getCorners(getWorldName(), region);
|
Location[] corners = MainUtil.getCorners(getWorldName(), region);
|
||||||
Location pos1 = corners[0];
|
Location pos1 = corners[0];
|
||||||
Location pos2 = corners[1];
|
Location pos2 = corners[1];
|
||||||
Location pos3 = pos1.clone().add(offsetX, 0, offsetZ);
|
Location pos3 = pos1.add(offsetX, 0, offsetZ).withWorld(destination.getWorldName());
|
||||||
Location pos4 = pos2.clone().add(offsetX, 0, offsetZ);
|
Location pos4 = pos2.add(offsetX, 0, offsetZ).withWorld(destination.getWorldName());
|
||||||
pos3.setWorld(destination.getWorldName());
|
|
||||||
pos4.setWorld(destination.getWorldName());
|
|
||||||
RegionManager.manager.swap(pos1, pos2, pos3, pos4, this);
|
RegionManager.manager.swap(pos1, pos2, pos3, pos4, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3263,8 +3248,7 @@ public class Plot {
|
|||||||
Location[] corners = MainUtil.getCorners(getWorldName(), region);
|
Location[] corners = MainUtil.getCorners(getWorldName(), region);
|
||||||
final Location pos1 = corners[0];
|
final Location pos1 = corners[0];
|
||||||
final Location pos2 = corners[1];
|
final Location pos2 = corners[1];
|
||||||
Location newPos = pos1.clone().add(offsetX, 0, offsetZ);
|
Location newPos = pos1.add(offsetX, 0, offsetZ).withWorld(destination.getWorldName());
|
||||||
newPos.setWorld(destination.getWorldName());
|
|
||||||
RegionManager.manager.copyRegion(pos1, pos2, newPos, task);
|
RegionManager.manager.copyRegion(pos1, pos2, newPos, task);
|
||||||
}
|
}
|
||||||
}.run();
|
}.run();
|
||||||
@ -3358,8 +3342,7 @@ public class Plot {
|
|||||||
Location[] corners = MainUtil.getCorners(getWorldName(), region);
|
Location[] corners = MainUtil.getCorners(getWorldName(), region);
|
||||||
Location pos1 = corners[0];
|
Location pos1 = corners[0];
|
||||||
Location pos2 = corners[1];
|
Location pos2 = corners[1];
|
||||||
Location newPos = pos1.clone().add(offsetX, 0, offsetZ);
|
Location newPos = pos1 .add(offsetX, 0, offsetZ).withWorld(destination.getWorldName());
|
||||||
newPos.setWorld(destination.getWorldName());
|
|
||||||
RegionManager.manager.copyRegion(pos1, pos2, newPos, this);
|
RegionManager.manager.copyRegion(pos1, pos2, newPos, this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -59,8 +59,8 @@ public abstract class LocalBlockQueue {
|
|||||||
public ScopedLocalBlockQueue getForChunk(int x, int z) {
|
public ScopedLocalBlockQueue getForChunk(int x, int z) {
|
||||||
int bx = x << 4;
|
int bx = x << 4;
|
||||||
int bz = z << 4;
|
int bz = z << 4;
|
||||||
return new ScopedLocalBlockQueue(this, new Location(getWorld(), bx, 0, bz),
|
return new ScopedLocalBlockQueue(this, Location.at(getWorld(), bx, 0, bz),
|
||||||
new Location(getWorld(), bx + 15, 255, bz + 15));
|
Location.at(getWorld(), bx + 15, 255, bz + 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract boolean next();
|
public abstract boolean next();
|
||||||
@ -125,13 +125,11 @@ public abstract class LocalBlockQueue {
|
|||||||
|
|
||||||
for (final PlotPlayer pp : PlotSquared.platform().getPlayerManager().getPlayers()) {
|
for (final PlotPlayer pp : PlotSquared.platform().getPlayerManager().getPlayers()) {
|
||||||
Location pLoc = pp.getLocation();
|
Location pLoc = pp.getLocation();
|
||||||
if (!StringMan.isEqual(getWorld(), pLoc.getWorld()) || !pLoc.getBlockVector2()
|
if (!StringMan.isEqual(getWorld(), pLoc.getWorld()) || !pLoc.getChunkLocation()
|
||||||
.equals(loc)) {
|
.equals(loc)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pLoc.setY(
|
pp.teleport(pLoc.withY(WorldUtil.IMP.getHighestBlockSynchronous(getWorld(), pLoc.getX(), pLoc.getZ())));
|
||||||
WorldUtil.IMP.getHighestBlockSynchronous(getWorld(), pLoc.getX(), pLoc.getZ()));
|
|
||||||
pp.teleport(pLoc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,10 +232,11 @@ public abstract class SchematicHandler {
|
|||||||
} else {
|
} else {
|
||||||
y_offset_actual = yOffset;
|
y_offset_actual = yOffset;
|
||||||
}
|
}
|
||||||
Location pos1 =
|
|
||||||
new Location(plot.getWorldName(), region.getMinimumPoint().getX() + xOffset,
|
final Location pos1 = Location.at(plot.getWorldName(), region.getMinimumPoint().getX() + xOffset, y_offset_actual,
|
||||||
y_offset_actual, region.getMinimumPoint().getZ() + zOffset);
|
region.getMinimumPoint().getZ() + zOffset);
|
||||||
Location pos2 = pos1.clone().add(WIDTH - 1, HEIGHT - 1, LENGTH - 1);
|
final Location pos2 = pos1.add(WIDTH - 1, HEIGHT - 1, LENGTH - 1);
|
||||||
|
|
||||||
final int p1x = pos1.getX();
|
final int p1x = pos1.getX();
|
||||||
final int p1z = pos1.getZ();
|
final int p1z = pos1.getZ();
|
||||||
final int p2x = pos2.getX();
|
final int p2x = pos2.getX();
|
||||||
@ -554,10 +555,10 @@ public abstract class SchematicHandler {
|
|||||||
}
|
}
|
||||||
final Runnable regionTask = this;
|
final Runnable regionTask = this;
|
||||||
CuboidRegion region = queue.poll();
|
CuboidRegion region = queue.poll();
|
||||||
Location pos1 = new Location(world, region.getMinimumPoint().getX(),
|
|
||||||
region.getMinimumPoint().getY(), region.getMinimumPoint().getZ());
|
final Location pos1 = Location.at(world, region.getMinimumPoint());
|
||||||
Location pos2 = new Location(world, region.getMaximumPoint().getX(),
|
final Location pos2 = Location.at(world, region.getMaximumPoint());
|
||||||
region.getMaximumPoint().getY(), region.getMaximumPoint().getZ());
|
|
||||||
final int p1x = pos1.getX();
|
final int p1x = pos1.getX();
|
||||||
final int sy = pos1.getY();
|
final int sy = pos1.getY();
|
||||||
final int p1z = pos1.getZ();
|
final int p1z = pos1.getZ();
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* _____ _ _ _____ _
|
|
||||||
* | __ \| | | | / ____| | |
|
|
||||||
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
|
||||||
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
|
||||||
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
|
||||||
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
|
||||||
* | |
|
|
||||||
* |_|
|
|
||||||
* PlotSquared plot management system for Minecraft
|
|
||||||
* Copyright (C) 2020 IntellectualSites
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.plotsquared.core.plot.object;
|
|
||||||
|
|
||||||
import com.plotsquared.core.location.Location;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
public class LocationTest {
|
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(LocationTest.class.getName());
|
|
||||||
|
|
||||||
@Test public void cloning() {
|
|
||||||
String world = "plotworld";
|
|
||||||
Location location1 = new Location(world, 0, 0, 0);
|
|
||||||
logger.info(location1.toString());
|
|
||||||
Location clone = location1.clone();
|
|
||||||
world = "normal";
|
|
||||||
logger.info(clone.toString());
|
|
||||||
//location1.getBlockVector3();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user