diff --git a/src/main/java/org/maxgamer/quickshop/QuickShop.java b/src/main/java/org/maxgamer/quickshop/QuickShop.java index 029a42e12..3b4b3f954 100644 --- a/src/main/java/org/maxgamer/quickshop/QuickShop.java +++ b/src/main/java/org/maxgamer/quickshop/QuickShop.java @@ -519,7 +519,7 @@ public class QuickShop extends JavaPlugin { runtimeCheck(EnvCheckEntry.Stage.ON_LOAD); getLogger().info("Reading the configuration..."); this.initConfiguration(); - QuickShopAPI.setupApi(this); + QuickShopAPI._internal_access_only_setupApi(this); //noinspection ResultOfMethodCallIgnored getDataFolder().mkdirs(); this.bootError = null; @@ -673,7 +673,7 @@ public class QuickShop extends JavaPlugin { getLogger().info("Starting plugin self-test, please wait..."); runtimeCheck(EnvCheckEntry.Stage.ON_ENABLE); - QuickShopAPI.setupApi(this); + QuickShopAPI._internal_access_only_setupApi(this); getLogger().info("Reading the configuration..."); this.initConfiguration(); diff --git a/src/main/java/org/maxgamer/quickshop/api/QuickShopAPI.java b/src/main/java/org/maxgamer/quickshop/api/QuickShopAPI.java index c83db70ac..42158651f 100644 --- a/src/main/java/org/maxgamer/quickshop/api/QuickShopAPI.java +++ b/src/main/java/org/maxgamer/quickshop/api/QuickShopAPI.java @@ -33,17 +33,11 @@ public class QuickShopAPI { private static ShopAPI shopAPI; private static DisplayItemAPI displayItemAPI; - /** - * DO NOT CALL ME, IT JUST A INTERNAL METHOD, BUT BECAUSE CROSS-PACKAGE ACCESS, IT IS PUBLIC, SO DO NOT EXECUTE IT. - * Go away =w= - * - * @param doNotUseThisMethodInYourPlugin_ItOnlyCanBeAccessByQuickShopInternally The QuickShop plugin instance - */ - public static void setupApi(@NotNull JavaPlugin doNotUseThisMethodInYourPlugin_ItOnlyCanBeAccessByQuickShopInternally) { - if (!(doNotUseThisMethodInYourPlugin_ItOnlyCanBeAccessByQuickShopInternally instanceof QuickShop)) { + public static void _internal_access_only_setupApi(@NotNull JavaPlugin quickshop) { + if (!(quickshop instanceof QuickShop)) { throw new IllegalArgumentException("You can't setup API, it should only access by QuickShop internal calling."); } - plugin = (QuickShop) doNotUseThisMethodInYourPlugin_ItOnlyCanBeAccessByQuickShopInternally; + plugin = (QuickShop) quickshop; shopAPI = new ShopAPI(plugin); displayItemAPI = new DisplayItemAPI(plugin); } diff --git a/src/main/java/org/maxgamer/quickshop/util/reporter/error/RollbarErrorReporter.java b/src/main/java/org/maxgamer/quickshop/util/reporter/error/RollbarErrorReporter.java index 6f64b3dc0..238e36dc1 100644 --- a/src/main/java/org/maxgamer/quickshop/util/reporter/error/RollbarErrorReporter.java +++ b/src/main/java/org/maxgamer/quickshop/util/reporter/error/RollbarErrorReporter.java @@ -171,10 +171,14 @@ public class RollbarErrorReporter { plugin .getLogger() .warning( - "A exception was thrown, QuickShop already caught this exception and reported it, switch to debug mode to see the full errors."); + "A exception was thrown, QuickShop already caught this exception and reported it. This error will only shown once before next restart."); plugin.getLogger().warning("====QuickShop Error Report BEGIN==="); plugin.getLogger().warning("Description: " + throwable.getMessage()); plugin.getLogger().warning("Server ID: " + plugin.getServerUniqueID()); + plugin.getLogger().warning("Exception : "); + ignoreThrows(); + throwable.printStackTrace(); + resetIgnores(); plugin.getLogger().warning("====QuickShop Error Report E N D==="); Util.debugLog(throwable.getMessage()); Arrays.stream(throwable.getStackTrace()).forEach(a -> Util.debugLog(a.getClassName() + "." + a.getMethodName() + ":" + a.getLineNumber())); @@ -370,10 +374,12 @@ public class RollbarErrorReporter { sendError(record.getThrown(), record.getMessage()); PossiblyLevel possiblyLevel = checkWasCauseByQS(record.getThrown()); if (possiblyLevel == PossiblyLevel.IMPOSSIBLE) - return false; - if (possiblyLevel == PossiblyLevel.MAYBE) + return true; + if (possiblyLevel == PossiblyLevel.MAYBE) { plugin.getLogger().warning("This seems not a QuickShop but we still sent this error to QuickShop developers. If you have any question, you should ask QuickShop developer."); - return true; + return true; + } + return false; } } @@ -417,10 +423,12 @@ public class RollbarErrorReporter { sendError(record.getThrown(), record.getMessage()); PossiblyLevel possiblyLevel = checkWasCauseByQS(record.getThrown()); if (possiblyLevel == PossiblyLevel.IMPOSSIBLE) - return false; - if (possiblyLevel == PossiblyLevel.MAYBE) + return true; + if (possiblyLevel == PossiblyLevel.MAYBE) { plugin.getLogger().warning("This seems not a QuickShop but we still sent this error to QuickShop developers. If you have any question, you should ask QuickShop developer."); - return true; + return true; + } + return false; } }