mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-04 19:03:14 +01:00
make y location of homes always absolute part 2 (#3620)
This commit is contained in:
parent
f7d55ce105
commit
d5f8a0842b
@ -1420,15 +1420,7 @@ public class Plot {
|
|||||||
0
|
0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Location location = Location
|
Location location = toHomeLocation(bottom, home);
|
||||||
.at(
|
|
||||||
bottom.getWorldName(),
|
|
||||||
bottom.getX() + home.getX(),
|
|
||||||
bottom.getY() + home.getY(),
|
|
||||||
bottom.getZ() + home.getZ(),
|
|
||||||
home.getYaw(),
|
|
||||||
home.getPitch()
|
|
||||||
);
|
|
||||||
if (!this.worldUtil.getBlockSynchronous(location).getBlockType().getMaterial().isAir()) {
|
if (!this.worldUtil.getBlockSynchronous(location).getBlockType().getMaterial().isAir()) {
|
||||||
location = location.withY(
|
location = location.withY(
|
||||||
Math.max(1 + this.worldUtil.getHighestBlockSynchronous(
|
Math.max(1 + this.worldUtil.getHighestBlockSynchronous(
|
||||||
@ -1461,15 +1453,7 @@ public class Plot {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location bottom = this.getBottomAbs();
|
Location bottom = this.getBottomAbs();
|
||||||
Location location = Location
|
Location location = toHomeLocation(bottom, home);
|
||||||
.at(
|
|
||||||
bottom.getWorldName(),
|
|
||||||
bottom.getX() + home.getX(),
|
|
||||||
home.getY(), // y is absolute
|
|
||||||
bottom.getZ() + home.getZ(),
|
|
||||||
home.getYaw(),
|
|
||||||
home.getPitch()
|
|
||||||
);
|
|
||||||
this.worldUtil.getBlock(location, block -> {
|
this.worldUtil.getBlock(location, block -> {
|
||||||
if (!block.getBlockType().getMaterial().isAir()) {
|
if (!block.getBlockType().getMaterial().isAir()) {
|
||||||
this.worldUtil.getHighestBlock(this.getWorldName(), location.getX(), location.getZ(),
|
this.worldUtil.getHighestBlock(this.getWorldName(), location.getX(), location.getZ(),
|
||||||
@ -1482,6 +1466,17 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Location toHomeLocation(Location bottom, BlockLoc relativeHome) {
|
||||||
|
return Location.at(
|
||||||
|
bottom.getWorldName(),
|
||||||
|
bottom.getX() + relativeHome.getX(),
|
||||||
|
relativeHome.getY(), // y is absolute
|
||||||
|
bottom.getZ() + relativeHome.getZ(),
|
||||||
|
relativeHome.getYaw(),
|
||||||
|
relativeHome.getPitch()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the home location
|
* Sets the home location
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user