Skip to content

Commit

Permalink
Fix metrics scheduler for Folia (#2449)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukalt authored Jul 2, 2023
1 parent ff1d125 commit 6ee4bbf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/comphenix/protocol/metrics/Metrics.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.comphenix.protocol.metrics;

import com.comphenix.protocol.ProtocolLib;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.ServicePriority;
import org.json.simple.JSONArray;
Expand Down Expand Up @@ -56,7 +56,7 @@ public class Metrics {
private static String serverUUID;

// The plugin
private final Plugin plugin;
private final ProtocolLib plugin;

// A list with all custom charts
private final List<CustomChart> charts = new ArrayList<>();
Expand All @@ -66,7 +66,7 @@ public class Metrics {
*
* @param plugin The plugin which stats should be submitted.
*/
public Metrics(Plugin plugin) {
public Metrics(ProtocolLib plugin) {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null!");
}
Expand Down Expand Up @@ -151,7 +151,7 @@ public void run() {
}
// Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler
// Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;)
Bukkit.getScheduler().runTask(plugin, Metrics.this::submitData);
plugin.getScheduler().runTask(Metrics.this::submitData);
}
}, 1000L * 60 * 5, 1000L * 60 * 30);
// Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start
Expand Down

0 comments on commit 6ee4bbf

Please sign in to comment.