mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-25 09:59:49 -05:00
tweaks RollbarErrorReporter
This commit is contained in:
1 parent
b4a86ba7ed
commit
672d77182e
3 files changed
+20
-18
No files matched your search
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user