possible NPE fix and add useful debug if it fails

This commit is contained in:
dordsor21 2019-01-17 22:34:28 +00:00
parent d846bc7a2e
commit 330ab83ece

View File

@ -151,7 +151,9 @@ public class BukkitHybridUtils extends HybridUtils {
continue;
}
int y = MainUtil.y_loc[i][j];
oldBlocks[y][x][z] = result[i][j];
oldBlocks[y][x][z] = result[i][j] != null ?
result[i][j] :
BlockBucket.withSingle(StringPlotBlock.EVERYTHING);
}
}
@ -169,6 +171,10 @@ public class BukkitHybridUtils extends HybridUtils {
HashSet<PlotBlock> types = new HashSet<>();
for (int y = 0; y < 256; y++) {
BlockBucket old = oldBlocks[y][x][z];
try {
if (old == null) {
old = BlockBucket.withSingle(StringPlotBlock.EVERYTHING);
}
PlotBlock now = newBlocks[y][x][z];
if (!old.getBlocks().contains(now)) {
changes[i]++;
@ -211,6 +217,13 @@ public class BukkitHybridUtils extends HybridUtils {
}
types.add(now);
}
} catch (NullPointerException e) {
PlotSquared.log(old.toString());
PlotSquared.log(x);
PlotSquared.log(y);
PlotSquared.log(z);
e.printStackTrace();
}
}
variety[i] = types.size();
i++;