mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 12:25:46 +01:00
feat: improve handling of null issues in plot analysis (#3867)
This commit is contained in:
parent
6baf339ecb
commit
c1543f034c
@ -234,8 +234,19 @@ public class HybridUtils {
|
||||
Set<BlockType> types = new HashSet<>();
|
||||
for (int yIndex = 0; yIndex < height; yIndex++) {
|
||||
BlockState old = oldBlocks[yIndex][x][z]; // Nullable
|
||||
try {
|
||||
BlockState now = newBlocks[yIndex][x][z]; // Not null
|
||||
if (now == null) {
|
||||
throw new NullPointerException(String.format(
|
||||
"\"now\" block null attempting to perform plot analysis. Indexes: x=%d of %d, yIndex=%d" +
|
||||
" of %d, z=%d of %d",
|
||||
x,
|
||||
width,
|
||||
yIndex,
|
||||
height,
|
||||
z,
|
||||
length
|
||||
));
|
||||
}
|
||||
if (!now.equals(old) && !(old == null && now.getBlockType().equals(BlockTypes.AIR))) {
|
||||
changes[i]++;
|
||||
}
|
||||
@ -270,9 +281,6 @@ public class HybridUtils {
|
||||
}
|
||||
types.add(now.getBlockType());
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
variety[i] = types.size();
|
||||
i++;
|
||||
|
Loading…
Reference in New Issue
Block a user