aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2022-11-19 13:33:04 +0000
committerLuck <git@lucko.me>2022-11-19 13:33:04 +0000
commit149b0558afb77b1dffcd413f9259cdacce63711c (patch)
treebff523cd6b33eb1698b75567b7aa0591133d60fc
parentf5ed027fcda244f1a1fea7f7bc7f9f4324f95db9 (diff)
downloadspark-149b0558afb77b1dffcd413f9259cdacce63711c.tar.gz
spark-149b0558afb77b1dffcd413f9259cdacce63711c.tar.bz2
spark-149b0558afb77b1dffcd413f9259cdacce63711c.zip
Background profiler default to disabled for clients/proxies
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/SparkPlatform.java8
1 files changed, 6 insertions, 2 deletions
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();
}
}