From 5656a4885ac354da2ac472b426ffb5bd036bf1c2 Mon Sep 17 00:00:00 2001 From: Brianna Date: Wed, 9 Sep 2020 13:15:23 -0500 Subject: [PATCH] Let's hide yet another error. --- .../songoda/ultimatestacker/tasks/StackingTask.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/songoda/ultimatestacker/tasks/StackingTask.java b/src/main/java/com/songoda/ultimatestacker/tasks/StackingTask.java index 3a87c30..c844ef0 100644 --- a/src/main/java/com/songoda/ultimatestacker/tasks/StackingTask.java +++ b/src/main/java/com/songoda/ultimatestacker/tasks/StackingTask.java @@ -70,10 +70,18 @@ public class StackingTask extends BukkitRunnable { // Loop through each world. for (World world : Bukkit.getWorlds()) { // If world is disabled then continue to the next world. + if (isWorldDisabled(world)) continue; // Get the loaded entities from the current world and reverse them. - List entities = new ArrayList<>(world.getEntities()); + List entities; + try { + entities = new ArrayList<>(world.getEntities()); + } catch (Exception ignored) { + continue; + // 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. + } Collections.reverse(entities); // Loop through the entities.