Fixed #1351, Try search the quickshop jar if old jar not found

This commit is contained in:
Ghost_chu committed 2021-07-28 13:15:08 +08:00
1 parent 91fed0a35a
commit 5b4530f827
1 file changed
+16
@@ -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)");
}