Remove the debug and don't created a new BloxkBucket for every air block.

This commit is contained in:
dordsor21 2019-02-02 16:13:55 +00:00
parent 8ac9b862f8
commit 9c90928d07

View File

@ -66,6 +66,7 @@ public class BukkitHybridUtils extends HybridUtils {
System.gc(); System.gc();
final BlockBucket[][][] oldBlocks = new BlockBucket[256][width][length]; final BlockBucket[][][] oldBlocks = new BlockBucket[256][width][length];
final PlotBlock[][][] newBlocks = new PlotBlock[256][width][length]; final PlotBlock[][][] newBlocks = new PlotBlock[256][width][length];
final BlockBucket airBucket = BlockBucket.withSingle(StringPlotBlock.EVERYTHING);
PlotArea area = PlotSquared.get().getPlotArea(world, null); PlotArea area = PlotSquared.get().getPlotArea(world, null);
@ -146,8 +147,8 @@ public class BukkitHybridUtils extends HybridUtils {
continue; continue;
} }
int y = MainUtil.y_loc[i][j]; int y = MainUtil.y_loc[i][j];
oldBlocks[y][x][z] = oldBlocks[y][x][z] = airBucket;
BlockBucket.withSingle(StringPlotBlock.EVERYTHING);
} }
continue; continue;
} }
@ -163,7 +164,7 @@ public class BukkitHybridUtils extends HybridUtils {
int y = MainUtil.y_loc[i][j]; int y = MainUtil.y_loc[i][j];
oldBlocks[y][x][z] = result[i][j] != null ? oldBlocks[y][x][z] = result[i][j] != null ?
result[i][j] : result[i][j] :
BlockBucket.withSingle(StringPlotBlock.EVERYTHING); airBucket;
} }
} }
@ -183,7 +184,7 @@ public class BukkitHybridUtils extends HybridUtils {
BlockBucket old = oldBlocks[y][x][z]; BlockBucket old = oldBlocks[y][x][z];
try { try {
if (old == null) { if (old == null) {
old = BlockBucket.withSingle(StringPlotBlock.EVERYTHING); old = airBucket;
} }
PlotBlock now = newBlocks[y][x][z]; PlotBlock now = newBlocks[y][x][z];
if (!old.getBlocks().contains(now)) { if (!old.getBlocks().contains(now)) {
@ -228,10 +229,6 @@ public class BukkitHybridUtils extends HybridUtils {
types.add(now); types.add(now);
} }
} catch (NullPointerException e) { } catch (NullPointerException e) {
PlotSquared.log(old != null ? old.toString() : "old null");
PlotSquared.log(x);
PlotSquared.log(y);
PlotSquared.log(z);
e.printStackTrace(); e.printStackTrace();
} }
} }