From 350a1208f561736ffed0aae633d891cbe4f9d644 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 2 Aug 2023 08:07:41 -0400 Subject: [PATCH] Try-catch surrounding respawn code. --- .../mobileAI/Threads/MobRespawnThread.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/engine/mobileAI/Threads/MobRespawnThread.java b/src/engine/mobileAI/Threads/MobRespawnThread.java index 2e9beb49..10b62364 100644 --- a/src/engine/mobileAI/Threads/MobRespawnThread.java +++ b/src/engine/mobileAI/Threads/MobRespawnThread.java @@ -45,17 +45,28 @@ public class MobRespawnThread implements Runnable { @Override public void run() { - while(true) { - for (Zone zone : ZoneManager.getAllZones()) { - if (zone.respawnQue.isEmpty() == false && zone.lastRespawn + 100 < System.currentTimeMillis()) { - if (zone.respawnQue.iterator().next() != null) { + + while (true) { + + try { + for (Zone zone : ZoneManager.getAllZones()) { + + if (zone.respawnQue.isEmpty() == false && zone.lastRespawn + 100 < System.currentTimeMillis()) { + Mob respawner = zone.respawnQue.iterator().next(); + + if (respawner == null) + continue; + respawner.respawn(); zone.respawnQue.remove(respawner); zone.lastRespawn = System.currentTimeMillis(); } } + } catch (Exception e) { + Logger.error(e); } + } } public static void startRespawnThread() {