diff --git a/bukkit/src/main/java/org/bstats/bukkit/Metrics.java b/bukkit/src/main/java/org/bstats/bukkit/Metrics.java index c3002bf..2a57b49 100644 --- a/bukkit/src/main/java/org/bstats/bukkit/Metrics.java +++ b/bukkit/src/main/java/org/bstats/bukkit/Metrics.java @@ -23,7 +23,7 @@ public class Metrics { /** * Creates a new Metrics instance. * - * @param plugin Your plugin instance. + * @param plugin Your plugin instance. * @param serviceId The id of the service. * It can be found at What is my plugin id? */ @@ -62,6 +62,11 @@ public Metrics(Plugin plugin, int serviceId) { boolean logSentData = config.getBoolean("logSentData", false); boolean logResponseStatusText = config.getBoolean("logResponseStatusText", false); + boolean isFolia = false; + try { + isFolia = Class.forName("io.papermc.paper.threadedregions.RegionizedServer") != null; + } catch (Exception e) {} + metricsBase = new MetricsBase( "bukkit", serverUUID, @@ -69,7 +74,8 @@ public Metrics(Plugin plugin, int serviceId) { enabled, this::appendPlatformData, this::appendServiceData, - submitDataTask -> Bukkit.getScheduler().runTask(plugin, submitDataTask), + // See https://github.com/Bastian/bstats-metrics/pull/126 + isFolia ? null : submitDataTask -> Bukkit.getScheduler().runTask(plugin, submitDataTask), plugin::isEnabled, (message, error) -> this.plugin.getLogger().log(Level.WARNING, message, error), (message) -> this.plugin.getLogger().log(Level.INFO, message), @@ -78,6 +84,7 @@ public Metrics(Plugin plugin, int serviceId) { logResponseStatusText, false ); + } /**