Fix nukkit augmented generator

This commit is contained in:
Jesse Boyd 2018-07-27 13:25:46 +10:00
parent 2d98da47cf
commit 645c5fb529
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
5 changed files with 28 additions and 16 deletions

View File

@ -486,7 +486,7 @@ public class PS{
HashMap<PlotId, Plot> 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<Entry<PlotId, Plot>> iterator = plots.entrySet().iterator();
while (iterator.hasNext()) {
@ -507,7 +507,7 @@ public class PS{
Set<PlotCluster> 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<PlotCluster> iterator = clusters.iterator();
while (iterator.hasNext()) {

View File

@ -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":

View File

@ -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);

View File

@ -21,16 +21,16 @@ import com.plotsquared.nukkit.util.block.NukkitWrappedChunk;
import java.util.Map;
public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<Generator> {
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<String, Object> 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<String, Object> settings;
protected boolean loaded = false;
protected cn.nukkit.level.ChunkManager chunkManager;
protected final NukkitWrappedChunk chunkSetter;
public NukkitPlotGenerator(Map<String, Object> map) {
if (map == null) {
@ -86,7 +86,6 @@ public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<G
this.full = true;
chunkSetter = new NukkitWrappedChunk(world, null);
}
PS.get().loadWorld(world, this);
}
@Override
@ -136,6 +135,9 @@ public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<G
@Override
public void init(cn.nukkit.level.ChunkManager chunkManager, NukkitRandom nukkitRandom) {
if (this.chunkManager == null) {
PS.get().loadWorld(world, this);
}
this.chunkManager = chunkManager;
if (getPlatformGenerator() != this) {
getPlatformGenerator().init(chunkManager, nukkitRandom);

View File

@ -19,7 +19,7 @@ public class NukkitChunkManager extends ChunkManager {
@Override
public boolean loadChunk(String world, ChunkLoc loc, boolean force) {
return false;
return true;
}
@Override