Browse Source

Try-catch surrounding respawn code.

master
MagicBot 1 year ago
parent
commit
350a1208f5
  1. 15
      src/engine/mobileAI/Threads/MobRespawnThread.java

15
src/engine/mobileAI/Threads/MobRespawnThread.java

@ -45,17 +45,28 @@ public class MobRespawnThread implements Runnable {
@Override @Override
public void run() { public void run() {
while(true) {
while (true) {
try {
for (Zone zone : ZoneManager.getAllZones()) { for (Zone zone : ZoneManager.getAllZones()) {
if (zone.respawnQue.isEmpty() == false && zone.lastRespawn + 100 < System.currentTimeMillis()) { if (zone.respawnQue.isEmpty() == false && zone.lastRespawn + 100 < System.currentTimeMillis()) {
if (zone.respawnQue.iterator().next() != null) {
Mob respawner = zone.respawnQue.iterator().next(); Mob respawner = zone.respawnQue.iterator().next();
if (respawner == null)
continue;
respawner.respawn(); respawner.respawn();
zone.respawnQue.remove(respawner); zone.respawnQue.remove(respawner);
zone.lastRespawn = System.currentTimeMillis(); zone.lastRespawn = System.currentTimeMillis();
} }
} }
} catch (Exception e) {
Logger.error(e);
} }
} }
} }
public static void startRespawnThread() { public static void startRespawnThread() {

Loading…
Cancel
Save