Clean up PlotAreaManager and move a bunch of plot area related logic out of PlotSquared

This commit is contained in:
Alexander Söderberg
2020-07-07 13:37:03 +02:00
parent d76c9dad52
commit 196df855ac
40 changed files with 288 additions and 241 deletions

View File

@ -54,7 +54,10 @@ final class BlockStatePopulator extends BlockPopulator {
if (this.queue == null) {
this.queue = GlobalBlockQueue.IMP.getNewQueue(world.getName(), false);
}
final PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null);
final PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotArea(world.getName(), null);
if (area == null) {
return;
}
final ChunkWrapper wrap =
new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ());
final ScopedLocalBlockQueue chunk = this.queue.getForChunk(wrap.x, wrap.z);

View File

@ -108,7 +108,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
if (!this.loaded) {
String name = world.getName();
PlotSquared.get().loadWorld(name, this);
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(name);
final Set<PlotArea> areas = PlotSquared.get().getPlotAreaManager().getPlotAreasSet(name);
if (!areas.isEmpty()) {
PlotArea area = areas.iterator().next();
if (!area.isMobSpawning()) {
@ -198,8 +198,8 @@ public class BukkitPlotGenerator extends ChunkGenerator
if (ChunkManager.preProcessChunk(loc, result)) {
return;
}
PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null);
if (area == null && (area = PlotSquared.get().getPlotArea(this.levelName, null)) == null) {
PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotArea(world.getName(), null);
if (area == null && (area = PlotSquared.get().getPlotAreaManager().getPlotArea(this.levelName, null)) == null) {
throw new IllegalStateException(
"Cannot regenerate chunk that does not belong to a plot area." + " Location: " + loc
+ ", world: " + world);