From 81dbcc691a2f8d02fcc0cd19f3da36b74334a208 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 6 Apr 2023 17:07:16 +0200 Subject: [PATCH] Add Softreload cancel --- src/de/steamwar/bungeecore/BungeeCore.java | 2 ++ src/de/steamwar/bungeecore/util/SchematicSearch.java | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index e08e4610..0076c065 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -28,6 +28,7 @@ import de.steamwar.bungeecore.listeners.ping.PingListener; import de.steamwar.bungeecore.network.BungeeNetworkHandler; import de.steamwar.bungeecore.network.NetworkReceiver; import de.steamwar.bungeecore.network.SWScriptSyntaxForwarder; +import de.steamwar.bungeecore.util.SchematicSearch; import de.steamwar.sql.Punishment; import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.UserElo; @@ -235,6 +236,7 @@ public class BungeeCore extends Plugin { tablistManager.disable(); errorLogger.unregister(); Statement.closeAll(); + SchematicSearch.abortAll(); } public static BungeeCore get() { diff --git a/src/de/steamwar/bungeecore/util/SchematicSearch.java b/src/de/steamwar/bungeecore/util/SchematicSearch.java index 0f467534..2dd1e405 100644 --- a/src/de/steamwar/bungeecore/util/SchematicSearch.java +++ b/src/de/steamwar/bungeecore/util/SchematicSearch.java @@ -65,6 +65,15 @@ public class SchematicSearch { } } + public static void abortAll() { + synchronized (searchQueue) { + searchQueue.clear(); + } + if(currentSearch != null) { + currentSearch.end(); + } + } + private static List constructArguments(SteamwarUser user, File pattern) { return Arrays.asList(searchBinary, "-T", "1", "-s", "-u", String.valueOf(user.getId()), "-o", "json:std", "-m", "50", pattern.getAbsolutePath()); }