mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Some tweaks / optimizations
This commit is contained in:
@ -442,7 +442,7 @@ public class Area extends SubCommand {
|
||||
RegionWrapper region = area.getRegion();
|
||||
center = new Location(area.worldname, region.minX + (region.maxX - region.minX) / 2, 0,
|
||||
region.minZ + (region.maxZ - region.minZ) / 2);
|
||||
center.setY(WorldUtil.IMP.getHighestBlock(area.worldname, center.getX(), center.getZ()));
|
||||
center.setY(1 + WorldUtil.IMP.getHighestBlock(area.worldname, center.getX(), center.getZ()));
|
||||
}
|
||||
player.teleport(center);
|
||||
return true;
|
||||
|
@ -54,7 +54,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
Location bot = plot.getBottomAbs();
|
||||
if (SIGN_LOCATION == null) {
|
||||
bot.setY(ROAD_HEIGHT + 1);
|
||||
return bot.add(-1, ROAD_HEIGHT, -2);
|
||||
return bot.add(-1, 1, -2);
|
||||
} else {
|
||||
bot.setY(0);
|
||||
Location loc = bot.add(SIGN_LOCATION.getX(), SIGN_LOCATION.getY(), SIGN_LOCATION.getZ());
|
||||
|
@ -1134,8 +1134,8 @@ public class Plot {
|
||||
int z = largest.minZ - 1;
|
||||
PlotManager manager = getManager();
|
||||
int y = isLoaded() ? WorldUtil.IMP.getHighestBlock(getWorldName(), x, z) : 64;
|
||||
if (area.ALLOW_SIGNS) {
|
||||
y = Math.max(y, manager.getSignLoc(area, this).getY());
|
||||
if (area.ALLOW_SIGNS && (y <= 0 || y >= 255)) {
|
||||
y = Math.max(y, manager.getSignLoc(area, this).getY() - 1);
|
||||
}
|
||||
return new Location(getWorldName(), x, y + 1, z);
|
||||
}
|
||||
@ -1147,13 +1147,15 @@ public class Plot {
|
||||
public Location getHome() {
|
||||
BlockLoc home = this.getPosition();
|
||||
if (home == null || home.x == 0 && home.z == 0) {
|
||||
System.out.println("Default");
|
||||
return this.getDefaultHome(true);
|
||||
} else {
|
||||
System.out.println("Custom");
|
||||
Location bot = this.getBottomAbs();
|
||||
Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, bot.getZ() + home.z, home.yaw, home.pitch);
|
||||
if (!isLoaded()) return loc;
|
||||
if (WorldUtil.IMP.getBlock(loc).id != 0) {
|
||||
loc.setY(Math.max(WorldUtil.IMP.getHighestBlock(this.getWorldName(), loc.getX(), loc.getZ()), bot.getY()));
|
||||
loc.setY(Math.max(1 + WorldUtil.IMP.getHighestBlock(this.getWorldName(), loc.getX(), loc.getZ()), bot.getY()));
|
||||
}
|
||||
return loc;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public class PlotCluster {
|
||||
}
|
||||
int max = MainUtil.getHeighestBlock(this.area.worldname, toReturn.getX(), toReturn.getZ());
|
||||
if (max > toReturn.getY()) {
|
||||
toReturn.setY(max);
|
||||
toReturn.setY(1 + max);
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -34,11 +35,16 @@ public class SinglePlotManager extends PlotManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clearPlot(PlotArea plotArea, Plot plot, Runnable whenDone) {
|
||||
public boolean clearPlot(PlotArea plotArea, Plot plot, final Runnable whenDone) {
|
||||
SetupUtils.manager.unload(plot.getWorldName(), false);
|
||||
File worldFolder = new File(PS.get().IMP.getWorldContainer(), plot.getWorldName());
|
||||
MainUtil.deleteDirectory(worldFolder);
|
||||
if (whenDone != null) whenDone.run();
|
||||
final File worldFolder = new File(PS.get().IMP.getWorldContainer(), plot.getWorldName());
|
||||
TaskManager.IMP.taskAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MainUtil.deleteDirectory(worldFolder);
|
||||
if (whenDone != null) whenDone.run();
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -565,7 +565,7 @@ public class MainUtil {
|
||||
public static int getHeighestBlock(String world, int x, int z) {
|
||||
int result = WorldUtil.IMP.getHighestBlock(world, x, z);
|
||||
if (result == 0) {
|
||||
return 64;
|
||||
return 63;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ public abstract class SchematicHandler {
|
||||
if (pw instanceof ClassicPlotWorld) {
|
||||
y_offset_actual = yOffset + ((ClassicPlotWorld) pw).PLOT_HEIGHT;
|
||||
} else {
|
||||
y_offset_actual = yOffset + MainUtil.getHeighestBlock(plot.getWorldName(), region.minX + 1, region.minZ + 1);
|
||||
y_offset_actual = yOffset + 1 + MainUtil.getHeighestBlock(plot.getWorldName(), region.minX + 1, region.minZ + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public abstract class LocalBlockQueue {
|
||||
GlobalBlockQueue.IMP.enqueue(this);
|
||||
}
|
||||
|
||||
public final void setCuboid(Location pos1, Location pos2, PlotBlock block) {
|
||||
public void setCuboid(Location pos1, Location pos2, PlotBlock block) {
|
||||
for (int y = pos1.getY(); y <= Math.min(255, pos2.getY()); y++) {
|
||||
for (int x = pos1.getX(); x <= pos2.getX(); x++) {
|
||||
for (int z = pos1.getZ(); z <= pos2.getZ(); z++) {
|
||||
@ -100,7 +100,7 @@ public abstract class LocalBlockQueue {
|
||||
}
|
||||
}
|
||||
|
||||
public final void setCuboid(Location pos1, Location pos2, PlotBlock[] blocks) {
|
||||
public void setCuboid(Location pos1, Location pos2, PlotBlock[] blocks) {
|
||||
for (int y = pos1.getY(); y <= Math.min(255, pos2.getY()); y++) {
|
||||
for (int x = pos1.getX(); x <= pos2.getX(); x++) {
|
||||
for (int z = pos1.getZ(); z <= pos2.getZ(); z++) {
|
||||
|
Reference in New Issue
Block a user