From 645c5fb52928edc70e44bec33a69de472292395d Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 27 Jul 2018 13:25:46 +1000 Subject: [PATCH] Fix nukkit augmented generator --- .../com/intellectualcrafters/plot/PS.java | 4 ++-- .../plot/commands/Area.java | 7 +++++- .../com/plotsquared/nukkit/NukkitMain.java | 7 +++++- .../nukkit/generator/NukkitPlotGenerator.java | 24 ++++++++++--------- .../nukkit/util/NukkitChunkManager.java | 2 +- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index 5b4588c7c..a2f842f94 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -486,7 +486,7 @@ public class PS{ HashMap plots; if (plots_tmp == null || (plots = plots_tmp.remove(plotArea.toString())) == null) { if (plotArea.TYPE == 2) { - plots = this.plots_tmp.get(plotArea.worldname); + plots = this.plots_tmp != null ? this.plots_tmp.get(plotArea.worldname) : null; if (plots != null) { Iterator> iterator = plots.entrySet().iterator(); while (iterator.hasNext()) { @@ -507,7 +507,7 @@ public class PS{ Set clusters; if (clusters_tmp == null || (clusters = clusters_tmp.remove(plotArea.toString())) == null) { if (plotArea.TYPE == 2) { - clusters = this.clusters_tmp.get(plotArea.worldname); + clusters = this.clusters_tmp != null ? this.clusters_tmp.get(plotArea.worldname) : null; if (clusters != null) { Iterator iterator = clusters.iterator(); while (iterator.hasNext()) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Area.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Area.java index a9b2c58cb..cfab9a55e 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Area.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Area.java @@ -414,7 +414,12 @@ public class Area extends SubCommand { public void run(ChunkLoc value) { AugmentedUtils.generate(area.worldname, value.x, value.z, null); } - }, null); + }, new Runnable() { + @Override + public void run() { + player.sendMessage("Regen complete"); + } + }); return true; } case "goto": diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java b/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java index 771c55888..1f0423100 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java @@ -307,7 +307,12 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain return new NukkitPlotGenerator(map); } catch (Throwable e) { System.out.println("Failed to create generator for " + name + " | " + gen); - e.printStackTrace(); + while (e.getCause() != null) { + e = e.getCause(); + } + synchronized (PS.class) { + e.printStackTrace(); + } } } return new NukkitHybridGen(map); diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/generator/NukkitPlotGenerator.java b/Nukkit/src/main/java/com/plotsquared/nukkit/generator/NukkitPlotGenerator.java index 931b568d5..a59ff0a67 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/generator/NukkitPlotGenerator.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/generator/NukkitPlotGenerator.java @@ -21,16 +21,16 @@ import com.plotsquared.nukkit.util.block.NukkitWrappedChunk; import java.util.Map; public class NukkitPlotGenerator extends Generator implements GeneratorWrapper { - - private final PseudoRandom random = new PseudoRandom(); - private final IndependentPlotGenerator plotGenerator; - private final Generator platformGenerator; - private final boolean full; - private final String world; - private final Map settings; - private boolean loaded = false; - private cn.nukkit.level.ChunkManager chunkManager; - private final NukkitWrappedChunk chunkSetter; + + protected final PseudoRandom random = new PseudoRandom(); + protected final IndependentPlotGenerator plotGenerator; + protected final Generator platformGenerator; + protected final boolean full; + protected final String world; + protected final Map settings; + protected boolean loaded = false; + protected cn.nukkit.level.ChunkManager chunkManager; + protected final NukkitWrappedChunk chunkSetter; public NukkitPlotGenerator(Map map) { if (map == null) { @@ -86,7 +86,6 @@ public class NukkitPlotGenerator extends Generator implements GeneratorWrapper