From fe64841a0f6c9cb9346fbb8ca9b63bd1aa6d214b Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 8 Feb 2015 16:42:49 +1100 Subject: [PATCH] minor fixes to plot clearing --- .../plot/generator/HybridGen.java | 4 +++- .../intellectualcrafters/plot/util/PlotHelper.java | 11 ++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java index 87001a31f..a8dd3f970 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridGen.java @@ -272,7 +272,9 @@ public class HybridGen extends PlotGenerator { for (short x = 0; x < 16; x++) { 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)) { for (short y = 1; y < this.plotheight; y++) { setBlock(this.result, x, y, z, this.filling); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java index 88943a18f..871fdb66f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java @@ -941,11 +941,12 @@ import com.intellectualcrafters.plot.object.PlotWorld; public static int getHeighestBlock(final World world, final int x, final int z) { boolean safe = false; + int id; 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 (safe) { - return i - 1; + return i; } safe = true; } @@ -968,10 +969,10 @@ import com.intellectualcrafters.plot.object.PlotWorld; PlotManager manager = PlotMain.getPlotManager(w); if (home == null || (home.x == 0 && home.z == 0)) { final Location top = getPlotTopLoc(w, plotid); - final int x = top.getBlockX() - bot.getBlockX(); - final int z = top.getBlockZ() - bot.getBlockZ(); + final int x = ((top.getBlockX() - bot.getBlockX())/2) + bot.getBlockX(); + 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()); - return new Location(w, bot.getBlockX() + (x / 2), y, bot.getBlockZ() + (z / 2)); + return new Location(w, x, y, z); } else { final int y = Math.max(getHeighestBlock(w, home.x, home.z), home.y);