From 149b0558afb77b1dffcd413f9259cdacce63711c Mon Sep 17 00:00:00 2001 From: Luck Date: Sat, 19 Nov 2022 13:33:04 +0000 Subject: Background profiler default to disabled for clients/proxies --- .../src/main/java/me/lucko/spark/common/SparkPlatform.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'spark-common/src/main/java/me/lucko') diff --git a/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java b/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java index 105b167..2574443 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java +++ b/spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java @@ -44,6 +44,7 @@ import me.lucko.spark.common.monitor.net.NetworkMonitor; import me.lucko.spark.common.monitor.ping.PingStatistics; import me.lucko.spark.common.monitor.ping.PlayerPingProvider; import me.lucko.spark.common.monitor.tick.TickStatistics; +import me.lucko.spark.common.platform.PlatformInfo; import me.lucko.spark.common.platform.PlatformStatisticsProvider; import me.lucko.spark.common.sampler.Sampler; import me.lucko.spark.common.sampler.SamplerBuilder; @@ -142,7 +143,10 @@ public class SparkPlatform { this.activityLog = new ActivityLog(plugin.getPluginDirectory().resolve("activity.json")); this.activityLog.load(); - this.samplerContainer = new SamplerContainer(this.configuration.getBoolean("backgroundProfiler", true)); + this.samplerContainer = new SamplerContainer(this.configuration.getBoolean( + "backgroundProfiler", + plugin.getPlatformInfo().getType() == PlatformInfo.Type.SERVER + )); this.tickHook = plugin.createTickHook(); this.tickReporter = plugin.createTickReporter(); @@ -187,7 +191,7 @@ public class SparkPlatform { this.plugin.log(Level.INFO, "Starting background profiler..."); try { startBackgroundProfiler(); - } catch (Exception e) { + } catch (Throwable e) { e.printStackTrace(); } } -- cgit