From 3f54ba23c22d7526305f7aea8e1a4a105b954fa8 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 1 Apr 2017 04:36:15 +1100 Subject: [PATCH] Fix world delete --- .../plot/object/Plot.java | 12 +------- .../plot/object/worlds/SinglePlot.java | 12 ++++++++ .../plot/object/worlds/SinglePlotArea.java | 30 ++++++++++++++----- settings.gradle | 2 +- 4 files changed, 37 insertions(+), 19 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java index c0615864e..db4da7753 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -799,17 +799,7 @@ public class Plot { manager.clearPlot(Plot.this.area, current, this); } }; - if (!isMerged() && this.area.getRegion().equals(getLargestRegion())) { - final LocalBlockQueue blockQueue = area.getQueue(false); - ChunkManager.largeRegionTask(this.getWorldName(), this.area.getRegion(), new RunnableVal() { - @Override - public void run(ChunkLoc value) { - blockQueue.regenChunk(value.x, value.z); - } - }, whenDone); - } else { - run.run(); - } + run.run(); return true; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/worlds/SinglePlot.java b/Core/src/main/java/com/intellectualcrafters/plot/object/worlds/SinglePlot.java index 6ed39c281..3c33577d2 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/worlds/SinglePlot.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/worlds/SinglePlot.java @@ -6,6 +6,7 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.RegionWrapper; import java.util.Collection; import java.util.HashSet; import java.util.UUID; @@ -47,5 +48,16 @@ public class SinglePlot extends Plot { getArea().loadWorld(getId()); return super.isLoaded(); } + private HashSet regions; + { + regions = new HashSet<>(); + regions.add(new RegionWrapper(Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE)); + } + + @Override + public HashSet getRegions() { + return regions; + } + // getCenter getSide getHome getDefaultHome getBiome } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/worlds/SinglePlotArea.java b/Core/src/main/java/com/intellectualcrafters/plot/object/worlds/SinglePlotArea.java index 678642382..54e8660f7 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/worlds/SinglePlotArea.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/worlds/SinglePlotArea.java @@ -8,7 +8,6 @@ import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotLoc; -import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotSettings; import com.intellectualcrafters.plot.object.SetupObject; import com.intellectualcrafters.plot.util.SetupUtils; @@ -87,14 +86,31 @@ public class SinglePlotArea extends GridPlotWorld { return getPlotAbs(pid); } - public boolean addPlot(Plot p) { + public boolean addPlot(Plot plot) { + plot = adapt(plot); + return super.addPlot(plot); + } + + @Override + public boolean addPlotAbs(Plot plot) { + plot = adapt(plot); + return super.addPlotAbs(plot); + } + + @Override + public boolean addPlotIfAbsent(Plot plot) { + plot = adapt(plot); + return super.addPlotIfAbsent(plot); + } + + private Plot adapt(Plot p) { + if (p instanceof SinglePlot) { + return p; + } PlotSettings s = p.getSettings(); p = new SinglePlot(p.getId(), p.owner, p.getTrusted(), p.getMembers(), p.getDenied(), s.alias, s.getPosition(), null, this, s.merged, p.getTimestamp(), p.temp); - p.getSettings().flags = s.flags; - for (PlotPlayer pp : p.getPlayersInPlot()) { - pp.setMeta("lastplot", p); - } - return this.plots.put(p.getId(), p) == null; + s.flags = s.flags; + return p; } public Plot getPlotAbs(PlotId id) { diff --git a/settings.gradle b/settings.gradle index 11ad32b30..2735f683c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,3 @@ rootProject.name = 'PlotSquared' -include 'Core', 'Bukkit', 'Sponge', 'Nukkit' \ No newline at end of file +include 'Core', 'Bukkit', 'Nukkit' //,'Sponge' \ No newline at end of file