Skip to content

Commit 6ee4bbf

Browse files
authored
Fix metrics scheduler for Folia (#2449)
1 parent ff1d125 commit 6ee4bbf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/com/comphenix/protocol/metrics/Metrics.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.comphenix.protocol.metrics;
22

3+
import com.comphenix.protocol.ProtocolLib;
34
import org.bukkit.Bukkit;
45
import org.bukkit.configuration.file.YamlConfiguration;
56
import org.bukkit.entity.Player;
6-
import org.bukkit.plugin.Plugin;
77
import org.bukkit.plugin.RegisteredServiceProvider;
88
import org.bukkit.plugin.ServicePriority;
99
import org.json.simple.JSONArray;
@@ -56,7 +56,7 @@ public class Metrics {
5656
private static String serverUUID;
5757

5858
// The plugin
59-
private final Plugin plugin;
59+
private final ProtocolLib plugin;
6060

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

0 commit comments

Comments
 (0)