From 56e0fd8430ebad0b4d31b6f4a8ab42db38261294 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Wed, 21 Oct 2015 14:20:06 +0800 Subject: [PATCH] catch all error and exception while load magic lib... Signed-off-by: 502647092 --- .../java/org/maxgamer/QuickShop/Config/ConfigManager.java | 2 +- src/main/java/org/maxgamer/QuickShop/QuickShop.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/maxgamer/QuickShop/Config/ConfigManager.java b/src/main/java/org/maxgamer/QuickShop/Config/ConfigManager.java index a64d0a8..b7cb316 100644 --- a/src/main/java/org/maxgamer/QuickShop/Config/ConfigManager.java +++ b/src/main/java/org/maxgamer/QuickShop/Config/ConfigManager.java @@ -90,7 +90,7 @@ public class ConfigManager { fm.toJSONString(); plugin.getLogger().info("魔改库功能测试正常..."); this.enableMagicLib = true; - } catch (final NoClassDefFoundError | NoSuchMethodError | Exception e) { + } catch (final Error | Exception e) { plugin.getLogger().warning("+========================================="); plugin.getLogger().warning("| 警告: 启动魔改库失败 将使用GUI商店界面..."); plugin.getLogger().warning("+========================================="); diff --git a/src/main/java/org/maxgamer/QuickShop/QuickShop.java b/src/main/java/org/maxgamer/QuickShop/QuickShop.java index 806a992..ca5f74d 100644 --- a/src/main/java/org/maxgamer/QuickShop/QuickShop.java +++ b/src/main/java/org/maxgamer/QuickShop/QuickShop.java @@ -180,9 +180,13 @@ public class QuickShop extends JavaPlugin { logWatcher.close(); // Closes the file } /* Remove all display items, and any dupes we can find */ - shopManager.clear(); + if (shopManager != null) { + shopManager.clear(); + } /* Empty the buffer */ - database.close(); + if (database != null) { + database.close(); + } try { this.database.getConnection().close(); } catch (final SQLException e) {