From 5b4530f8276ac77d33b255d303fff469c39e8d92 Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Wed, 28 Jul 2021 13:15:08 +0800 Subject: [PATCH] Fixed #1351, Try search the quickshop jar if old jar not found --- .../java/org/maxgamer/quickshop/QuickShop.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/org/maxgamer/quickshop/QuickShop.java b/src/main/java/org/maxgamer/quickshop/QuickShop.java index d7eed103d..a7732cc7f 100644 --- a/src/main/java/org/maxgamer/quickshop/QuickShop.java +++ b/src/main/java/org/maxgamer/quickshop/QuickShop.java @@ -672,6 +672,22 @@ public class QuickShop extends JavaPlugin { throw new IllegalStateException("Failed to reload QuickShop! Please consider restarting the server. (Plugin was updated)"); } } + // Maybe name changed, try search globally + if (!file.exists()) { + File pluginFolder = new File("plugins"); + if (pluginFolder.isDirectory()) { + //noinspection ConstantConditions + for (File listFile : pluginFolder.listFiles()) { + if (listFile.getName().endsWith(".jar")) { + if (getPluginLoader().loadPlugin(listFile).getName().equals(getDescription().getName())) { + file = listFile; + break; + } + } + } + } + } + if (!file.exists()) { throw new IllegalStateException("Failed to reload QuickShop! Please consider restarting the server. (Failed to find plugin jar)"); }