From 33c4c115ab8637ff603af4b8ee09539885b804cd Mon Sep 17 00:00:00 2001 From: EOT3000 <43685885+EOT3000@users.noreply.github.com> Date: Thu, 8 Aug 2019 21:54:02 -0400 Subject: [PATCH] more fixes --- .../java/org/geysermc/connector/metrics/Metrics.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/metrics/Metrics.java b/connector/src/main/java/org/geysermc/connector/metrics/Metrics.java index e3a35dc91..424de9f83 100644 --- a/connector/src/main/java/org/geysermc/connector/metrics/Metrics.java +++ b/connector/src/main/java/org/geysermc/connector/metrics/Metrics.java @@ -1,5 +1,6 @@ package org.geysermc.connector.metrics; +import org.geysermc.api.Geyser; import org.json.simple.JSONArray; import org.json.simple.JSONObject; @@ -14,6 +15,7 @@ import java.util.Map; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.Callable; +import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; import java.util.zip.GZIPOutputStream; @@ -80,13 +82,7 @@ public class Metrics { * Starts the Scheduler which submits our data every 30 minutes. */ private void startSubmitting() { - final Timer timer = new Timer(true); - timer.scheduleAtFixedRate(new TimerTask() { - @Override - public void run() { - submitData(); - } - }, 1000*60*5, 1000*60*30); + Geyser.getGeneralThreadPool().scheduleAtFixedRate(this::submitData, 5, 30, TimeUnit.MINUTES); // Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start // WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted! // WARNING: Just don't do it!