From b5fa30e1f32f9f77042bf1458fbd804cace83448 Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Mon, 30 Dec 2019 22:56:25 +0800 Subject: [PATCH] Fix a runtime exception Former-commit-id: a61aa3c4a886343f8a2d812fb4501486d3513efa --- src/main/java/org/maxgamer/quickshop/QuickShop.java | 6 +++--- .../org/maxgamer/quickshop/Util/SentryErrorReporter.java | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/QuickShop.java b/src/main/java/org/maxgamer/quickshop/QuickShop.java index 15aa1aea9..2140e72d2 100644 --- a/src/main/java/org/maxgamer/quickshop/QuickShop.java +++ b/src/main/java/org/maxgamer/quickshop/QuickShop.java @@ -450,13 +450,13 @@ public class QuickShop extends JavaPlugin { bukkitAPIWrapper = new PaperWrapper(); getLogger().info("Plugin now running under Paper mode."); default: //AUTO - try { - Bukkit.spigot().getSpigotConfig(); + if(Util.isClassAvailable("com.destroystokyo.paper.PaperConfig")){ bukkitAPIWrapper = new PaperWrapper(); getLogger().info("Plugin now running under Paper mode."); - }catch (Exception e){ + }else{ bukkitAPIWrapper = new SpigotWrapper(); getLogger().info("Plugin now running under Spigot mode. Paper performance profile is disabled, if you switch to Paper, we can use a lot paper api to improve the server performance."); + } } diff --git a/src/main/java/org/maxgamer/quickshop/Util/SentryErrorReporter.java b/src/main/java/org/maxgamer/quickshop/Util/SentryErrorReporter.java index ffcdd3690..c70c98a41 100644 --- a/src/main/java/org/maxgamer/quickshop/Util/SentryErrorReporter.java +++ b/src/main/java/org/maxgamer/quickshop/Util/SentryErrorReporter.java @@ -229,6 +229,9 @@ public class SentryErrorReporter { plugin.getLogger().warning("Event ID: " + this.context.getLastEventId()); plugin.getLogger().warning("Server ID: " + plugin.getServerUniqueID()); plugin.getLogger().warning("====QuickShop Error Report E N D==="); + if(Util.isDevMode()){ + throwable.printStackTrace(); + } return this.context.getLastEventId(); } catch (Throwable th) { th.printStackTrace();