mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Fix regen. Fixes #2692
This commit is contained in:
parent
6be26e8047
commit
b99631f1bd
@ -646,7 +646,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
return new BukkitPlotGenerator(world, gen);
|
||||
} else {
|
||||
return new BukkitPlotGenerator(PlotSquared.get().IMP.getDefaultGenerator());
|
||||
return new BukkitPlotGenerator(world, PlotSquared.get().IMP.getDefaultGenerator());
|
||||
}
|
||||
}
|
||||
|
||||
@ -802,7 +802,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
|
||||
@Override public GeneratorWrapper<?> wrapPlotGenerator(@Nullable final String world,
|
||||
@NonNull final IndependentPlotGenerator generator) {
|
||||
return new BukkitPlotGenerator(generator);
|
||||
return new BukkitPlotGenerator(world, generator);
|
||||
}
|
||||
|
||||
@Override public List<Map.Entry<Map.Entry<String, String>, Boolean>> getPluginIds() {
|
||||
|
@ -12,6 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
@ -34,10 +35,13 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
private List<BlockPopulator> populators;
|
||||
private boolean loaded = false;
|
||||
|
||||
public BukkitPlotGenerator(IndependentPlotGenerator generator) {
|
||||
@Getter private final String levelName;
|
||||
|
||||
public BukkitPlotGenerator(String name, IndependentPlotGenerator generator) {
|
||||
if (generator == null) {
|
||||
throw new IllegalArgumentException("Generator may not be null!");
|
||||
}
|
||||
this.levelName = name;
|
||||
this.plotGenerator = generator;
|
||||
this.platformGenerator = this;
|
||||
this.populators = new ArrayList<>();
|
||||
@ -51,6 +55,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
throw new IllegalArgumentException("ChunkGenerator: " + cg.getClass().getName()
|
||||
+ " is already a BukkitPlotGenerator!");
|
||||
}
|
||||
this.levelName = world;
|
||||
this.full = false;
|
||||
this.platformGenerator = cg;
|
||||
this.plotGenerator = new DelegatePlotGenerator(cg, world);
|
||||
@ -172,6 +177,10 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
return;
|
||||
}
|
||||
PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null);
|
||||
if (area == null && (area = PlotSquared.get().getPlotArea(this.levelName, null)) == null) {
|
||||
throw new IllegalStateException("Cannot regenerate chunk that does not belong to a plot area."
|
||||
+ " Location: " + loc + ", world: " + world);
|
||||
}
|
||||
try {
|
||||
this.plotGenerator.generateChunk(result, area);
|
||||
} catch (Throwable e) {
|
||||
|
@ -7,8 +7,10 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class HybridGen extends IndependentPlotGenerator {
|
||||
|
||||
@ -34,7 +36,10 @@ public class HybridGen extends IndependentPlotGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void generateChunk(ScopedLocalBlockQueue result, PlotArea settings) {
|
||||
@Override public void generateChunk(@NotNull ScopedLocalBlockQueue result, @NotNull PlotArea settings) {
|
||||
Preconditions.checkNotNull(result, "result cannot be null");
|
||||
Preconditions.checkNotNull(settings, "settings cannot be null");
|
||||
|
||||
HybridPlotWorld hpw = (HybridPlotWorld) settings;
|
||||
// Biome
|
||||
result.fillBiome(hpw.PLOT_BIOME);
|
||||
|
Loading…
Reference in New Issue
Block a user