From 680e54e6e1e49544dd718a57c1f6db48f53abd89 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Wed, 11 Feb 2015 13:35:15 +1100 Subject: [PATCH] Resolves #145 --- .../plot/flag/FlagValue.java | 18 ++++++++++++++---- .../plot/generator/AugmentedPopulator.java | 9 +++++++-- .../plot/object/PlotBlock.java | 7 +++++-- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagValue.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagValue.java index aaf3c246c..6218f24a5 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagValue.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagValue.java @@ -269,10 +269,15 @@ public abstract class FlagValue { String[] split = t.split(":"); byte data; if (split.length == 2) { - data = Byte.parseByte(split[1]); + if ("*".equals(split[1])) { + data = -1; + } + else { + data = Byte.parseByte(split[1]); + } } else { - data = 0; + data = -1; } short id = Short.parseShort(split[0]); return new PlotBlock(id, data); @@ -314,10 +319,15 @@ public abstract class FlagValue { String[] split = item.split(":"); byte data; if (split.length == 2) { - data = Byte.parseByte(split[1]); + if ("*".equals(split[1])) { + data = -1; + } + else { + data = Byte.parseByte(split[1]); + } } else { - data = 0; + data = -1; } short id = Short.parseShort(split[0]); PlotBlock block = new PlotBlock(id, data); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java index ff329f567..62c984d0d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java @@ -14,6 +14,7 @@ import com.intellectualcrafters.plot.object.BlockWrapper; import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotCluster; import com.intellectualcrafters.plot.object.PlotGenerator; +import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.PlotHelper; @@ -112,10 +113,14 @@ public class AugmentedPopulator extends BlockPopulator { check = true; } else { - if (plotworld.TERRAIN == 2) { + check = false; + } + if (plotworld.TERRAIN == 2) { + PlotId plot1 = manager.getPlotIdAbs(plotworld, new Location(world, x, 0, z)); + PlotId plot2 = manager.getPlotIdAbs(plotworld, new Location(world, x2, 0, z2)); + if (plot1 != null && plot2 != null && plot1.equals(plot2)) { return; } - check = false; } if (this.o) { chunk.load(true); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotBlock.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotBlock.java index 1e390dc30..e6d0782f1 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotBlock.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotBlock.java @@ -45,16 +45,19 @@ public class PlotBlock { return false; } final PlotBlock other = (PlotBlock) obj; - return (this.id == other.id && (this.data == other.data || other.data == -1)); + return (this.id == other.id && (this.data == other.data || this.data == -1 || other.data == -1)); } @Override public int hashCode() { - return (id + data) * (id + data + 1) + data; + return id; } @Override public String toString() { + if (this.data == -1) { + return this.id + ""; + } return this.id + ":" + this.data; } }