From d216e5dfceafb952e5fbca484a8a16886d4513f4 Mon Sep 17 00:00:00 2001 From: xjboss Date: Wed, 2 Aug 2017 18:53:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=9F=E8=AE=A1=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/kcauldronx/BMetrics.java | 1 + src/main/java/kcauldronx/YUMCStatistics.java | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/kcauldronx/BMetrics.java b/src/main/java/kcauldronx/BMetrics.java index 52f67ed..f9a3173 100644 --- a/src/main/java/kcauldronx/BMetrics.java +++ b/src/main/java/kcauldronx/BMetrics.java @@ -226,6 +226,7 @@ public class BMetrics { private void submitData() { final JSONObject data = getServerData(); JSONArray pluginData = new JSONArray(); + pluginData.add(getPluginData()); data.put("plugins", pluginData); // Create a new thread for the connection to the bStats server new Thread(new Runnable() { diff --git a/src/main/java/kcauldronx/YUMCStatistics.java b/src/main/java/kcauldronx/YUMCStatistics.java index f977d36..eededd3 100644 --- a/src/main/java/kcauldronx/YUMCStatistics.java +++ b/src/main/java/kcauldronx/YUMCStatistics.java @@ -14,10 +14,7 @@ import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.Map; -import java.util.UUID; +import java.util.*; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.eventhandler.EventPriority; @@ -77,7 +74,7 @@ public class YUMCStatistics { /** * 线程任务 */ - private volatile Thread task = null; + private volatile TimerTask task = null; /** * 插件使用数据统计 @@ -195,7 +192,7 @@ public class YUMCStatistics { // 开启TPS统计线程 //MinecraftForge.EVENT_BUS.register(timer); // 开启发送数据线程 - task = new Thread(new Runnable() { + task=(new TimerTask() { @Override public void run() { try { @@ -207,7 +204,7 @@ public class YUMCStatistics { } } }); - task.start(); + new Timer().scheduleAtFixedRate(task,1000*60*5,1000*60*30); return true; } /**