mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Safer generation of the BlockBucketChunk
This commit is contained in:
parent
ca883c211a
commit
0609b3d7f6
@ -74,6 +74,10 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
HybridPlotWorld hpw = (HybridPlotWorld) area;
|
||||
final BlockBucket[][] result = hpw.getBlockBucketChunk();
|
||||
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hpw.PLOT_SCHEMATIC) {
|
||||
short[] rx = new short[16];
|
||||
short[] rz = new short[16];
|
||||
@ -218,7 +222,7 @@ public class BukkitHybridUtils extends HybridUtils {
|
||||
types.add(now);
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
PlotSquared.log(old.toString());
|
||||
PlotSquared.log(old != null ? old.toString() : "old null");
|
||||
PlotSquared.log(x);
|
||||
PlotSquared.log(y);
|
||||
PlotSquared.log(z);
|
||||
|
@ -14,7 +14,6 @@ import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.area.QuadMap;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||
import lombok.Getter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@ -35,7 +34,7 @@ public abstract class PlotArea {
|
||||
private final PlotId min;
|
||||
private final PlotId max;
|
||||
private final IndependentPlotGenerator generator;
|
||||
@Getter private final BlockBucket[][] blockBucketChunk;
|
||||
private final BlockBucket[][] blockBucketChunk;
|
||||
public int MAX_PLOT_MEMBERS = 128;
|
||||
public boolean AUTO_MERGE = false;
|
||||
public boolean ALLOW_SIGNS = true;
|
||||
@ -87,7 +86,7 @@ public abstract class PlotArea {
|
||||
this.max = max;
|
||||
}
|
||||
this.worldhash = worldName.hashCode();
|
||||
if (Settings.Enabled_Components.PLOT_EXPIRY) {
|
||||
if (Settings.Enabled_Components.PLOT_EXPIRY && generator != null) {
|
||||
blockBucketChunk = generator.generateBlockBucketChunk(this);
|
||||
} else {
|
||||
blockBucketChunk = null;
|
||||
@ -113,6 +112,21 @@ public abstract class PlotArea {
|
||||
return GlobalBlockQueue.IMP.getNewQueue(worldname, autoQueue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of BlockBuckets corresponding to a chunk of a plot
|
||||
*
|
||||
* @return BlockBucket[][]
|
||||
*/
|
||||
public BlockBucket[][] getBlockBucketChunk() {
|
||||
if (blockBucketChunk != null) {
|
||||
return blockBucketChunk;
|
||||
}
|
||||
if (generator != null) {
|
||||
return generator.generateBlockBucketChunk(this);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the region for this PlotArea or a RegionWrapper encompassing
|
||||
* the whole world if none exists.
|
||||
|
Loading…
Reference in New Issue
Block a user