minor fixes to plot clearing

This commit is contained in:
boy0001 2015-02-08 16:42:49 +11:00
parent 6a8b227b08
commit fe64841a0f
2 changed files with 9 additions and 6 deletions

View File

@ -272,7 +272,9 @@ public class HybridGen extends PlotGenerator {
for (short x = 0; x < 16; x++) { for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) { for (short z = 0; z < 16; z++) {
biomes.setBiome(x, z, this.biome); if (biomes != null) {
biomes.setBiome(x, z, this.biome);
}
if (isIn(plot, X + x, Z + z)) { if (isIn(plot, X + x, Z + z)) {
for (short y = 1; y < this.plotheight; y++) { for (short y = 1; y < this.plotheight; y++) {
setBlock(this.result, x, y, z, this.filling); setBlock(this.result, x, y, z, this.filling);

View File

@ -941,11 +941,12 @@ import com.intellectualcrafters.plot.object.PlotWorld;
public static int getHeighestBlock(final World world, final int x, final int z) { public static int getHeighestBlock(final World world, final int x, final int z) {
boolean safe = false; boolean safe = false;
int id;
for (int i = 1; i < world.getMaxHeight(); i++) { for (int i = 1; i < world.getMaxHeight(); i++) {
final int id = world.getBlockAt(x, i, z).getTypeId(); id = world.getBlockAt(x, i, z).getTypeId();
if (id == 0) { if (id == 0) {
if (safe) { if (safe) {
return i - 1; return i;
} }
safe = true; safe = true;
} }
@ -968,10 +969,10 @@ import com.intellectualcrafters.plot.object.PlotWorld;
PlotManager manager = PlotMain.getPlotManager(w); PlotManager manager = PlotMain.getPlotManager(w);
if (home == null || (home.x == 0 && home.z == 0)) { if (home == null || (home.x == 0 && home.z == 0)) {
final Location top = getPlotTopLoc(w, plotid); final Location top = getPlotTopLoc(w, plotid);
final int x = top.getBlockX() - bot.getBlockX(); final int x = ((top.getBlockX() - bot.getBlockX())/2) + bot.getBlockX();
final int z = top.getBlockZ() - bot.getBlockZ(); final int z = ((top.getBlockZ() - bot.getBlockZ())/2) + bot.getBlockZ();
final int y = Math.max(getHeighestBlock(w, x, z), manager.getSignLoc(w, PlotMain.getWorldSettings(w), plot).getBlockY()); final int y = Math.max(getHeighestBlock(w, x, z), manager.getSignLoc(w, PlotMain.getWorldSettings(w), plot).getBlockY());
return new Location(w, bot.getBlockX() + (x / 2), y, bot.getBlockZ() + (z / 2)); return new Location(w, x, y, z);
} }
else { else {
final int y = Math.max(getHeighestBlock(w, home.x, home.z), home.y); final int y = Math.max(getHeighestBlock(w, home.x, home.z), home.y);