mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-02 18:33:42 +01:00 
			
		
		
		
	Fix nukkit augmented generator
This commit is contained in:
		@@ -486,7 +486,7 @@ public class PS{
 | 
				
			|||||||
        HashMap<PlotId, Plot> plots;
 | 
					        HashMap<PlotId, Plot> plots;
 | 
				
			||||||
        if (plots_tmp == null || (plots = plots_tmp.remove(plotArea.toString())) == null) {
 | 
					        if (plots_tmp == null || (plots = plots_tmp.remove(plotArea.toString())) == null) {
 | 
				
			||||||
            if (plotArea.TYPE == 2) {
 | 
					            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) {
 | 
					                if (plots != null) {
 | 
				
			||||||
                    Iterator<Entry<PlotId, Plot>> iterator = plots.entrySet().iterator();
 | 
					                    Iterator<Entry<PlotId, Plot>> iterator = plots.entrySet().iterator();
 | 
				
			||||||
                    while (iterator.hasNext()) {
 | 
					                    while (iterator.hasNext()) {
 | 
				
			||||||
@@ -507,7 +507,7 @@ public class PS{
 | 
				
			|||||||
        Set<PlotCluster> clusters;
 | 
					        Set<PlotCluster> clusters;
 | 
				
			||||||
        if (clusters_tmp == null || (clusters = clusters_tmp.remove(plotArea.toString())) == null) {
 | 
					        if (clusters_tmp == null || (clusters = clusters_tmp.remove(plotArea.toString())) == null) {
 | 
				
			||||||
            if (plotArea.TYPE == 2) {
 | 
					            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) {
 | 
					                if (clusters != null) {
 | 
				
			||||||
                    Iterator<PlotCluster> iterator = clusters.iterator();
 | 
					                    Iterator<PlotCluster> iterator = clusters.iterator();
 | 
				
			||||||
                    while (iterator.hasNext()) {
 | 
					                    while (iterator.hasNext()) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -414,7 +414,12 @@ public class Area extends SubCommand {
 | 
				
			|||||||
                    public void run(ChunkLoc value) {
 | 
					                    public void run(ChunkLoc value) {
 | 
				
			||||||
                        AugmentedUtils.generate(area.worldname, value.x, value.z, null);
 | 
					                        AugmentedUtils.generate(area.worldname, value.x, value.z, null);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }, null);
 | 
					                }, new Runnable() {
 | 
				
			||||||
 | 
					                    @Override
 | 
				
			||||||
 | 
					                    public void run() {
 | 
				
			||||||
 | 
					                        player.sendMessage("Regen complete");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            case "goto":
 | 
					            case "goto":
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -307,9 +307,14 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
 | 
				
			|||||||
                return new NukkitPlotGenerator(map);
 | 
					                return new NukkitPlotGenerator(map);
 | 
				
			||||||
            } catch (Throwable e) {
 | 
					            } catch (Throwable e) {
 | 
				
			||||||
                System.out.println("Failed to create generator for " + name + " | " + gen);
 | 
					                System.out.println("Failed to create generator for " + name + " | " + gen);
 | 
				
			||||||
 | 
					                while (e.getCause() != null) {
 | 
				
			||||||
 | 
					                    e = e.getCause();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                synchronized (PS.class) {
 | 
				
			||||||
                    e.printStackTrace();
 | 
					                    e.printStackTrace();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return new NukkitHybridGen(map);
 | 
					        return new NukkitHybridGen(map);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,15 +22,15 @@ import java.util.Map;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<Generator> {
 | 
					public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<Generator> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final PseudoRandom random = new PseudoRandom();
 | 
					    protected final PseudoRandom random = new PseudoRandom();
 | 
				
			||||||
    private final IndependentPlotGenerator plotGenerator;
 | 
					    protected final IndependentPlotGenerator plotGenerator;
 | 
				
			||||||
    private final Generator platformGenerator;
 | 
					    protected final Generator platformGenerator;
 | 
				
			||||||
    private final boolean full;
 | 
					    protected final boolean full;
 | 
				
			||||||
    private final String world;
 | 
					    protected final String world;
 | 
				
			||||||
    private final Map<String, Object> settings;
 | 
					    protected final Map<String, Object> settings;
 | 
				
			||||||
    private boolean loaded = false;
 | 
					    protected boolean loaded = false;
 | 
				
			||||||
    private cn.nukkit.level.ChunkManager chunkManager;
 | 
					    protected cn.nukkit.level.ChunkManager chunkManager;
 | 
				
			||||||
    private final NukkitWrappedChunk chunkSetter;
 | 
					    protected final NukkitWrappedChunk chunkSetter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public NukkitPlotGenerator(Map<String, Object> map) {
 | 
					    public NukkitPlotGenerator(Map<String, Object> map) {
 | 
				
			||||||
        if (map == null) {
 | 
					        if (map == null) {
 | 
				
			||||||
@@ -86,7 +86,6 @@ public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<G
 | 
				
			|||||||
            this.full = true;
 | 
					            this.full = true;
 | 
				
			||||||
            chunkSetter = new NukkitWrappedChunk(world, null);
 | 
					            chunkSetter = new NukkitWrappedChunk(world, null);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        PS.get().loadWorld(world, this);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
@@ -136,6 +135,9 @@ public class NukkitPlotGenerator extends Generator implements GeneratorWrapper<G
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void init(cn.nukkit.level.ChunkManager chunkManager, NukkitRandom nukkitRandom) {
 | 
					    public void init(cn.nukkit.level.ChunkManager chunkManager, NukkitRandom nukkitRandom) {
 | 
				
			||||||
 | 
					        if (this.chunkManager == null) {
 | 
				
			||||||
 | 
					            PS.get().loadWorld(world, this);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        this.chunkManager = chunkManager;
 | 
					        this.chunkManager = chunkManager;
 | 
				
			||||||
        if (getPlatformGenerator() != this) {
 | 
					        if (getPlatformGenerator() != this) {
 | 
				
			||||||
            getPlatformGenerator().init(chunkManager, nukkitRandom);
 | 
					            getPlatformGenerator().init(chunkManager, nukkitRandom);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,7 @@ public class NukkitChunkManager extends ChunkManager {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean loadChunk(String world, ChunkLoc loc, boolean force) {
 | 
					    public boolean loadChunk(String world, ChunkLoc loc, boolean force) {
 | 
				
			||||||
        return false;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user