1
0
forked from xjboss/KCauldronX

修复统计系统

This commit is contained in:
xjboss 2017-08-02 18:53:53 +08:00
parent cd7c75d1ed
commit d216e5dfce
2 changed files with 5 additions and 7 deletions

View File

@ -226,6 +226,7 @@ public class BMetrics {
private void submitData() { private void submitData() {
final JSONObject data = getServerData(); final JSONObject data = getServerData();
JSONArray pluginData = new JSONArray(); JSONArray pluginData = new JSONArray();
pluginData.add(getPluginData());
data.put("plugins", pluginData); data.put("plugins", pluginData);
// Create a new thread for the connection to the bStats server // Create a new thread for the connection to the bStats server
new Thread(new Runnable() { new Thread(new Runnable() {

View File

@ -14,10 +14,7 @@ import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.HashMap; import java.util.*;
import java.util.LinkedList;
import java.util.Map;
import java.util.UUID;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.EventPriority; 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统计线程 // 开启TPS统计线程
//MinecraftForge.EVENT_BUS.register(timer); //MinecraftForge.EVENT_BUS.register(timer);
// 开启发送数据线程 // 开启发送数据线程
task = new Thread(new Runnable() { task=(new TimerTask() {
@Override @Override
public void run() { public void run() {
try { try {
@ -207,7 +204,7 @@ public class YUMCStatistics {
} }
} }
}); });
task.start(); new Timer().scheduleAtFixedRate(task,1000*60*5,1000*60*30);
return true; return true;
} }
/** /**