mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-25 01:49:49 -05:00
Add stats for debugLogger, optimize debugLogger performance.
Former-commit-id: 7f87073d8d553d91b3202910f5b27020980c070b
This commit is contained in:
1 parent
299803d1fe
commit
c5a624b331
2 files changed
+7
-1
No files matched your search
@@ -681,6 +681,8 @@ public class QuickShop extends JavaPlugin {
|
||||
String useEnhanceDisplayProtect = String.valueOf(getConfig().getBoolean("shop.enchance-display-protect"));
|
||||
String useEnhanceShopProtect = String.valueOf(getConfig().getBoolean("shop.enchance-shop-protect"));
|
||||
String useOngoingFee = String.valueOf(getConfig().getBoolean("shop.ongoing-fee.enable"));
|
||||
String disableDebugLoggger = String.valueOf(getConfig().getBoolean("disable-debuglogger"));
|
||||
|
||||
// Version
|
||||
metrics.addCustomChart(new Metrics.SimplePie("server_version", () -> serverVer));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("bukkit_version", () -> bukkitVer));
|
||||
@@ -695,6 +697,7 @@ public class QuickShop extends JavaPlugin {
|
||||
metrics.addCustomChart(new Metrics.SimplePie("use_enhance_display_protect", () -> useEnhanceDisplayProtect));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("use_enhance_shop_protect", () -> useEnhanceShopProtect));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("use_ongoing_fee", () -> useOngoingFee));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("disable_background_debug_logger", ()->disableDebugLoggger));
|
||||
// Exp for stats, maybe i need improve this, so i add this.
|
||||
metrics.submitData(); // Submit now!
|
||||
getLogger().info("Metrics submitted.");
|
||||
|
||||
@@ -67,6 +67,7 @@ public class Util {
|
||||
private static EnumSet<Material> shoppables = EnumSet.noneOf(Material.class);
|
||||
private static Field tpsField;
|
||||
private static List<String> worldBlacklist = new ArrayList<>();
|
||||
private static boolean disableDebugLogger;
|
||||
|
||||
/**
|
||||
* Convert strArray to String.
|
||||
@@ -193,7 +194,7 @@ public class Util {
|
||||
*/
|
||||
public static void debugLog(@NotNull String... logs) {
|
||||
if (!devMode) {
|
||||
if (QuickShop.instance.getConfig().getBoolean("disable-debuglogger", false)) {
|
||||
if (disableDebugLogger) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -227,6 +228,7 @@ public class Util {
|
||||
tookLongTimeCostTimes++;
|
||||
if (tookLongTimeCostTimes > 30) {
|
||||
QuickShop.instance.getConfig().set("disable-debuglogger", true);
|
||||
disableDebugLogger = true;
|
||||
QuickShop.instance.saveConfig();
|
||||
QuickShop.instance.getLogger().warning("Detected the debug logger tooked time keep too lang, QuickShop already auto-disable debug logger, your server performance should back to normal. But you must re-enable it if you want to report any bugs.");
|
||||
}
|
||||
@@ -591,6 +593,7 @@ public class Util {
|
||||
}
|
||||
}
|
||||
worldBlacklist = plugin.getConfig().getStringList("shop.blacklist-world");
|
||||
disableDebugLogger = plugin.getConfig().getBoolean("disable-debuglogger",false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user