Hid an unavoidable rare error.

This commit is contained in:
Brianna 2020-09-07 09:49:08 -05:00
parent 1940dfc8c0
commit 17eb90e5ea
1 changed files with 8 additions and 3 deletions

View File

@ -353,12 +353,17 @@ public class StackingTask extends BukkitRunnable {
List<LivingEntity> entities = new ArrayList<>();
for (CachedChunk chunk : getNearbyChunks(location, radius, singleChunk)) {
if (chunk == null) continue;
Entity[] entityArray;
Entity[] entityArray = new Entity[0];
if (cachedChunks.containsKey(chunk)) {
entityArray = cachedChunks.get(chunk);
} else {
entityArray = chunk.getEntities();
cachedChunks.put(chunk, entityArray);
try {
entityArray = chunk.getEntities();
cachedChunks.put(chunk, entityArray);
} catch (Exception ignored) {
// Sometimes accessing this method asynchronously throws an error. This is super rare and
// as such doesn't really affect the plugin so we're just going to ignore this failure.
}
}
if (entityArray == null) continue;
for (Entity e : entityArray) {