Skip to content

Commit

Permalink
Catch and log exceptions during chunk-load on players joining.
Browse files Browse the repository at this point in the history
  • Loading branch information
asofold committed Nov 23, 2014
1 parent 0561638 commit 43b33ed
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -5,6 +5,8 @@
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;

import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.logging.Streams;
import fr.neatmonster.nocheatplus.utilities.ds.CoordMap;

/**
Expand Down Expand Up @@ -50,8 +52,14 @@ public static int ensureChunksLoaded(final World world, final double x, final do
for (int cx = minX; cx <= maxX; cx ++) {
for (int cz = minZ; cz <= maxZ; cz ++) {
if (!world.isChunkLoaded(cx, cz)) {
world.loadChunk(cx, cz);
loaded ++;
try {
world.loadChunk(cx, cz);
loaded ++;
} catch (Exception ex) {
// (Can't seem to catch more precisely: TileEntity with CB 1.7.10)
NCPAPIProvider.getNoCheatPlusAPI().getLogManager().severe(Streams.STATUS, "Failed to load chunk at " + (cx * 16) + "," + (cz * 16) + " (real coordinates):\n" + StringUtil.throwableToString(ex));
// (Don't count as loaded.)
}
}
}
}
Expand Down

0 comments on commit 43b33ed

Please sign in to comment.