From badb5e5e1ee387cae1daea2ac4aa4cb31d221b07 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 6 Apr 2023 17:30:18 +0200 Subject: [PATCH] Stop the dog --- .../steamwar/bungeecore/util/SchematicSearch.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/de/steamwar/bungeecore/util/SchematicSearch.java b/src/de/steamwar/bungeecore/util/SchematicSearch.java index 9f9fbd95..c9d8c85a 100644 --- a/src/de/steamwar/bungeecore/util/SchematicSearch.java +++ b/src/de/steamwar/bungeecore/util/SchematicSearch.java @@ -36,14 +36,15 @@ public class SchematicSearch { private static void startQueueWatchdog() { watchdog = BungeeCore.get().getProxy().getScheduler().schedule(BungeeCore.get(), () -> { synchronized (searchQueue) { + if(searchQueue.isEmpty()) { + watchdog.cancel(); + watchdog = null; + return; + } + if(currentSearch == null) { - if(!searchQueue.isEmpty()) { - currentSearch = searchQueue.remove(0); - currentSearch.start(); - } else { - watchdog.cancel(); - watchdog = null; - } + currentSearch = searchQueue.remove(0); + currentSearch.start(); } } }, 0, 1, TimeUnit.SECONDS);